math.rb

Path: bigdecimal/lib/bigdecimal/math.rb
Last Update: Wed Aug 20 00:16:09 AUS Eastern Standard Time 2003

Contents:

  sqrt(x, prec)
  sin (x, prec)
  cos (x, prec)
  atan(x, prec)  Note: |x|<1, x=0.9999 may not converge.
  exp (x, prec)
  log (x, prec)
  PI  (prec)
  E   (prec) == exp(1.0,prec)

where:

  x    ... BigDecimal number to be computed.
           |x| must be small enough to get convergence.
  prec ... Number of digits to be obtained.

Usage:

  require "bigdecimal"
  require "bigdecimal/math.rb"
  include BigMath
  a = BigDecimal((PI(100)/2).to_s)
  puts sin(a,100) # => 0.10000000000000000000......E1

[Validate]