David T. Lewis uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.453.mcz==================== Summary ====================
Name: Kernel-nice.453
Author: nice
Time: 28 May 2010, 9:37:49.978 pm
UUID: 5961f8b3-0010-b643-b1d1-56bd1e657937
Ancestors: Kernel-ar.452
After recent vwnc post, don't let LargeInteger ln overflow.
Same for Fraction with LargeInteger.
Also avoid loss of precision due to gradual underflow.
=============== Diff against Kernel-ar.452 ===============
Item was added:
+ ----- Method: Integer>>ln (in category 'mathematical functions') -----
+ ln
+ "This function is defined because super ln might overflow."
+ | res h |
+ self <= 0 ifTrue: [self error: 'ln is only defined for x > 0'].
+ res := super ln.
+ res isFinite ifTrue: [^res].
+ h := self highBit.
+ ^2 ln * h + (self / (1 << h)) asFloat ln!
Item was added:
+ ----- Method: Fraction>>ln (in category 'mathematical functions') -----
+ ln
+ "This function is defined because super ln might overflow.
+ Note that < 1 is tested before converting to float in order to avoid precision loss due to gradual underflow."
+ | res int |
+ self < 1 ifTrue: [^self reciprocal ln negated].
+ self <= 0 ifTrue: [self error: 'ln is only defined for x > 0'].
+ res := super ln.
+ res isFinite ifTrue: [^res].
+ int := self integerPart.
+ ^int ln + (self / int) ln!