I noticed the bug described in the topic. I found that Math.sin(Math.PI) generates something like 0.00000014. I looked it up on google just to be sure and found that the sin(pi) is equal to 0 according to google.
Yeah, this is just an error with computer calculation since everything’s in binary, google uses an advanced algorithm (or just simple, idk, I don’t work at google xD) to convert it to the actual result
It’s because of the nature of how numbers are stored. Remember that PI is not a rational number, hence it continues infinitely. However, there’s no way to store infinite digits of numbers in programming, hence the computer uses an approximation. (Which results in a small variance)
2 Likes
3.14 is what we normally use, but in coding, PI is known as a indefinite number (if u rlly wanna know: 3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679
Thank you very much for the help.