jneen / math-tau

Other
4 stars 1 forks source link

Consider adding BigMath.TAU #2

Open simonbaird opened 8 years ago

simonbaird commented 8 years ago

Do you think it belongs here?

Possible usage:

>> require 'bigdecimal/math/tau'
>> BigMath.TAU(42).to_s
=> "0.62831853071795864769252867665590057683943387987502116419498752479875898091728E1"

Code is something like this:

require 'bigdecimal/math'
def BigMath.TAU(prec)
  PI(prec) * BigDecimal('2')
end

I could make a pull request if you think it's worthwhile.

jneen commented 8 years ago

Is there an equivalent BigMath::PI?

jneen commented 8 years ago

Ah, I see there is. Yeah, let's add it :]

simonbaird commented 8 years ago

How's that look?

simonbaird commented 8 years ago

Went for module_function so it's more similar to the PI definition.