New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Tau constant to math module #6536
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how useful it really is to have this, but well... 😉
pi() -> 3.1415926535897932. | ||
|
||
-spec tau() -> float(). | ||
tau() -> 6.2831853071795864. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion. Instead of writing out the full (yeah, I know) sequence of digits, I would put the value for pi in a constant and define both pi/0
and tau/0
in terms of it:
-define(PI, 3.1415926535897932).
pi() -> ?PI.
tau() -> 2 * ?PI.
You know, in case some day god decides to make math things simpler 😸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't wanted to do it to avoid loosing precision when compiling this module on different machines. We can make math simpler, but IEEE 754 will always stand in our way.
CT Test Results 2 files 88 suites 37m 40s ⏱️ Results for commit 6aebff0. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
@hauleth Some rudimentary test of tau in (Yes, |
e32669d
to
6aebff0
Compare
Rebased into two commits. One for Added test and removed all extra decimals which had no effect. Argue for that in separate PR if there is something I don't get. |
https://tauday.com/tau-manifesto
Tau constant is already present and available in some prominent languages and libraries