I apologize for not reproducing it earlier as I quickly found a simple example.
In the process of transforming coordinates, X is R * cos(THETA) where R was zero(0)
and THETA was 3.1415.
| ?- R is 0, THETA is 3.1415, X is R * cos(THETA).
R = 0
THETA = 3.1415000000000002
X = -0.0
| ?-
In the debugger this turns out to be -0.0 is (0 * -0.99999999570765619).
Dave
--- On Mon, 2/16/09, Daniel Diaz <address@hidden> wrote:
From: Daniel Diaz <address@hidden> Subject: Re: -0.0 versus 0.0 To: address@hidden Cc: address@hidden Date: Monday, February 16, 2009, 6:31 AM
Dave, think this is due to rounding and/or how floats are displayed by default. Could you try to reproduce it please ? Thank you Dave Sworin a écrit :
Sometimes a variable, after lots of calculations, is instantiated to a
float value of -0.0 in the gprolog interpreter. When I compare the
variable to 0.0, as in X =:= 0.0, it succeeds. X < 0.0 fails. What
is the significance of the minus sign? Is the return of -0.0 intentional?
I don't have a simple example as this usually occurs after some
matrix operations with lots of additions and multiplications.
Dave
|
-- Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé.
_______________________________________________
Bug-prolog mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-prolog
-- Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé. |