Feature #4897 » tau.patch
ext/bigdecimal/lib/bigdecimal/math.rb | ||
---|---|---|
# sin (x, prec)
|
||
# cos (x, prec)
|
||
# atan(x, prec) Note: |x|<1, x=0.9999 may not converge.
|
||
# TAU (prec)
|
||
# PI (prec)
|
||
# E (prec) == exp(1.0,prec)
|
||
#
|
||
... | ... | |
y
|
||
end
|
||
|
||
# See http://tauday.com/
|
||
def TAU(prec)
|
||
raise ArgumentError, "Zero or negative argument for TAU" if prec <= 0
|
||
PI(prec)*BigDecimal("2")
|
||
end
|
||
|
||
# Computes the value of pi to the specified number of digits of precision.
|
||
def PI(prec)
|
||
raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
|
math.c | ||
---|---|---|
|
||
#ifdef M_PI
|
||
rb_define_const(rb_mMath, "PI", DBL2NUM(M_PI));
|
||
rb_define_const(rb_mMath, "TAU", DBL2NUM(M_PI*.20));
|
||
#else
|
||
rb_define_const(rb_mMath, "PI", DBL2NUM(atan(1.0)*4.0));
|
||
rb_define_const(rb_mMath, "TAU", DBL2NUM(atan(1.0)*8.0));
|
||
#endif
|
||
|
||
#ifdef M_E
|