flt 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +8 -0
  3. data/README.md +765 -0
  4. data/expand.rb +2 -0
  5. data/flt.gemspec +1 -0
  6. data/lib/flt.rb +1 -1
  7. data/lib/flt/bigdecimal.rb +2 -5
  8. data/lib/flt/bin_num.rb +1 -4
  9. data/lib/flt/complex.rb +10 -9
  10. data/lib/flt/dec_num.rb +9 -10
  11. data/lib/flt/float.rb +4 -6
  12. data/lib/flt/math.rb +3 -4
  13. data/lib/flt/num.rb +54 -21
  14. data/lib/flt/sugar.rb +1 -2
  15. data/lib/flt/support.rb +5 -2
  16. data/lib/flt/support/flag_values.rb +1 -1
  17. data/lib/flt/support/rationalizer.rb +3 -3
  18. data/lib/flt/support/rationalizer_extra.rb +6 -6
  19. data/lib/flt/support/reader.rb +1 -1
  20. data/lib/flt/tolerance.rb +2 -7
  21. data/lib/flt/trigonometry.rb +0 -2
  22. data/lib/flt/version.rb +1 -1
  23. data/setup.rb +1 -2
  24. data/test/generate_trig_data.rb +6 -6
  25. data/test/helper.rb +11 -5
  26. data/test/reader.rb +1 -1
  27. data/test/test_base_digits.rb +4 -2
  28. data/test/test_basic.rb +7 -7
  29. data/test/test_big_decimal.rb +21 -21
  30. data/test/test_bin.rb +1 -1
  31. data/test/test_bin_arithmetic.rb +1 -1
  32. data/test/test_binfloat_conversion.rb +1 -1
  33. data/test/test_coercion.rb +1 -1
  34. data/test/test_comparisons.rb +4 -4
  35. data/test/test_dectest.rb +2 -2
  36. data/test/test_define_conversions.rb +10 -10
  37. data/test/test_epsilon.rb +1 -1
  38. data/test/test_exact.rb +12 -11
  39. data/test/test_flags.rb +1 -1
  40. data/test/test_float.rb +23 -25
  41. data/test/test_format.rb +1 -1
  42. data/test/test_formatter.rb +6 -8
  43. data/test/test_hex_format.rb +2 -2
  44. data/test/test_multithreading.rb +1 -1
  45. data/test/test_normalized.rb +1 -1
  46. data/test/test_num_constructor.rb +6 -1
  47. data/test/test_odd_even.rb +1 -1
  48. data/test/test_rationalizer.rb +1 -1
  49. data/test/test_round.rb +36 -1
  50. data/test/test_sugar.rb +6 -6
  51. data/test/test_to_int.rb +4 -4
  52. data/test/test_to_rf.rb +126 -1
  53. data/test/test_tol.rb +1 -1
  54. data/test/test_trig.rb +1 -1
  55. data/test/test_ulp.rb +3 -3
  56. metadata +18 -4
  57. data/README.rdoc +0 -614
@@ -74,7 +74,7 @@ module Flt
74
74
  # for free mode, (any) :nearest rounding is used by default
75
75
  Num.convert(Num[eb].Num(sign, f, e), context.num_class, :rounding=>round_mode||:nearest, :all_digits=>all_digits)
76
76
  when :fixed
77
- if exact_mode = context.exact?
77
+ if context.exact?
78
78
  a,b = [eb, context.radix].sort
79
79
  m = (Math.log(b)/Math.log(a)).round
80
80
  if b == a**m
@@ -85,10 +85,6 @@
85
85
  # tol = Tolerance(1, :percent)
86
86
  # puts tol.equal_to?(3.14159, Math::PI) # -> true#
87
87
 
88
- require 'flt/num'
89
- require 'flt/float'
90
- require 'flt/bigdecimal'
91
-
92
88
  module Flt
93
89
 
94
90
  # The Tolerance class is a base class for all tolerances.
@@ -398,17 +394,16 @@ module Flt
398
394
  when BigDecimal
399
395
  if @radix == :native || @radix == 10
400
396
  exp = xs.map do |x|
401
- sign,digits,base,exp = x.split
397
+ _sign,digits,_base,exp = x.split
402
398
  exp -= 1
403
399
  exp -= 1 if digits=="1" # if :low mode
404
400
  exp -= FloatingTolerance.ref_adjusted_exp
405
401
  exp
406
402
  end.send(mode)
407
- sign, digits, base, vexp = v.split
403
+ _sign, digits, _base, vexp = v.split
408
404
  BigDecimal.new("0.#{digits}E#{vexp+exp}")
409
405
  else
410
406
  # assert num_class==BigDecimal && @radix==2
411
- prec = 10
412
407
  exp = xs.map do |x|
413
408
  exp = (Flt::DecNum(x.to_s).ln/Flt::DecNum(2).ln).ceil - 1 # ... if :high mode
414
409
  exp -= FloatingTolerance.ref_adjusted_exp
@@ -1,5 +1,3 @@
1
- require 'flt/dec_num'
2
-
3
1
  module Flt
4
2
 
5
3
  # Trigonometry functions. The angular units used by these functions can be specified
@@ -1,3 +1,3 @@
1
1
  module Flt
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
data/setup.rb CHANGED
@@ -104,7 +104,7 @@ class ConfigTable
104
104
  def remove(name)
105
105
  item = lookup(name)
106
106
  @items.delete_if {|i| i.name == name }
107
- @table.delete_if {|name, i| i.name == name }
107
+ @table.delete_if {|iname, i| i.name == name }
108
108
  item
109
109
  end
110
110
 
@@ -281,7 +281,6 @@ class ConfigTable
281
281
  'site-ruby-common' => 'siteruby', # For backward compatibility
282
282
  'site-ruby' => 'siterubyver', # For backward compatibility
283
283
  'bin-dir' => 'bindir',
284
- 'bin-dir' => 'bindir',
285
284
  'rb-dir' => 'rbdir',
286
285
  'so-dir' => 'sodir',
287
286
  'data-dir' => 'datadir',
@@ -23,12 +23,12 @@ end
23
23
  # random angles in radians for sin,cos,tan
24
24
  def angle_data(num_class)
25
25
  xs = []
26
- pi = num_class::Math.send(:half_cycle)
26
+ pi = num_class.math { half_cycle }
27
27
  (-8..8).each do |k|
28
28
  x = k*pi/4
29
29
  xs += near(x)
30
30
  end
31
- pi2 = num_class::Math.send(:quarter_cycle)
31
+ pi2 = num_class.math { quarter_cycle }
32
32
  50.times{ xs << random_num_one(num_class)*pi2}
33
33
  base = xs.dup
34
34
  (2...10).each do |k|
@@ -55,7 +55,7 @@ def random_num_one(num_class=DecNum)
55
55
  e = context.etiny
56
56
  elsif rand(20)==0
57
57
  # and some singular values too
58
- if rand(1) == 0
58
+ if rand(2) == 0
59
59
  f = context.radix**context.precision - 1
60
60
  f -= rand(3)
61
61
  else
@@ -63,7 +63,7 @@ def random_num_one(num_class=DecNum)
63
63
  f += rand(3)
64
64
  end
65
65
  # e = random_integer(context.etiny, context.etop)
66
- if rand(1)==0
66
+ if rand(2) == 0
67
67
  e = random_integer(-context.precision-1,-context.precision)
68
68
  else
69
69
  e = random_integer(-context.precision-10,-context.precision)
@@ -71,13 +71,13 @@ def random_num_one(num_class=DecNum)
71
71
  else
72
72
  f = rand(context.radix**context.precision)
73
73
  # e = random_integer(context.etiny, context.etop)
74
- if rand(1)==0
74
+ if rand(2) == 0
75
75
  e = random_integer(-context.precision-1,-context.precision)
76
76
  else
77
77
  e = random_integer(-context.precision-10,-context.precision)
78
78
  end
79
79
  end
80
- # f = -f if rand(1)==0
80
+ # f = -f if rand(2) == 0
81
81
  context.Num(f, e)
82
82
  end
83
83
 
@@ -1,10 +1,16 @@
1
- require 'test/unit'
1
+ require 'minitest/autorun'
2
2
  $: << "." unless $:.include?(".") # for Ruby 1.9.2
3
3
  require File.expand_path(File.join(File.dirname(__FILE__),'/../lib/flt'))
4
4
  require 'enumerator'
5
5
  require 'yaml'
6
6
  include Flt
7
7
 
8
+ module Minitest::Assertions
9
+ def assert_nothing_raised(*)
10
+ yield
11
+ end
12
+ end
13
+
8
14
  def initialize_context
9
15
  DecNum.context = DecNum::ExtendedContext
10
16
  BinNum.context = BinNum::ExtendedContext
@@ -46,9 +52,9 @@ def random_num(num_class)
46
52
  # generate 5% of subnormals
47
53
  f = rand(context.radix**(context.precision-1))
48
54
  e = context.etiny
49
- elsif rand(20)==0
55
+ elsif rand(20) == 0
50
56
  # and some singular values too
51
- if rand(1) == 0
57
+ if rand(2) == 0
52
58
  f = context.radix**context.precision - 1
53
59
  f -= rand(3)
54
60
  else
@@ -60,7 +66,7 @@ def random_num(num_class)
60
66
  f = rand(context.radix**context.precision)
61
67
  e = random_integer(context.etiny, context.etop)
62
68
  end
63
- f = -f if rand(1)==0
69
+ f = -f if rand(2) == 0
64
70
  context.Num(f, e)
65
71
  end
66
72
 
@@ -96,7 +102,7 @@ end
96
102
 
97
103
  def float_data
98
104
  data_file = File.join(File.dirname(__FILE__) ,'data/float_data.yml')
99
- if File.exists?(data_file)
105
+ if File.exist?(data_file)
100
106
  YAML.load(File.read(data_file)).map{|x| [x].pack('H*').unpack('E')[0]}
101
107
  else
102
108
  srand 349842
@@ -4,7 +4,7 @@
4
4
 
5
5
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
6
6
 
7
- class TestReader < Test::Unit::TestCase
7
+ class TestReader < Minitest::Test
8
8
 
9
9
 
10
10
  def setup
@@ -1,8 +1,10 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
3
 
4
- class TestBaseDigits < Test::Unit::TestCase
5
-
4
+ class TestBaseDigits < Minitest::Test
5
+ def setup
6
+ initialize_context
7
+ end
6
8
 
7
9
  def test_number_of_digits_in_other_base
8
10
 
@@ -63,7 +63,7 @@ def return_from_local_context
63
63
  end
64
64
  end
65
65
 
66
- class TestBasic < Test::Unit::TestCase
66
+ class TestBasic < Minitest::Test
67
67
 
68
68
 
69
69
  def setup
@@ -394,17 +394,17 @@ class TestBasic < Test::Unit::TestCase
394
394
  context = num_class.context
395
395
  assert context.nan.nan?
396
396
  assert context.zero.zero?
397
- assert_equal +1, context.sign(context.zero)
397
+ assert_equal(+1, context.sign(context.zero))
398
398
  assert context.zero(+1).zero?
399
- assert_equal +1, context.sign(context.zero(+1))
399
+ assert_equal(+1, context.sign(context.zero(+1)))
400
400
  assert context.zero(-1).zero?
401
- assert_equal -1, context.sign(context.zero(-1))
401
+ assert_equal(-1, context.sign(context.zero(-1)))
402
402
  assert context.infinity.infinite?
403
- assert_equal +1, context.sign(context.infinity)
403
+ assert_equal(+1, context.sign(context.infinity))
404
404
  assert context.infinity(+1).infinite?
405
- assert_equal +1, context.sign(context.infinity(+1))
405
+ assert_equal(+1, context.sign(context.infinity(+1)))
406
406
  assert context.infinity(-1).infinite?
407
- assert_equal -1, context.sign(context.infinity(-1))
407
+ assert_equal(-1, context.sign(context.infinity(-1)))
408
408
  assert_equal context.Num(1)/2, context.one_half
409
409
  end
410
410
  end
@@ -1,38 +1,38 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestBigDecimal < Test::Unit::TestCase
3
+ class TestBigDecimal < Minitest::Test
4
4
 
5
5
  def setup
6
6
  initialize_context
7
7
  end
8
8
 
9
9
  def test_sign
10
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-1.0'))
11
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-10.0'))
12
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-10E50'))
13
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-10E-50'))
14
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-723'))
15
- assert_equal -1, BigDecimal.context.sign(BigDecimal('-0.0'))
10
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-1.0')))
11
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-10.0')))
12
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-10E50')))
13
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-10E-50')))
14
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-723')))
15
+ assert_equal(-1, BigDecimal.context.sign(BigDecimal('-0.0')))
16
16
 
17
- assert_equal +1, BigDecimal.context.sign(BigDecimal('+1.0'))
18
- assert_equal +1, BigDecimal.context.sign(BigDecimal('+10.0'))
19
- assert_equal +1, BigDecimal.context.sign(BigDecimal('+10E50'))
20
- assert_equal +1, BigDecimal.context.sign(BigDecimal('+10E-50'))
21
- assert_equal +1, BigDecimal.context.sign(BigDecimal('+723'))
22
- assert_equal +1, BigDecimal.context.sign(BigDecimal('0.0'))
17
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('+1.0')))
18
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('+10.0')))
19
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('+10E50')))
20
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('+10E-50')))
21
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('+723')))
22
+ assert_equal(+1, BigDecimal.context.sign(BigDecimal('0.0')))
23
23
 
24
24
  assert_nil BigDecimal.context.sign(BigDecimal.context.nan)
25
25
  end
26
26
 
27
27
  def copy_sign
28
- assert_equal -BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), -1)
29
- assert_equal -BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), BigDecimal('-10'))
30
- assert_equal -BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), -1)
31
- assert_equal -BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), BigDecimal('-10'))
32
- assert_equal BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), +1)
33
- assert_equal BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), BigDecimal('+10'))
34
- assert_equal BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), +1)
35
- assert_equal BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), BigDecimal('+10'))
28
+ assert_equal(-BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), -1))
29
+ assert_equal(-BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), BigDecimal('-10')))
30
+ assert_equal(-BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), -1))
31
+ assert_equal(-BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), BigDecimal('-10')))
32
+ assert_equal(BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), +1))
33
+ assert_equal(BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('-1.23'), BigDecimal('+10')))
34
+ assert_equal(BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), +1))
35
+ assert_equal(BigDecimal('1.23'), BigDecimal.context.copy_sign(BigDecimal('1.23'), BigDecimal('+10')))
36
36
  end
37
37
 
38
38
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestBin < Test::Unit::TestCase
3
+ class TestBin < Minitest::Test
4
4
 
5
5
 
6
6
  def setup
@@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
3
  # These tests assume that Float arithmetic is correctly rounded
4
4
  # Random tests using Float as a reference
5
- class TestBinArithmetic < Test::Unit::TestCase
5
+ class TestBinArithmetic < Minitest::Test
6
6
 
7
7
  def setup
8
8
  initialize_context
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
3
 
4
- class TestBinfloatConversion < Test::Unit::TestCase
4
+ class TestBinfloatConversion < Minitest::Test
5
5
 
6
6
  def setup
7
7
  initialize_context
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestCoercion < Test::Unit::TestCase
3
+ class TestCoercion < Minitest::Test
4
4
 
5
5
 
6
6
  def setup
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestComparisons < Test::Unit::TestCase
3
+ class TestComparisons < Minitest::Test
4
4
 
5
5
 
6
6
  def setup
@@ -11,9 +11,9 @@ class TestComparisons < Test::Unit::TestCase
11
11
  assert_equal DecNum('1.1').hash, DecNum('1.1').hash
12
12
  assert_equal DecNum('1.1').hash, (DecNum('1.0')+DecNum('0.1')).hash
13
13
  assert_equal DecNum('1.1',:precision=>10).hash, DecNum('1.1',:precision=>3).hash
14
- assert_not_equal DecNum('1.0').hash, DecNum('1.1').hash
15
- assert_not_equal DecNum('1.0').hash, 1.0.hash
16
- assert_not_equal DecNum('1.0').hash, 1.hash
14
+ refute_equal DecNum('1.0').hash, DecNum('1.1').hash
15
+ refute_equal DecNum('1.0').hash, 1.0.hash
16
+ refute_equal DecNum('1.0').hash, 1.hash
17
17
 
18
18
  assert DecNum('1.1').eql?(DecNum('1.1'))
19
19
  assert DecNum('1.1').eql?(DecNum('1.0')+DecNum('0.1'))
@@ -108,12 +108,12 @@ def unquote(txt)
108
108
  txt
109
109
  end
110
110
 
111
- class TestBasic < Test::Unit::TestCase
111
+ class TestBasic < Minitest::Test
112
112
 
113
113
  def test_dec
114
114
  missing = []
115
115
  dir = File.join(File.dirname(__FILE__), 'data/dectest')
116
- if !File.exists?(dir)
116
+ if !File.exist?(dir)
117
117
  skip "No dectest data present. Get it from http://speleotrove.com/decimal/dectest.zip and put it in test/data/dectest"
118
118
  return
119
119
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestDefineConversions < Test::Unit::TestCase
3
+ class TestDefineConversions < Minitest::Test
4
4
 
5
5
 
6
6
  def setup
@@ -55,20 +55,20 @@ class TestDefineConversions < Test::Unit::TestCase
55
55
  end
56
56
  end
57
57
 
58
- assert_raise(TypeError, RuntimeError) { DecNum('0') == BigDecimal.new('0') }
58
+ assert_raises(TypeError, RuntimeError) { DecNum('0') == BigDecimal.new('0') }
59
59
  unless Num < Numeric
60
60
  # BigDecimal#eql? is weird
61
- assert_not_equal BigDecimal.new('0'), DecNum('0')
62
- assert_not_equal BigDecimal.new('1.2345'), DecNum('1.2345')
63
- assert_not_equal BigDecimal.new('-1.2345'), DecNum('-1.2345')
64
- assert_not_equal BigDecimal.new('1.2345'), DecNum('0.0012345000E3')
65
- assert_raise(TypeError) { BigDecimal.new('7')+DecNum('0.1') }
61
+ refute_equal BigDecimal.new('0'), DecNum('0')
62
+ refute_equal BigDecimal.new('1.2345'), DecNum('1.2345')
63
+ refute_equal BigDecimal.new('-1.2345'), DecNum('-1.2345')
64
+ refute_equal BigDecimal.new('1.2345'), DecNum('0.0012345000E3')
65
+ assert_raises(TypeError) { BigDecimal.new('7')+DecNum('0.1') }
66
66
  end
67
- assert_raise(TypeError, RuntimeError) { DecNum('7')+BigDecimal.new('0.1') }
68
- assert_raise(TypeError, RuntimeError) { DecNum(BigDecimal.new('1.1')) }
67
+ assert_raises(TypeError, RuntimeError) { DecNum('7')+BigDecimal.new('0.1') }
68
+ assert_raises(TypeError, RuntimeError) { DecNum(BigDecimal.new('1.1')) }
69
69
 
70
70
  ['0.1', '-0.1', '0.0', '1234567.1234567', '-1234567.1234567', '1.234E7', '1.234E-7'].each do |n|
71
- assert_raise(TypeError, RuntimeError) { DecNum(n).convert_to(BigDecimal) }
71
+ assert_raises(TypeError, RuntimeError) { DecNum(n).convert_to(BigDecimal) }
72
72
  end
73
73
 
74
74
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
- class TestEpsilon < Test::Unit::TestCase
3
+ class TestEpsilon < Minitest::Test
4
4
 
5
5
 
6
6
  def setup
@@ -1,13 +1,14 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
3
 
4
- class TestExact < Test::Unit::TestCase
5
-
6
-
4
+ class TestExact < Minitest::Test
7
5
  def setup
8
6
  initialize_context
9
7
  end
10
8
 
9
+ def teardown
10
+ initialize_context
11
+ end
11
12
 
12
13
  def test_exact_no_traps
13
14
 
@@ -133,14 +134,14 @@ class TestExact < Test::Unit::TestCase
133
134
  assert_equal DecNum(0), DecNum(1).ln
134
135
  assert !DecNum.context.flags[DecNum::Inexact]
135
136
 
136
- assert_raise(DecNum::Inexact){ DecNum(2).sqrt }
137
- assert_raise(DecNum::Inexact){ DecNum(1)/DecNum(3) }
138
- assert_raise(DecNum::Inexact){ DecNum(18).power(DecNum('0.5')) }
139
- assert_raise(DecNum::Inexact){ DecNum(18).power(DecNum('1.5')) }
140
- assert_raise(DecNum::Inexact){ DecNum(18).log10 }
141
- assert_raise(DecNum::Inexact){ DecNum(1).exp }
142
- assert_raise(DecNum::Inexact){ DecNum('1.2').exp }
143
- assert_raise(DecNum::Inexact){ DecNum('1.2').ln }
137
+ assert_raises(DecNum::Inexact){ DecNum(2).sqrt }
138
+ assert_raises(DecNum::Inexact){ DecNum(1)/DecNum(3) }
139
+ assert_raises(DecNum::Inexact){ DecNum(18).power(DecNum('0.5')) }
140
+ assert_raises(DecNum::Inexact){ DecNum(18).power(DecNum('1.5')) }
141
+ assert_raises(DecNum::Inexact){ DecNum(18).log10 }
142
+ assert_raises(DecNum::Inexact){ DecNum(1).exp }
143
+ assert_raises(DecNum::Inexact){ DecNum('1.2').exp }
144
+ assert_raises(DecNum::Inexact){ DecNum('1.2').ln }
144
145
 
145
146
  end
146
147
 
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'helper.rb'))
2
2
 
3
3
 
4
- class TestFlags < Test::Unit::TestCase
4
+ class TestFlags < Minitest::Test
5
5
 
6
6
  def test_flags
7
7
  f = Flt::Support::Flags(:flag_one, :flag_three)