Module: BigMath

Defined in:
lib/mug/tau.rb

Instance Method Summary collapse

Instance Method Details

#TAU(prec) ⇒ BigDecimal

Computes the value of tau to the specific number of digits of precision.

Examples:

require 'bigdecimal'
require 'bigdecimal/math'
include BigMath

puts TAU(150)

Parameters:

  • prec (Integer)

    the number of decimal digits of precision in the computed value.

Returns:

  • (BigDecimal)

    the computed value

Raises:

  • (ArgumentError)

    if prec is not positive



23
24
25
26
# File 'lib/mug/tau.rb', line 23

def TAU(prec)
  raise ArgumentError, 'Zero or negative argument for TAU' if prec <= 0
  PI(prec) * BigDecimal('2')
end