[squeakdev] The Trunk: KernelTestsnice.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/KernelTestsnice.208.mcz
==================== Summary ====================
Name: KernelTestsnice.208
Author: nice
Time: 29 October 2011, 3:24:06.652 pm
UUID: 987137876ba4424db6220c1f459ac49c
Ancestors: KernelTestsnice.207
There might be a best inexact square root approximation than infinity to some LargePositiveInteger in the range (1<<541<<970 to: 1<<541<<1994)
=============== Diff against KernelTestsnice.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 Squeakdev
mailing list
