Skip to content
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

Define the TAU circle constant [Feature #4897] #644

Closed
wants to merge 1 commit into from

Conversation

@simonbaird
Copy link

simonbaird commented Jun 28, 2014

  • Define TAU constant in math.c similar to PI.
  • Define TAU method in bigdecimal/math based on existing
    PI method.
@simonbaird
Copy link
Author

simonbaird commented Jun 28, 2014

I tested like this:

oubliette:~/dev/ruby> [trunk_define_tau] /usr/local/bin/ruby -r bigdecimal/math -e 'puts Math::PI, BigMath.PI(20), Math::TAU, BigMath.TAU(20)'
3.141592653589793
0.3141592653589793238462643383279502884519859293521427E1
6.283185307179586
0.6283185307179586476925286766559005769039718587042854E1

@simonbaird
Copy link
Author

simonbaird commented Jun 28, 2014

@@ -180,7 +181,7 @@ def atan(x, prec)
# #=> "0.3141592653589793238462643388813853786957412E1"
#
def PI(prec)
raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
raise ArgumentError, "Zero or negative precision for PI" if prec <= 0

This comment has been minimized.

@simonbaird

simonbaird Jun 28, 2014 Author

Let me know if you don't like this. I'm happy to leave it as 'argument' if that is preferred. My thoughts are that precision is a better word and it is consistent with the message in the E method below.

nobu added a commit that referenced this pull request Jun 28, 2014
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
  message about zero or negative precision for clarity and
  consistency with other methods.  [GH-644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@simonbaird
Copy link
Author

simonbaird commented Jun 28, 2014

Rebased on top of 38f0133 "bigdecimal/math.rb: error message in BigMath#PI"

@thoran
Copy link

thoran commented Jul 6, 2014

Simon, I think you've erred in putting PI first. Shouldn't TAU be first? Or perhaps they should be in alphabetical order: E, PI, TAU? Thanks for this patch and raising my awareness of Tau. I'm a Tau convert now too...

@simonbaird
Copy link
Author

simonbaird commented Jul 19, 2014

@thoran (Not sure if you're totally serious, but) I don't think changing the order is necessary or sensible. Glad to hear Tau has another convert.. :)

mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Aug 10, 2014
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath#PI): change error
  message about zero or negative precision for clarity and
  consistency with other methods.  [rubyGH-644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
@sorah sorah force-pushed the ruby:trunk branch from 5317131 to 307198a Nov 26, 2014
* math.c: Define TAU constant in similar to PI constant.
* ext/bigdecimal/lib/bigdecimal/math.rb: Define TAU method in
  bigdecimal/math based on existing PI method.
@simonbaird simonbaird force-pushed the simonbaird:trunk_define_tau branch from 2661af9 to 2b8f97f Jul 2, 2015
@hsbt hsbt assigned mrkn Jul 9, 2015
@mrkn
Copy link
Member

mrkn commented Jul 9, 2015

@simonbaird Please tell me how popular is tau in the community of mathematicians and physicians. I don't have any idea of it. I want to know how many research papers or textbooks using this new constant definition have been published as of today.

@simonbaird
Copy link
Author

simonbaird commented Jul 10, 2015

@mrkn Take a look here. It shows a year by year list of Tau related highlights including some books and publications that use it.

@simonbaird
Copy link
Author

simonbaird commented Jul 10, 2015

Google calculator has Tau: https://www.google.com/search?q=tau+%2B+0

@gogotanaka
Copy link
Member

gogotanaka commented Jul 10, 2015

@simonbaird Hi! Thank you for working on it. While leaving a decision to @mrkn san, let me say something here.

Tau makes more sense than pi to me and is important constant as you show. I personally love this number.
But I really doubt whether it worth having tau as constant in Ruby. There are a lot of other math constants which are also important. And E and PI are top two of special one, very special. While Nobody complain about having E and PI as constant, discussing about how important other constants(Tau) is and worth it are kind of difficult.

@simonbaird
Copy link
Author

simonbaird commented Jul 13, 2015

The two most important constants in mathematics are e and "the circle constant". And, (according to the Tau supporters, myself included), the circle constant is Tau. So that's why I don't think the "slippery slope" argument, i.e. "if we add Tau then people will want to add many other constants" is valid.

Nevertheless, I understand the decision about whether to merge this is not a clear one. Here's some of my thoughts why it could be merged:

  • It won't hurt anyone
  • It can help further the acceptance and adoption of Tau (which I believe is a good thing for the world)

How about asking "why not" instead of "why"?

@mrkn
Copy link
Member

mrkn commented Jul 20, 2015

@simonbaird I decided to reject this proposal. The reasons is:

  • It looks to me that tau as the circle constant isn't popular enough to be introduced in Ruby's core although it has good property.
  • So introducing tau is hurt the future Ruby now. Core constants cannot remove easily.
  • It's not Ruby's role to help further the acceptance and adoption of tau.
  • I found that Python and Julia rejected similar proposals. See https://bugs.python.org/issue12345 and JuliaLang/julia#4864.
@mrkn mrkn closed this Jul 20, 2015
@simonbaird
Copy link
Author

simonbaird commented Jul 21, 2015

Okay, your reasoning is very sensible and well explained. Thanks very much for the consideration. Best wishes, Simon.

@waldyrious
Copy link

waldyrious commented Feb 10, 2017

I found that Python and Julia rejected similar proposals. See https://bugs.python.org/issue12345 and JuliaLang/julia#4864.

Just FYI, Python actually ended up incorporating the proposal: issue 12345 is now marked as solved -- by Guido himself, no less :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.