View previous topic :: View next topic |
Author |
Message |
gonzabar Newbie
Joined: 24 Jun 2001 Posts: 15 Location: Madrid, Spain
|
Posted: Thu Jun 19, 2003 9:42 am Post subject: Incorrect math with -32767 |
|
|
TITLE non-numeric?(VDS4) or incorrect sum(VDS5)
%A = -32767
if @not(@numeric(%A))
info %A is non-numeric value (if VDS4)
end
%C = @sum(%A,5)
INFO (VDS5) Incorrect: %C Correct: @diff(5,32767)
exit
If %A not equal -32767, result is OK. |
|
Back to top |
|
|
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Fri Jun 20, 2003 3:35 pm Post subject: |
|
|
I'm not sure why @SUM() no longer returns an error in VDS 5. Anyway you could
use the floating point functions for working with large numbers, eg. @FADD() and
@FSUB(). |
|
Back to top |
|
|
DavidR Contributor
Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Mon Sep 29, 2003 12:27 pm Post subject: Re: Incorrect math with -32767 |
|
|
gonzabar wrote: | TITLE non-numeric?(VDS4) or incorrect sum(VDS5)
%A = -32767
if @not(@numeric(%A))
info %A is non-numeric value (if VDS4)
end
%C = @sum(%A,5)
INFO (VDS5) Incorrect: %C Correct: @diff(5,32767)
exit
If %A not equal -32767, result is OK. |
OUCH! This one bit me as well. This code works as expected in 3.5 and 4.x but not in VDS5 Hopefully this will be fixed ?
It's a lot nicer to be able to use @OK to determine if a valid variable was used but @SUM in VDS5 returns OK not matter what you feed it.
%A = nonsense
%S = @SUM(%A,10)
IF @OK()
INFO Operation OK! %S
ELSE
WARN Operation failed!
END |
|
Back to top |
|
|
|