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...
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.
Re:Rendering my (billiard) balls in a fragment shader
by sysrpl on Sunday September 11, 2022 @02:48AM
(#32797394)
Lol, wow what a find. You notice the details. I corrected it. Thank you.
Re:Rendering my (billiard) balls in a fragment shader
by xanthine on Sunday September 11, 2022 @04:41AM
(#32797900)
At school, I somehow talked myself into a dumb competition with my math geek about memorizing digits of pi.
I won, with 35 digits memorized (he gave up early; that's also around where the first '0' occurs in pi).
I don't miss any opportunities to test that I still remember them correctly, to this day. ;)
Re:Rendering my (billiard) balls in a fragment shader
by ncmncm on Sunday September 11, 2022 @05:04AM
(#32798045)
I had a hard time getting past the "399" out about 43. I wanted to round it to "4".
But these days I would rather memorize tau:
6.28318530717958647692528676655900576839433879875021
It has that "00" at 27 digits in that must be got past.
Re:Rendering my (billiard) balls in a fragment shader
by zeristor on Sunday September 11, 2022 @04:03AM
(#32797719)
Interesting point if it had been apparent it would have been an issue, at what point does a poor Pi become an issue?
What would a Pi of 3.0 do?
Re:Rendering my (billiard) balls in a fragment shader
by oever on Sunday September 11, 2022 @04:24AM
(#32797815)
Here's a presentation show what happens to rendering in the game Doom when π has different values.
https://media.ccc.de/v/mch2022-236-non-euclidean-doom-what-h...
Re:Rendering my (billiard) balls in a fragment shader
by rzzzt on Sunday September 11, 2022 @05:11AM
(#32798084)
A professor comes around and criticizes it as it is about to become law:
- https://en.wikipedia.org/wiki/Indiana_Pi_Bill
- https://www.straightdope.com/21341975/did-a-state-legislatur...
Re:Rendering my (billiard) balls in a fragment shader
by jffhn on Sunday September 11, 2022 @05:32AM
(#32798198)
The value was superior to mathematical Pi (as is best float approximation, but not best double approximation), such as having 2*PI normalized into [0,2*Pi] by standard trigonometric functions (which use accurate approximations of Pi) would not preserve it and yield a value close to 4.2e-10, which could cause suprises (for example if angular ranges are defined as (start,end) and not (start,span)).
Re:Rendering my (billiard) balls in a fragment shader
by kaoD on Sunday September 11, 2022 @05:11AM
(#32798086)
In this case not a lot happens since it's only used for Z rotation.
Re:Rendering my (billiard) balls in a fragment shader
by rwmj on Sunday September 11, 2022 @03:56AM
(#32797676)
I'm surprised you'd have to define pi in a fragment shader at all. Surely such a commonly used constant would be defined in the language/headers already?
Seems like they missed a '5'.