3 ms·
It seems it uses approximate floating point arithmetics, with 30 digit precision.
by effie 9y ago
It seems it uses approximate floating point arithmetics, with 30 digit precision.
- sharkdp 9y agoCorrect. "2^99 + 1 - 2^99" still works because 2^99 < 10^30
- kmill 9y agoA confusing thing is that the program seems to be using the purescript-quantity library which uses the purescript-decimals library which is arbitrary precision numbers, if I followed the dependencies correctly. The readme also advertises it can deal with 10^(10^10), which it can (doubles can't deal with this, so it's definitely not just using Javascript doubles). The part which prints out numbers rounds to 6 places, but I don't see any place which rounds intermediate results. Edit: Found where 30 digits comes in. https://github.com/sharkdp/purescript-decimals/blob/ad719fc73b00837edf9aca5966744b1915b4a650/src/Data/Decimal.js#L3 https://github.com/sharkdp/purescript-decimals/blob/ad719fc7...