~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to test/bigdecimal/test_bigmath.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    assert_equal(BigDecimal("0.823840753418636291769355073102514088959345624027952954058347023122539489"),
61
61
                 atan(BigDecimal("1.08"), 72).round(72), '[ruby-dev:41257]')
62
62
  end
63
 
 
64
 
  def test_exp
65
 
    assert_in_epsilon(Math::E, exp(BigDecimal("1"), N))
66
 
    assert_in_epsilon(Math.exp(N), exp(BigDecimal("20"), N))
67
 
    assert_in_epsilon(Math.exp(40), exp(BigDecimal("40"), N))
68
 
    assert_in_epsilon(Math.exp(-N), exp(BigDecimal("-20"), N))
69
 
    assert_in_epsilon(Math.exp(-40), exp(BigDecimal("-40"), N))
70
 
  end
71
 
 
72
 
  def test_log
73
 
    assert_in_delta(0.0, log(BigDecimal("1"), N))
74
 
    assert_in_delta(1.0, log(E(N), N))
75
 
    assert_in_delta(Math.log(2.0), log(BigDecimal("2"), N))
76
 
    assert_in_delta(2.0, log(E(N)*E(N), N))
77
 
    assert_in_delta(Math.log(42.0), log(BigDecimal("42"), N))
78
 
    assert_in_delta(Math.log(1e-42), log(BigDecimal("1e-42"), N))
79
 
  end
80
63
end