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

Closed
wants to merge 1 commit into
from

Projects

None yet

5 participants

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

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 simonbaird commented on an outdated diff Jun 28, 2014
ext/bigdecimal/lib/bigdecimal/math.rb
@@ -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
@simonbaird
simonbaird Jun 28, 2014

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 nobu added a commit that referenced this pull request Jun 28, 2014
@nobu nobu bigdecimal/math.rb: error message in BigMath#PI
* 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
38f0133
@simonbaird

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

@thoran
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

@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 mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Aug 10, 2014
@nobu nobu bigdecimal/math.rb: error message in BigMath#PI
* 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
067a279
@simonbaird simonbaird Define the TAU circle constant [Feature #4897]
* 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.
2b8f97f
@mrkn mrkn was assigned by hsbt Jul 9, 2015
@mrkn
Contributor
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

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

@gogotanaka
Member

@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

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
Contributor
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

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

@waldyrious

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