Félix

(replying to Saagar Jha)

@saagar this is kind of an unfortunate example because IEEE-754 guarantees sin(±0), sin(±inf), sin(NaN) and pretty much nothing else

2 replies →
2 replies

Saagar Jha

(replying to Félix)
@fay59 No see this exactly describes what I am talking about. The guarantees are lax here which is why the results are allowed to differ in a specified way. The answer is not because “oh floating point math is wishy-washy you can only really rely on the first 3-4 decimal places”

Saagar Jha

(replying to Saagar Jha)
@fay59 Actual quotes here

> If you tested maybe 4 or 5 digits of precision, ok. But all 15 / 17 digits? That is bound to fail, if not guaranteed to fail.

> IEEE-745 double precision binary floating point provides no more than 15 decimal significant digits of precision.

I Can't Believe It's Not Zero!

(replying to Félix)

@fay59 @saagar Right, but the actual answer here is "because different math libraries make different implementation choices," not "because floating-point is black fucking magic"

(Also IEEE 754 guarantees _nothing_ about sin, it only recommends)

1 replies →
1 replies

Itai Ferber

(replying to I Can't Believe It's Not Zero!)

@steve @fay59 @saagar Yeah, for guarantees about sin you're gonna have to turn to religion

I Can't Believe It's Not Zero!

(replying to I Can't Believe It's Not Zero!)

@fay59 @saagar also, for anyone who does want to get the same answer everywhere: core-math.gitlabpages.inria.fr

Philip Trettner

(replying to I Can't Believe It's Not Zero!)

@steve @fay59 @saagar "these implementations were tested on x86_64-linux, with and without the use of fma (fused multiply add)." Ok I'm impressed.

I know this thread is about facing the unknown but I was bitten by fma one time too many. Last personal highlight was non-determinism because the same function was inlined in two different places leading to two different fma substitutions and thus different results.