Re:Rendering my (billiard) balls in a fragment shader
by NKosmatos on Sunday September 11, 2022 @03:56AM
(#32797675)
That’s a little bit more accuracy than what is needed for this post, but good catch :-)
https://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimal...
[ Parent
| on HN ]
Re:Rendering my (billiard) balls in a fragment shader
by johnrackles on Sunday September 11, 2022 @04:16AM
(#32797780)
Thats an interestring post, thank you! Do you think that's why for example JavaScripts Math.PI also comes out to 3.141592653589793?
Re:Rendering my (billiard) balls in a fragment shader
by colonwqbang on Sunday September 11, 2022 @04:37AM
(#32797881)
Not really, that's more related to the fixed precision of IEEE 754 floating-point numbers. In any fixed-precision representation there's always a certain representation which happens to be the best approximation of any constant like pi. That's the one you would pick.
However, you could perhaps infer from the article that IEEE 754 double-precision numbers are sufficient for most physical calculations.
Re:Rendering my (billiard) balls in a fragment shader
by wruza on Sunday September 11, 2022 @04:34AM
(#32797870)
It must be either a coincidence or backwards. Math.PI is a double precision floating point number that is set to a closest value of pi that could fit in its 64-bit encoding. https://en.m.wikipedia.org/wiki/Double-precision_floating-po...
Re:Rendering my (billiard) balls in a fragment shader
by debugnik on Sunday September 11, 2022 @04:42AM
(#32797906)
Other way around, they use that value because that's the most precision you get with IEEE-754 64-bit floating-point numbers, which is the representation also used by JS for floating-point.