3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: -0.000 result  (Read 916 times)

« on: October 15, 2009, 07:47:35 AM »
I don't know if it's "normal" in the fabulous world of computers or if it can be changed (it's not really annoying... :) )
But I get some -0.000 values.
I know what zero is, but negative zero?
I spent more than a month searching bugs in my terrain script because I didn't knew that:
0.1 - 0.1 = -0.0
 and -0.0 != 0.0 :D
« Reply #1 on: October 15, 2009, 08:34:58 AM »
i think there must be something with round off the number
-0,0000004567
is schown as -0,000
but normally there is only +0.
A lot of programs uses "if (... == 0) comparisons and with a very large number of comparisons it can be done faster if there is only one zero.
« Reply #2 on: October 15, 2009, 05:56:50 PM »
Well in 3DRad you'd better use: if (... == 0 || ... == -0)
because I had an artificial loop with that as it was never equal to 0.
« Reply #3 on: October 15, 2009, 06:37:31 PM »
hmm if its like this... i have never before heard of a "native" -0 in a programming language and i don't know why anyone should do that but thanks for the tip. I'll keep it in mind and propably it will solve a problem another day ^^
Pages: [1]