Hi everybody, I get a 'argument to `SqRt' is < 0' error. I have checked that the argument is never < 0, so I don't understand why I should get this error (if I comment the sqrt instruction, though, the error goes away!). Also by using the -g option and gdb, I don't get any more information. Can anybody help me, possibly by suggesting some other debug option/method? Thanks Silvio a Beccara - Cornell University - USA
On Thu, 28 Aug 2003, Silvio a Beccara wrote:
I get a 'argument to `SqRt' is < 0' error. I have checked that the argument is never < 0, so I don't understand why I should get this error (if I comment the sqrt instruction, though, the error goes away!). Also by using the -g option and gdb, I don't get any more information. Can anybody help me, possibly by suggesting some other debug option/method?
You might try this simple approach: Assuming it's sqrt(i) then add 2 lines just before the sqrt: writeln(i); if( i < 0 ) then i := -i; This writes i to stdout; you could "writeln( stderr, i );" Russ
Dear Russ, thank you for your suggestion. After playing around a bit, I think that the argument, for some reason I have to find, is simply too small (something like 1E-316), and therefrom comes the error. I had also tried to put an ABS function in front of the argument, but the result was the same. Bye Silvio On Thu, 28 Aug 2003, Russell Whitaker wrote: | | | On Thu, 28 Aug 2003, Silvio a Beccara wrote: | | > I get a 'argument to `SqRt' is < 0' error. I have checked that the | > argument is never < 0, so I don't understand why I should get this error | > (if I comment the sqrt instruction, though, the error goes away!). | > Also by using the -g option and gdb, I don't get any more information. Can | > anybody help me, possibly by suggesting some other debug option/method? | | You might try this simple approach: | Assuming it's sqrt(i) then add 2 lines just before the sqrt: | | writeln(i); | if( i < 0 ) then i := -i; | | This writes i to stdout; you could "writeln( stderr, i );" | | Russ |
Silvio a Beccara wrote:
thank you for your suggestion. After playing around a bit, I think that the argument, for some reason I have to find, is simply too small (something like 1E-316), and therefrom comes the error. I had also tried to put an ABS function in front of the argument, but the result was the same.
Can you provide some code to demonstrate the problem? Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707
participants (3)
-
Frank Heckenbach -
Russell Whitaker -
Silvio a Beccara