Real zero value

Product :4D - 4D Server
4D : v17.0
OS : Mac OS X

I’m running Mac High Sierra on a Quad Core i7 Mac Mini. The problem I will describe also occurs for V16R4.

[]26129891;“Your comment here…”[/]

Just check the expression pane, showing 0.00001=0 as False, but 0.000001=0 as True. This is reflected for actual variables or fields. I’m aware of issues of Numerical Analysis, but I was somewhat surprised by how few decimal places this transition occurred at.

The real world variables/fields involved were REAL. Maybe this wouldn’t bother business people, but science is not so happy.

Perhaps someone else using a different OS could check this?

Steve Robertson

Hello,

That’s a standard behaviour in all language …
If you want to control this, please read the documentation :
http://doc.4d.com/4Dv17/4D/17/SET-REAL-COMPARISON-LEVEL.301-3729404.en.html

Regards,

: Steve ROBERTSON

Perhaps someone else using a different OS could check this?

The magic of reals is sometimes difficult to understand.

No need to use another OS.
Just open Chrome browser, then use developer tools menu to get access to console window (avoiding the need to write a JavaScript file).
If you prefer more, you can also use Safari for the same test.

Enter:

(0.1+0.2)+0.3 == 0.1+(0.2+0.3)
-> false

False?

Let’s do some (really simple) maths:

0.1+(0.2+0.3)
-> 0.6

(0.1+0.2)+0.3
0.6000000000000001

0.1+0.2+0.3
0.6000000000000001

0.1 + 0.5
0.6

If you google around, you find similar examples for other languages, such as
https://floating-point-gui.de/errors/comparison/