(no title)
warpech | 2 years ago
E.g. I would assume that Math.sin(x) returns the same thing in NodeJS on Windows and Mac/M1, but it turns out it is necessarily so. https://stackoverflow.com/questions/74074312/standard-math-f...
warpech | 2 years ago
E.g. I would assume that Math.sin(x) returns the same thing in NodeJS on Windows and Mac/M1, but it turns out it is necessarily so. https://stackoverflow.com/questions/74074312/standard-math-f...
retrac|2 years ago
https://en.wikipedia.org/wiki/Rounding#Table-maker's_dilemma
lifthrasiir|2 years ago
[1] https://core-math.gitlabpages.inria.fr/
throwawaymaths|2 years ago
True in general but for the basic datatypes sent through hardware regusters your processor architecture has fixed precision. So the time and space complexity is O(1)
ImHereToVote|2 years ago
Arelius|2 years ago
We implemented a deterministic approximation, and moved on. But I learned something important about trig functions that day.
cogman10|2 years ago
So while what you say is true about the x87 implementation of those functions, for anything targeting a machine built in the last 20 years it's likely the code will run consistently regardless the architecture (barring architecture floating point bugs, which aren't terribly uncommon in the less significant bits and when overclocking comes into play).
x86 compilers won't use x87 instructions when SSE2 and later are available. x87 is just a really weird and funky instruction set that's best left in the gutter of history.
bnprks|2 years ago
Unfortunately, floating point results will probably continue to differ across platforms for the foreseeable future.
unknown|2 years ago
[deleted]
enriquto|2 years ago
hmmm, can you use the long doubles in sse or avx? They are glorious, and as far as I see from playing with godbolt, they still require dirtying your hands with the x87 stack.
bee_rider|2 years ago
fulafel|2 years ago
paulddraper|2 years ago
I would use the word "consistent."
Non-determinism implies randomness.
unknown|2 years ago
[deleted]
TylerE|2 years ago
jacobolus|2 years ago
saagarjha|2 years ago
throwway120385|2 years ago
aardvark179|2 years ago
mhh__|2 years ago
charlieyu1|2 years ago
contravariant|2 years ago
aardvark179|2 years ago
layer8|2 years ago
adgjlsfhk1|2 years ago
quickthrower2|2 years ago
Karliss|2 years ago
lifthrasiir|2 years ago