5 ms·
For some reason the value of Pi given in the C++ code is wrong! It's given in the source as 3.14159274101257324219 when the right value to the same number of d
by james_a_craig 1y ago
For some reason the value of Pi given in the C++ code is wrong!
It's given in the source as 3.14159274101257324219
when the right value to the same number of digits is
3.14159265358979323846. Very weird. I noticed when I went to look at the C++ to see how this algorithm was actually implemented.
https://github.com/alexandrefrancois/noFFT/blob/main/src/ResonatorBank.cpp https://github.com/alexandrefrancois/noFFT/blob/main/src/Res... line 31.
- pvg 1y agoThat is a very 'childhood exposure to 8 digit calculators' thing to notice.
- james_a_craig 1y agoChildhood exposure to pi generation algorithms; the correct version above was from memory.
- pvg 1y agoClose enough! The wrong 7 jumped out at me instantly although I didn't remember more than a few after.
- deleted 1y ago[deleted]
- 2YwaZHXV 1y agoseems since it's a float it's only 32-bits, and the representation of both 3.14159274101257324219 and 3.14159265358979323846 is the same in IEEE-754: 0x40490fdb though I agree that it is odd to see, and not sure I see a reason why they wouldn't use 3.14159265358979323846
- james_a_craig 1y agoYeah, it’s as if they wrote a program to calculate pi in a float and saved the output. Very strange choice given how many places the value of pi can be found.
- arjf 1y agoIndeed... I honestly don't remember where or how I sourced the value, and why I did not use the "correct" one - I will correct in the next release of the package. Thanks for pointing it out!
- deleted 1y ago[deleted]