long-decimal 0.00.17 → 0.00.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/README +10 -8
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/doc/classes/LongDecimal.html +1 -1
  5. data/doc/classes/LongDecimal.src/M000041.html +4 -0
  6. data/doc/classes/LongDecimal.src/M000042.html +1 -1
  7. data/doc/classes/LongDecimal.src/M000043.html +1 -1
  8. data/doc/classes/LongDecimal.src/M000044.html +1 -1
  9. data/doc/classes/LongDecimal.src/M000045.html +1 -1
  10. data/doc/classes/LongDecimal.src/M000046.html +1 -1
  11. data/doc/classes/LongDecimal.src/M000047.html +10 -6
  12. data/doc/classes/LongDecimal.src/M000048.html +1 -1
  13. data/doc/classes/LongDecimal.src/M000049.html +1 -1
  14. data/doc/classes/LongDecimal.src/M000050.html +1 -1
  15. data/doc/classes/LongDecimal.src/M000051.html +1 -1
  16. data/doc/classes/LongDecimal.src/M000052.html +1 -1
  17. data/doc/classes/LongDecimal.src/M000053.html +1 -1
  18. data/doc/classes/LongDecimal.src/M000054.html +1 -1
  19. data/doc/classes/LongDecimal.src/M000055.html +1 -1
  20. data/doc/classes/LongDecimal.src/M000056.html +1 -1
  21. data/doc/classes/LongDecimal.src/M000058.html +1 -1
  22. data/doc/classes/LongDecimal.src/M000059.html +1 -1
  23. data/doc/classes/LongDecimal.src/M000060.html +1 -1
  24. data/doc/classes/LongDecimal.src/M000061.html +1 -1
  25. data/doc/classes/LongDecimal.src/M000062.html +1 -1
  26. data/doc/classes/LongDecimal.src/M000063.html +1 -1
  27. data/doc/classes/LongDecimal.src/M000064.html +1 -1
  28. data/doc/classes/LongDecimal.src/M000065.html +1 -1
  29. data/doc/classes/LongDecimal.src/M000066.html +1 -1
  30. data/doc/classes/LongDecimal.src/M000067.html +1 -1
  31. data/doc/classes/LongDecimal.src/M000068.html +1 -1
  32. data/doc/classes/LongDecimal.src/M000069.html +1 -1
  33. data/doc/classes/LongDecimal.src/M000070.html +1 -1
  34. data/doc/classes/LongDecimal.src/M000071.html +1 -1
  35. data/doc/classes/LongDecimal.src/M000072.html +1 -1
  36. data/doc/classes/LongDecimal.src/M000073.html +1 -1
  37. data/doc/classes/LongDecimal.src/M000074.html +1 -1
  38. data/doc/classes/LongDecimal.src/M000075.html +1 -1
  39. data/doc/classes/LongDecimal.src/M000076.html +1 -1
  40. data/doc/classes/LongDecimal.src/M000077.html +1 -1
  41. data/doc/classes/LongDecimal.src/M000078.html +1 -1
  42. data/doc/classes/LongDecimal.src/M000079.html +1 -1
  43. data/doc/classes/LongDecimal.src/M000080.html +1 -1
  44. data/doc/classes/LongDecimal.src/M000081.html +1 -1
  45. data/doc/classes/LongDecimal.src/M000082.html +1 -1
  46. data/doc/classes/LongDecimal.src/M000083.html +1 -1
  47. data/doc/classes/LongDecimal.src/M000084.html +1 -1
  48. data/doc/classes/LongDecimal.src/M000085.html +1 -1
  49. data/doc/classes/LongDecimal.src/M000086.html +1 -1
  50. data/doc/classes/LongDecimal.src/M000087.html +1 -1
  51. data/doc/classes/LongDecimal.src/M000088.html +1 -1
  52. data/doc/classes/LongDecimal.src/M000089.html +1 -1
  53. data/doc/classes/LongDecimal.src/M000090.html +1 -1
  54. data/doc/classes/LongDecimal.src/M000091.html +1 -1
  55. data/doc/classes/LongDecimal.src/M000094.html +1 -1
  56. data/doc/classes/LongDecimal.src/M000095.html +1 -1
  57. data/doc/classes/LongDecimal.src/M000096.html +1 -1
  58. data/doc/classes/LongDecimal.src/M000097.html +1 -1
  59. data/doc/classes/LongDecimal.src/M000098.html +1 -1
  60. data/doc/classes/LongDecimal.src/M000099.html +1 -1
  61. data/doc/classes/LongDecimalQuot.src/M000003.html +1 -1
  62. data/doc/classes/LongDecimalQuot.src/M000004.html +1 -1
  63. data/doc/classes/LongDecimalQuot.src/M000005.html +1 -1
  64. data/doc/classes/LongDecimalQuot.src/M000006.html +1 -1
  65. data/doc/classes/LongDecimalQuot.src/M000007.html +1 -1
  66. data/doc/classes/LongDecimalQuot.src/M000008.html +1 -1
  67. data/doc/classes/LongDecimalQuot.src/M000009.html +1 -1
  68. data/doc/classes/LongDecimalQuot.src/M000010.html +1 -1
  69. data/doc/classes/LongDecimalQuot.src/M000011.html +1 -1
  70. data/doc/classes/LongDecimalQuot.src/M000012.html +1 -1
  71. data/doc/classes/LongDecimalQuot.src/M000013.html +1 -1
  72. data/doc/classes/LongDecimalQuot.src/M000014.html +1 -1
  73. data/doc/classes/LongDecimalQuot.src/M000015.html +1 -1
  74. data/doc/classes/LongDecimalQuot.src/M000016.html +1 -1
  75. data/doc/classes/LongDecimalQuot.src/M000017.html +1 -1
  76. data/doc/classes/LongDecimalQuot.src/M000018.html +1 -1
  77. data/doc/classes/LongDecimalQuot.src/M000019.html +1 -1
  78. data/doc/classes/LongDecimalQuot.src/M000020.html +1 -1
  79. data/doc/classes/LongDecimalQuot.src/M000021.html +1 -1
  80. data/doc/classes/LongDecimalQuot.src/M000022.html +1 -1
  81. data/doc/classes/LongDecimalQuot.src/M000023.html +1 -1
  82. data/doc/classes/LongDecimalQuot.src/M000024.html +1 -1
  83. data/doc/classes/LongDecimalQuot.src/M000025.html +1 -1
  84. data/doc/classes/LongDecimalQuot.src/M000026.html +1 -1
  85. data/doc/classes/LongDecimalQuot.src/M000027.html +1 -1
  86. data/doc/classes/LongDecimalQuot.src/M000028.html +1 -1
  87. data/doc/classes/LongDecimalQuot.src/M000029.html +1 -1
  88. data/doc/classes/LongDecimalQuot.src/M000032.html +1 -1
  89. data/doc/classes/LongDecimalQuot.src/M000033.html +1 -1
  90. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.html +5 -5
  91. data/doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000138.html +22 -0
  92. data/doc/classes/LongMath.html +83 -55
  93. data/doc/classes/LongMath.src/M000113.html +1 -1
  94. data/doc/classes/LongMath.src/M000114.html +1 -1
  95. data/doc/classes/LongMath.src/M000115.html +1 -1
  96. data/doc/classes/LongMath.src/M000116.html +1 -1
  97. data/doc/classes/LongMath.src/M000117.html +1 -1
  98. data/doc/classes/LongMath.src/M000118.html +1 -1
  99. data/doc/classes/LongMath.src/M000119.html +1 -1
  100. data/doc/classes/LongMath.src/M000120.html +1 -1
  101. data/doc/classes/LongMath.src/M000121.html +1 -1
  102. data/doc/classes/LongMath.src/M000122.html +1 -1
  103. data/doc/classes/LongMath.src/M000123.html +1 -1
  104. data/doc/classes/LongMath.src/M000124.html +1 -1
  105. data/doc/classes/LongMath.src/M000125.html +1 -1
  106. data/doc/classes/LongMath.src/M000126.html +1 -1
  107. data/doc/classes/LongMath.src/M000127.html +2 -2
  108. data/doc/classes/LongMath.src/M000128.html +4 -13
  109. data/doc/classes/LongMath.src/M000129.html +4 -82
  110. data/doc/classes/LongMath.src/M000130.html +90 -5
  111. data/doc/classes/LongMath.src/M000131.html +8 -5
  112. data/doc/classes/LongMath.src/M000132.html +5 -15
  113. data/doc/classes/LongMath.src/M000133.html +14 -10
  114. data/doc/classes/LongMath.src/M000134.html +17 -149
  115. data/doc/classes/LongMath.src/M000135.html +206 -6
  116. data/doc/classes/LongMath.src/M000136.html +41 -22
  117. data/doc/classes/LongMath.src/M000137.html +58 -0
  118. data/doc/classes/Numeric.src/M000100.html +1 -1
  119. data/doc/classes/Rational.src/M000101.html +2 -2
  120. data/doc/created.rid +1 -1
  121. data/doc/files/lib/long-decimal_rb.html +188 -0
  122. data/doc/files/lib/long-decimal_rb.src/M000001.html +1 -1
  123. data/doc/files/lib/long-decimal_rb.src/M000002.html +1 -1
  124. data/doc/fr_method_index.html +25 -24
  125. data/lib/long-decimal.rb +156 -40
  126. data/test/testlongdecimal.rb +297 -6
  127. data/version.rb +1 -1
  128. metadata +5 -2
@@ -2,8 +2,8 @@
2
2
  #
3
3
  # testlongdecimal.rb -- runit test for long-decimal.rb
4
4
  #
5
- # CVS-ID: $Header: /var/cvs/long-decimal/long-decimal/test/testlongdecimal.rb,v 1.19 2006/03/27 21:54:46 bk1 Exp $
6
- # CVS-Label: $Name: PRE_ALPHA_0_17 $
5
+ # CVS-ID: $Header: /var/cvs/long-decimal/long-decimal/test/testlongdecimal.rb,v 1.22 2006/03/30 21:06:43 bk1 Exp $
6
+ # CVS-Label: $Name: PRE_ALPHA_0_18 $
7
7
  # Author: $Author: bk1 $ (Karl Brodowsky)
8
8
  #
9
9
 
@@ -18,7 +18,7 @@ load "lib/long-decimal.rb"
18
18
  #
19
19
  class TestLongDecimal_class < RUNIT::TestCase
20
20
 
21
- @RCS_ID='-$Id: testlongdecimal.rb,v 1.19 2006/03/27 21:54:46 bk1 Exp $-'
21
+ @RCS_ID='-$Id: testlongdecimal.rb,v 1.22 2006/03/30 21:06:43 bk1 Exp $-'
22
22
 
23
23
  #
24
24
  # helper method for test_split_merge_words
@@ -132,6 +132,292 @@ class TestLongDecimal_class < RUNIT::TestCase
132
132
  check_exp_floated(-xx, 100)
133
133
  end
134
134
 
135
+ #
136
+ # helper method for test_exp_int
137
+ # tests if exp(x) with precision prec is calculated correctly
138
+ #
139
+ def check_exp_int(x)
140
+
141
+ # make sure x is LongDecimal
142
+ x0 = x
143
+ x = x.to_ld
144
+ y = LongMath.exp(x, 0)
145
+ assert_equal(y.scale, 0, "scale must be 0")
146
+
147
+ # compare y against z = exp(x) calculated using regular floating point arithmetic
148
+ z = Math.exp(x0.to_f)
149
+ yf = y.to_f
150
+ yi = yf.round
151
+ zi = z.round
152
+ assert((yi-zi) / [yf.abs, z.abs, Float::MIN].max < 1e-9, "yi=#{yi} and zi=#{zi} should be equal x=#{x} y=#{y} z=#{z}")
153
+
154
+ if (y > 1)
155
+ w = LongMath.log(y, 0)
156
+ assert((w-x).abs < 1, "log(y)=#{w} must be almost x=#{x0}")
157
+ end
158
+
159
+ end
160
+
161
+ #
162
+ # test the calculation of the exponential function with precision 0
163
+ #
164
+ def test_exp_int
165
+ xx = LongMath.log(10.to_ld, 10)*100
166
+ pi = Math::PI.to_ld(10)
167
+ sq = LongMath.sqrt(5, 20)
168
+
169
+ check_exp_int(0)
170
+
171
+ check_exp_int(700.1)
172
+ check_exp_int(700)
173
+ check_exp_int(100.01)
174
+ check_exp_int(100)
175
+ check_exp_int(1.001)
176
+ check_exp_int(1)
177
+ check_exp_int(0.01)
178
+ check_exp_int(1e-10)
179
+ check_exp_int(1e-90)
180
+ check_exp_int(xx)
181
+ check_exp_int(pi)
182
+ check_exp_int(sq)
183
+
184
+ check_exp_int(-700.1)
185
+ check_exp_int(-700)
186
+ check_exp_int(-100.01)
187
+ check_exp_int(-100)
188
+ check_exp_int(-1.001)
189
+ check_exp_int(-1)
190
+ check_exp_int(-0.01)
191
+ check_exp_int(-1e-10)
192
+ check_exp_int(-1e-90)
193
+ check_exp_int(-xx)
194
+ check_exp_int(-pi)
195
+ check_exp_int(-sq)
196
+
197
+ end
198
+
199
+ #
200
+ # helper method for test_lm_power_xint
201
+ # tests if exp(x) with precision prec is calculated correctly
202
+ #
203
+ def check_power_xint(x, y, prec)
204
+
205
+ xi = x.to_i
206
+ x = x.to_ld()
207
+ y = y.to_ld()
208
+ z = LongMath.power(x, y, prec)
209
+ zz = LongMath.power_internal(x, y, prec)
210
+ assert((zz - z).abs <= z.unit, "power with and without optimizations z=#{z} zz=#{zz} x=#{x} y=#{y}")
211
+ # compare y against z = exp(x) calculated using regular floating point arithmetic
212
+ zz = (xi) ** (y.to_f)
213
+ zf = z.to_f
214
+ assert((zf - zz).abs < [z.unit.to_f, zz.abs / 1e9 ].max, "z=#{z} and zz=#{zz} should be almost equal x=#{x} y=#{y} (zf=#{zf})")
215
+ end
216
+
217
+ #
218
+ # test LongMath.power for bases that can be expressed as integer
219
+ #
220
+ def test_lm_power_xint
221
+
222
+ xx = Math.log(3).to_ld(40)
223
+ pi = Math::PI.to_ld(40)
224
+ sq = Math.sqrt(5).to_ld(40)
225
+
226
+ check_power_xint(2, 700.01, 10)
227
+ check_power_xint(2, 100.001, 10)
228
+ check_power_xint(2, 1.000000001, 10)
229
+ check_power_xint(2, 0.01, 10)
230
+ check_power_xint(2, 1e-10, 10)
231
+ check_power_xint(2, 1e-90, 10)
232
+ check_power_xint(2, 0, 10)
233
+ check_power_xint(2, -1.000000001, 10)
234
+ check_power_xint(2, -100.001, 10)
235
+ check_power_xint(2, -700.01, 10)
236
+ check_power_xint(2, xx, 10)
237
+ check_power_xint(2, pi, 10)
238
+ check_power_xint(2, sq, 10)
239
+
240
+ check_power_xint(10, 308.01, 10)
241
+ check_power_xint(10, 100.001, 10)
242
+ check_power_xint(10, 1.000000001, 10)
243
+ check_power_xint(10, 0.01, 10)
244
+ check_power_xint(10, 1e-10, 10)
245
+ check_power_xint(10, 1e-90, 10)
246
+ check_power_xint(10, 0, 10)
247
+ check_power_xint(10, -1.000000001, 10)
248
+ check_power_xint(10, -100.001, 10)
249
+ check_power_xint(10, -308.01, 10)
250
+ check_power_xint(10, xx, 10)
251
+ check_power_xint(10, pi, 10)
252
+ check_power_xint(10, sq, 10)
253
+
254
+ check_power_xint(2, 700.01, 100)
255
+ check_power_xint(2, 100.001, 100)
256
+ check_power_xint(2, 1.000000001, 100)
257
+ check_power_xint(2, 0.01, 100)
258
+ check_power_xint(2, 1e-10, 100)
259
+ check_power_xint(2, 1e-90, 100)
260
+ check_power_xint(2, 0, 100)
261
+ check_power_xint(2, -1.000000001, 100)
262
+ check_power_xint(2, -100.001, 100)
263
+ check_power_xint(2, -700.01, 100)
264
+ check_power_xint(2, xx, 100)
265
+ check_power_xint(2, pi, 100)
266
+ check_power_xint(2, sq, 100)
267
+
268
+ check_power_xint(10, 308.01, 100)
269
+ check_power_xint(10, 100.001, 100)
270
+ check_power_xint(10, 1.000000001, 100)
271
+ check_power_xint(10, 0.01, 100)
272
+ check_power_xint(10, 1e-10, 100)
273
+ check_power_xint(10, 1e-90, 100)
274
+ check_power_xint(10, 0, 100)
275
+ check_power_xint(10, -1.000000001, 100)
276
+ check_power_xint(10, -100.001, 100)
277
+ check_power_xint(10, -308.01, 100)
278
+ check_power_xint(10, xx, 100)
279
+ check_power_xint(10, pi, 100)
280
+ check_power_xint(10, sq, 100)
281
+
282
+ check_power_xint(2, 700.01, 40)
283
+ check_power_xint(2, 100.001, 40)
284
+ check_power_xint(2, 1.000000001, 40)
285
+ check_power_xint(2, 0.01, 40)
286
+ check_power_xint(2, 1e-10, 40)
287
+ check_power_xint(2, 1e-90, 40)
288
+ check_power_xint(2, 0, 40)
289
+ check_power_xint(2, -1.000000001, 40)
290
+ check_power_xint(2, -100.001, 40)
291
+ check_power_xint(2, -700.01, 40)
292
+ check_power_xint(2, xx, 40)
293
+ check_power_xint(2, pi, 40)
294
+ check_power_xint(2, sq, 40)
295
+
296
+ check_power_xint(10, 308.01, 40)
297
+ check_power_xint(10, 100.001, 40)
298
+ check_power_xint(10, 1.000000001, 40)
299
+ check_power_xint(10, 0.01, 40)
300
+ check_power_xint(10, 1e-10, 40)
301
+ check_power_xint(10, 1e-90, 40)
302
+ check_power_xint(10, 0, 40)
303
+ check_power_xint(10, -1.000000001, 40)
304
+ check_power_xint(10, -100.001, 40)
305
+ check_power_xint(10, -308.01, 40)
306
+ check_power_xint(10, xx, 40)
307
+ check_power_xint(10, pi, 40)
308
+ check_power_xint(10, sq, 40)
309
+
310
+ end
311
+
312
+ #
313
+ # helper method for test_lm_power_yint
314
+ # tests if exp(x) with precision prec is calculated correctly
315
+ #
316
+ def check_power_yint(x, y, prec)
317
+
318
+ yi = y.to_i
319
+ x = x.to_ld
320
+ y = y.to_ld
321
+
322
+ z = LongMath.power(x, y, prec, LongMath::ROUND_HALF_UP)
323
+ zz = (x ** yi).round_to_scale(prec, LongMath::ROUND_HALF_UP)
324
+ assert_equal(z, zz, "power with ** or power-method x=#{x} y=#{y} z=#{z} zz=#{zz}")
325
+ zz = LongMath.power_internal(x, y, prec)
326
+ assert((zz - z).abs <= z.unit, "power with and without optimizations x=#{x} y=#{y} z=#{z} zz=#{zz}")
327
+
328
+ zz = (x.to_f) ** (y.to_f)
329
+ zf = z.to_f
330
+ # assert((zf - zz).abs / [zf.abs, zz.abs, Float::MIN].max < 1e-9, "z=#{zf.to_s} and zz=#{zz.to_s} should be almost equal x=#{x} y=#{y} z=#{z} zz=#{zz}")
331
+ assert((zf - zz).abs < [ z.unit.to_f, zf.abs / 1e9 ].max, "zf=#{zf.to_s} and zz=#{zz.to_s} should be almost equal x=#{x} y=#{y} z=#{z} zz=#{zz}")
332
+ end
333
+
334
+ #
335
+ # test LongMath.power for bases that can be expressed as integer
336
+ #
337
+ def test_lm_power_yint
338
+
339
+ xx = Math.log(3).to_ld(40)
340
+ pi = Math::PI.to_ld(40)
341
+ sq = Math.sqrt(5).to_ld(40)
342
+
343
+ check_power_yint(xx, 400, 10)
344
+ check_power_yint(xx, 100, 10)
345
+ check_power_yint(xx, 1, 10)
346
+ check_power_yint(xx, 0, 10)
347
+ check_power_yint(xx, -1, 10)
348
+ check_power_yint(xx, -100, 10)
349
+ check_power_yint(xx, -400, 10)
350
+
351
+ check_power_yint(pi, 400, 10)
352
+ check_power_yint(pi, 100, 10)
353
+ check_power_yint(pi, 1, 10)
354
+ check_power_yint(pi, 0, 10)
355
+ check_power_yint(pi, -1, 10)
356
+ check_power_yint(pi, -100, 10)
357
+ check_power_yint(pi, -400, 10)
358
+
359
+ check_power_yint(sq, 400, 10)
360
+ check_power_yint(sq, 100, 10)
361
+ check_power_yint(sq, 1, 10)
362
+ check_power_yint(sq, 0, 10)
363
+ check_power_yint(sq, -1, 10)
364
+ check_power_yint(sq, -100, 10)
365
+ check_power_yint(sq, -400, 10)
366
+
367
+ check_power_yint(xx, 400, 100)
368
+ check_power_yint(xx, 100, 100)
369
+ check_power_yint(xx, 1, 100)
370
+ check_power_yint(xx, 0, 100)
371
+ check_power_yint(xx, -1, 100)
372
+ check_power_yint(xx, -100, 100)
373
+ check_power_yint(xx, -400, 100)
374
+
375
+ check_power_yint(pi, 400, 100)
376
+ check_power_yint(pi, 100, 100)
377
+ check_power_yint(pi, 1, 100)
378
+ check_power_yint(pi, 0, 100)
379
+ check_power_yint(pi, -1, 100)
380
+ check_power_yint(pi, -100, 100)
381
+ check_power_yint(pi, -400, 100)
382
+
383
+ check_power_yint(sq, 400, 100)
384
+ check_power_yint(sq, 100, 100)
385
+ check_power_yint(sq, 1, 100)
386
+ check_power_yint(sq, 0, 100)
387
+ check_power_yint(sq, -1, 100)
388
+ check_power_yint(sq, -100, 100)
389
+ check_power_yint(sq, -400, 100)
390
+
391
+ check_power_yint(xx, 400, 40)
392
+ check_power_yint(xx, 100, 40)
393
+ check_power_yint(xx, 1, 40)
394
+ check_power_yint(xx, 0, 40)
395
+ check_power_yint(xx, -1, 40)
396
+ check_power_yint(xx, -100, 40)
397
+ check_power_yint(xx, -400, 40)
398
+
399
+ check_power_yint(pi, 400, 40)
400
+ check_power_yint(pi, 100, 40)
401
+ check_power_yint(pi, 1, 40)
402
+ check_power_yint(pi, 0, 40)
403
+ check_power_yint(pi, -1, 40)
404
+ check_power_yint(pi, -100, 40)
405
+ check_power_yint(pi, -400, 40)
406
+
407
+ check_power_yint(sq, 400, 40)
408
+ check_power_yint(sq, 100, 40)
409
+ check_power_yint(sq, 1, 40)
410
+ check_power_yint(sq, 0, 40)
411
+ check_power_yint(sq, -1, 40)
412
+ check_power_yint(sq, -100, 40)
413
+ check_power_yint(sq, -400, 40)
414
+
415
+ end
416
+
417
+ # TODO test_exp_non_ld
418
+ # test_log_non_ld
419
+ # test_power_non_ld
420
+
135
421
  #
136
422
  # helper method for test_log
137
423
  # tests if log(x) with precision prec is calculated correctly
@@ -306,6 +592,8 @@ class TestLongDecimal_class < RUNIT::TestCase
306
592
  end
307
593
 
308
594
  z = LongMath.power(10.to_ld, y, eprec)
595
+ # zz = LongMath.exp10(y, eprec)
596
+ # assert((zz - z).abs <= z.unit, "zz=#{zz.to_s} and z=#{z.to_s} should be almost equal (y=#{y.to_s} eprec=#{eprec} prec=#{prec})")
309
597
  assert((x - z).abs <= z.unit, "x=#{x.to_s} and z=#{z.to_s} should be almost equal (y=#{y.to_s} eprec=#{eprec} prec=#{prec})")
310
598
  end
311
599
 
@@ -320,7 +608,7 @@ class TestLongDecimal_class < RUNIT::TestCase
320
608
  # make sure x is LongDecimal
321
609
  x0 = x
322
610
  x = x.to_ld
323
- log10x = log10x.to_ld.round_to_scale(prec)
611
+ log10x = log10x.to_ld(prec)
324
612
  # calculate y = log10(x)
325
613
  y = LongMath.log10(x, prec)
326
614
  assert_equal(y, log10x, "log x should match exactly x=#{x} y=#{y} log10x=#{log10x}")
@@ -386,6 +674,8 @@ class TestLongDecimal_class < RUNIT::TestCase
386
674
  end
387
675
 
388
676
  z = LongMath.power(2.to_ld, y, eprec)
677
+ # zz = LongMath.exp2(y, eprec)
678
+ # assert((zz - z).abs <= z.unit, "zz=#{zz.to_s} and z=#{z.to_s} should be almost equal (y=#{y.to_s} eprec=#{eprec} prec=#{prec})")
389
679
  assert((x - z).abs <= z.unit, "x=#{x.to_s} and z=#{z.to_s} should be almost equal (y=#{y.to_s} eprec=#{eprec} prec=#{prec})")
390
680
  end
391
681
 
@@ -400,7 +690,7 @@ class TestLongDecimal_class < RUNIT::TestCase
400
690
  # make sure x is LongDecimal
401
691
  x0 = x
402
692
  x = x.to_ld
403
- log2x = log2x.to_ld.round_to_scale(prec)
693
+ log2x = log2x.to_ld(prec)
404
694
  # calculate y = log2(x)
405
695
  y = LongMath.log2(x, prec)
406
696
  assert_equal(y, log2x, "log x should match exactly x=#{x} y=#{y} log2x=#{log2x} prec=#{prec}")
@@ -2017,7 +2307,7 @@ class TestLongDecimal_class < RUNIT::TestCase
2017
2307
  assert(y0 <= y1, "y0 y1")
2018
2308
  assert(y1 <= y2, "y1 y2")
2019
2309
 
2020
- x = 4.to_ld.round_to_scale(101)
2310
+ x = 4.to_ld(101)
2021
2311
  y0 = check_sqrt(x, 120, LongDecimal::ROUND_DOWN, 0, 0, "four")
2022
2312
  y1 = check_sqrt(x, 120, LongDecimal::ROUND_HALF_EVEN, 0, 0, "four")
2023
2313
  y2 = check_sqrt(x, 120, LongDecimal::ROUND_UP, 0, 0, "four")
@@ -2650,6 +2940,7 @@ class TestLongDecimal_class < RUNIT::TestCase
2650
2940
 
2651
2941
  # TODO
2652
2942
  # def test_to_bd
2943
+ # def test_to_ld_with_parms
2653
2944
 
2654
2945
  #
2655
2946
  # test negation operator (unary -) of LongDecimalQuot
data/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # version.rb -- extract version information from files
5
5
  #
6
6
  # CVS-ID: $Header: /var/cvs/long-decimal/long-decimal/version.rb,v 1.4 2006/03/02 20:33:55 bk1 Exp $
7
- # CVS-Label: $Name: PRE_ALPHA_0_17 $
7
+ # CVS-Label: $Name: PRE_ALPHA_0_18 $
8
8
  # Author: $Author: bk1 $ (Karl Brodowsky)
9
9
  #
10
10
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: long-decimal
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.00.17
7
- date: 2006-03-28 00:00:00 +02:00
6
+ version: 0.00.18
7
+ date: 2006-03-30 00:00:00 +02:00
8
8
  summary: LongDecimal for numbers with fixed point
9
9
  require_paths:
10
10
  - lib
@@ -54,6 +54,7 @@ files:
54
54
  - doc/dot/f_0.png
55
55
  - doc/files/lib
56
56
  - doc/files/lib/long-decimal_rb.src
57
+ - doc/files/lib/long-decimal_rb.html
57
58
  - doc/files/lib/long-decimal_rb.src/M000001.html
58
59
  - doc/files/lib/long-decimal_rb.src/M000002.html
59
60
  - doc/classes/LongDecimal.src
@@ -177,6 +178,7 @@ files:
177
178
  - doc/classes/LongDecimalBase.src/M000112.html
178
179
  - doc/classes/LongMath.src/M000135.html
179
180
  - doc/classes/LongMath.src/M000136.html
181
+ - doc/classes/LongMath.src/M000137.html
180
182
  - doc/classes/LongMath.src/M000112.html
181
183
  - doc/classes/LongMath.src/M000113.html
182
184
  - doc/classes/LongMath.src/M000114.html
@@ -204,6 +206,7 @@ files:
204
206
  - doc/classes/LongDecimalRoundingMode/RoundingModeClass.html
205
207
  - doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000135.html
206
208
  - doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000137.html
209
+ - doc/classes/LongDecimalRoundingMode/RoundingModeClass.src/M000138.html
207
210
  - lib/long-decimal.rb
208
211
  - test/testlongdecimal.rb
209
212
  test_files: