[squeak-dev] The Trunk: KernelTests-nice.208.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Oct 29 13:24:29 UTC 2011
Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.208.mcz
==================== Summary ====================
Name: KernelTests-nice.208
Author: nice
Time: 29 October 2011, 3:24:06.652 pm
UUID: 98713787-6ba4-424d-b622-0c1f459ac49c
Ancestors: KernelTests-nice.207
There might be a best inexact square root approximation than infinity to some LargePositiveInteger in the range (1<<54-1<<970 to: 1<<54-1<<1994)
=============== Diff against KernelTests-nice.207 ===============
Item was added:
+ ----- Method: IntegerTest>>testBigReceiverInexactSqrt (in category 'tests - mathematical functions') -----
+ testBigReceiverInexactSqrt
+ "
+ IntegerTest new testBigReceiverInexactSqrt
+ "
+
+ "Inexact 3rd root (not a whole cube number), so a Float must be answered.
+ However, receiver is too big for Float arithmethic."
+ | bigNum result |
+ bigNum := 100 factorial squared + 1. "Add 1 so it is not a whole square"
+ self assert: bigNum asFloat isInfinite. "Otherwise, we chose a bad sample"
+ result := bigNum sqrt.
+ self assert: result class == Float.
+ self deny: result isInfinite.
+ self assert: result = 100 factorial asFloat. "No other float is closer. See following lines"
+ self assert: (result successor asFraction squared - bigNum) abs >= (result asFraction squared - bigNum) abs.
+ self assert: (result predecessor asFraction squared - bigNum) abs >= (result asFraction squared - bigNum) abs.!
More information about the Squeak-dev
mailing list
|