Search found 176 matches
- Thu Nov 27, 2014 10:00 pm
- Forum: Component Pascal
- Topic: Quick Quiz #1 - DIV and MOD
- Replies: 11
- Views: 25981
Re: Quick Quiz #1 - DIV and MOD
The MOD function is actually meaningless for negative divisors because MOD is mathematically only defined for positive values. Questionable. The Wikipedia article http://en.wikipedia.org/wiki/Modular_arithmetic#Residue_systems, see the section "Integers modulo n", defines them in terms of...
- Sun Nov 23, 2014 4:01 pm
- Forum: Component Pascal
- Topic: Quick Quiz #1 - DIV and MOD
- Replies: 11
- Views: 25981
Re: Quick Quiz #1 - DIV and MOD
Well I got these right, but this stuff is my bead and butter so it would have been embarrassing if I had not. It gets harder when the number to the right of the DIV & MOD operators (which I shall call 'm') is negative. BlackBox is one of the few environments I have come across that does the 'rig...
- Wed Nov 20, 2013 8:36 pm
- Forum: Component Pascal
- Topic: Numerical Analysis
- Replies: 13
- Views: 35142
Re: Numerical Analysis
The following Module: - Does NOT TRAP on the ASSERT 30 - Does TRAP on the ASSERT 40. MODULE RdcRounding; IMPORT Math; PROCEDURE MyPi () : REAL; BEGIN RETURN Math.Pi () END MyPi; PROCEDURE TestEQ (a, b : REAL); BEGIN ASSERT (a = b, 30) END TestEQ; PROCEDURE Do*; VAR pi : REAL; BEGIN pi := MyPi (); Te...
- Tue Nov 19, 2013 10:27 pm
- Forum: Component Pascal
- Topic: Numerical Analysis
- Replies: 13
- Views: 35142
Re: Numerical Analysis
My first guess was it was a 64-bit / 80-bit issue, but here is an example using 3-digit base 10 floating point: The Test: 0.501 + 0.502 <= 1 becomes 1.00(3) rounded to 1.00 <= 1 becomes TRUE. The Expression: Sqrt (1.00 - 0.501 - 0.502) ~> Sqrt (0.499 - 0.502) ~> Sqrt (-0.003) ~> TRAP! It is the orde...
- Fri Nov 15, 2013 5:11 pm
- Forum: Component Pascal
- Topic: Numerical Analysis
- Replies: 13
- Views: 35142
Numerical Analysis
I have a function, say 'Foo', that returns Math.Sqrt (1. - u * u - v * v) with u & v declared as REAL. My application has the line: IF u * u + v * v <= 1. THEN w := Foo (u, v) ELSE ... This has worked fine for years, and I assumed that it was 'safe'. Yesterday it crashed (Square root of a negati...
- Sat Sep 28, 2013 4:02 pm
- Forum: BlackBox Framework
- Topic: File handling
- Replies: 8
- Views: 15654
File handling
Hi
I always assumed that if I wrote:
for example, and the path did not exist, that I would get loc = NIL.
However that does not seem to be the case.
What is the easiest way to test if a specific path exists?
Thanks
Robert
I always assumed that if I wrote:
Code: Select all
loc := Files.dir.This ("D:\Data\ProjectX");
However that does not seem to be the case.
What is the easiest way to test if a specific path exists?
Thanks
Robert