Search found 67 matches

by manumart1
Sun Nov 30, 2014 11:44 am
Forum: Component Pascal
Topic: Quick Quiz #2 - Semicolons - Solutions
Replies: 3
Views: 12811

Re: Quick Quiz #2 - Semicolons - Solutions

How many semicolons need to be removed from the following code snippet before it will compile? It does not say "can (optionally)", it says "need to". My answer is: none of the semicolons need to be removed. I know that the semicolon is a separator of statements, not a terminator...
by manumart1
Wed Nov 26, 2014 7:23 pm
Forum: GUI problems
Topic: How to show interactively a question to the user
Replies: 2
Views: 11889

Re: How to show interactively a question to the user

Many many thanks, Ivan.

Also I see that to show an explicit message to the user, instead of Dialog.ShowMsg I must use:

Code: Select all

Dialog.GetOK("Operation correctly performed", "", "", "", {Dialog.ok}, resp)
by manumart1
Wed Nov 26, 2014 11:26 am
Forum: GUI problems
Topic: How to show interactively a question to the user
Replies: 2
Views: 11889

How to show interactively a question to the user

Dialog.ShowMsg shows a message to the user on the log window and on the status bar; I have not been able to see a separate small dialog box with the message, even I closed the log window, but that is not my problem now. My problem is: I want to show a question to the user onto an small modal window...
by manumart1
Mon Nov 24, 2014 8:19 am
Forum: Component Pascal
Topic: Quick Quiz #1 - DIV and MOD
Replies: 11
Views: 24867

Re: Quick Quiz #1 - DIV and MOD

My answer:

1.

Code: Select all

q := -10 DIV 3;
r := -10 MOD 3;
q = -4
r = 2

I applied these rules:
  • (a) -10 = 3 * q + r
  • (b) q = The greatest integer so that
    • (b.1) 3 * q <= -10
    • (b.2) -10 <= 3 * (q + 1)
2.

Code: Select all

x := -10;
q := x DIV 3;
r := x MOD 3;
Same as 1.
by manumart1
Fri Mar 21, 2014 11:23 am
Forum: Bug
Topic: Procedure Strings.Replace has a bug
Replies: 2
Views: 7432

Procedure Strings.Replace has a bug

According to specification: PROCEDURE Replace (VAR s: ARRAY OF CHAR; pos, len: INTEGER; IN rep: ARRAY OF CHAR) Replaces the stretch [pos, MIN(pos+len, Len(s))) in s with the string in rep. The characters after the replaced stretch are moved if necessary. The result is truncated if s is not large eno...
by manumart1
Wed Nov 20, 2013 9:01 am
Forum: Component Pascal
Topic: Numerical Analysis
Replies: 13
Views: 33880

Re: Numerical Analysis

But is Sqrt (1.00 - (0.501 + 0.502)) safe? I think yes, Sqrt (1.00 - (0.501 + 0.502)) is more safe than Sqrt (1.00 - 0.501 - 0.502) I say this because (as Gérard has pointed) in my previous program to find anomalous values of u and v, I see this: ... IF u * u + v * v <= 1. THEN IF 1. - (u * u) - (v...
by manumart1
Tue Nov 19, 2013 9:03 am
Forum: Component Pascal
Topic: Numerical Analysis
Replies: 13
Views: 33880

Re: Numerical Analysis

Instead of IF u * u + v * v <= 1. THEN you can use IF (1. - u * u - v * v) >= 0 THEN Although they seem equivalent, they are not because of floating point issues. I have made some test and found some values which show that: MODULE TestFloatPoint; IMPORT StdLog, Math; PROCEDURE Do*; CONST ONE = 0.999...