Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are there a lot of systems that define arctangent but not pi?


The cheap Sinclair Scientific calculator (1974) was rather primitive, so instead of storing constants internally, it printed constants such as e and pi on the case. The calculator was rather inaccurate, so you were much better off using 3.14159 from the case than computing 4×atan(1), which gave 3.1440.


It'd be interesting to see their implementation and the trade-offs its designers made.


I'm glad you asked :-) I reverse-engineered the Sinclair Scientific calculator, documented its code, and built a simulator: http://files.righto.com/calculator/sinclair_scientific_simul...

The short answer is that they used a 4-function calculator chip with just 320 words of ROM and managed to reprogram it into a cheap scientific calculator, a remarkable feat. The tradeoff was that the calculator was very slow and inaccurate.


That's amazing! Thank you for sharing!


C/C++ don't define PI but have an atan function. According to the TIOBE Index for September 2020 (https://www.tiobe.com/tiobe-index/) those languages are both in the top 5 of languages used by developers.


C++20 defines mathematical constants including Pi.

https://en.cppreference.com/w/cpp/numeric/constants


Thanks for the heads up! I haven't been paying any attention to C++20. You must be on the cutting edge of C++ to know that - I ended up having to work a bit on my Macbook Pro to get a version of gcc working that defines std::numbers::pi.


They don’t but POSIX requires M_PI.


Yes - Fortan doesn't have a built-in pi constant, but does have trigonometric functions. Usually programs define pi based on atan or some other trig relation.


bc calculator doesn't (or didn't) define pi, but has atan. I've used "4*atan(1) method" in bc to get pi.


This works, `echo 'scale=100;4*a(1)' | bc -lq`




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: