Spend hours finding the perfect float value.... "Magic Number... or Mathematical Constant?"

amazing trick

Thanks for the taking the time to write a great answer. I've been programming for awhile but reading and thinking about Math is very new to me. Yeah this example from Q3 is exactly what I'm talking about. It's both an adaptation of a known method for calculating a square root combined with a clever optimization trick of the day that satisfies a particular project's needs to a level of 'good enough' accuracy. Now I think the reason why the code actually looks that way is because of the many layers of systems it has been built upon.

CPU Architecture => C Compiler / Syntax => Base 10 number system.

Obviously it is natural to see the relationship between a diameter and its circle visually but very 'dirty' syntactically to calculate the value of PI in base 10. Why not use a base PI number system in some cases, where it would instead be difficult to calculate the number 1? Could you provide examples of stuff like this?

Maybe theres not much of a follow up question here but I'm just thinking about the relationship between coordinate systems developed over time by Mathematicians and programming languages/environments.

Sure one could hack together something in OpenGL with Perl but it would make more sense to use a different language less biased towards working with text. On the other hand if you want to write or generate poetry then the abstractions that Perl provide syntactically make that kind of code much easier to reason about than in C.

The story behind my original question:

Recently I was making a simple little wandering robot and the code was fairly verbose using cartesian coordinates so I switched to a relative system (Turtle Graphics) where x, y coordinates are only used to implement the output and the geometry itself doesn't deal in coordinates at all. Using that sort of geometric system makes coding relationships about movement come much more easily and so I became curious by thinking about coordinate systems as 'platforms' in the software sense.

/r/math Thread Parent