Hacker News new | ask | show | jobs
by amelius 856 days ago
Are you saying that IEEE 754 floating point (which everybody is using) is not deterministic?
3 comments

For 32-bit x86 it's certainly not. The C standard permits intermediates to preserve excess precision, and the only way to avoid that is by flushing to memory, which is slow. On Windows you usually get 64-bit intermediates and on other OSes usually 80-bit.

64-bit x86 and modern non-x86 architectures are usually deterministic for primitive operations at least, but libm differences abound.

Simple operations like addition and multiplication are generally bit-for-bit deterministic, even across different architectures. More complex operations like fused multiply-add can have slightly different rounding behavior. But the big issue is with the more complicated operations, like trigonometric functions or non-integer exponentiation. Those often have differing implementations between platforms, and the only way to guarantee determinism is to essentially roll your own sin/cos/tan/sqrt/etc.
You have to be careful with comparisons. In JavaScript, for instance, `(0.1 + 0.2) != (0.3)`.
Well that doesn't make it non-deterministic in behavior.
(a+b)-a doesn’t always equal (a-a)+b

It’s different behavior if the order of operations are non-deterministic.

Plenty of room for such things in games. Most of the time the effects are too small to notice. They can chaos-theory out of control, though.

So real time games nearly universally sync state instead of relying on deterministic synchronization via events/actions.

For a good read, look up lockstep deterministic networking.

There’s way too much nuance here to be so dismissive

Chaotic behaviour is deterministic
Weird how I write complete thoughts and supply references but this site full of tech geniuses mostly produces downvotes and single-sentence drivebys.

Come back when you have things worth contributing.

I’m a theoretical physicist, not a tech genius. Perhaps that’s the mode matching problem here. I don’t trust your 23 hour old account though :)