That Linux Squeak 2.3 float error again

Jarvis, Robert P. Jarvisb at timken.com
Thu Feb 18 19:24:52 UTC 1999


This situation arises because the implementation of Float>>raisedTo: uses
logarithms to calculate the result.  On the Windows platform it turns out
that the Microsoft C++ runtime lib gives back some unusual results for
exp(log(0.0)), and I believe the folks at Squeak Central are working on
this.  In the short term I think the following change to Float>>raisedTo:
should take care of things until a real fix is developed:

raisedTo: aNumber
	"Answer the receiver raised to aNumber."

	0.0 = aNumber ifTrue: [^ 1.0].
	self = 0.0 ifTrue: [ ^self ].		"*** add this line ***"
	^ (self ln * aNumber asFloat) exp

You can also probably do something similar with Number>>raisedTo:,
Number>>raisedToInteger:, and Fraction>>raisedToInteger:.  I hope this
helps.

Bob Jarvis
The Timken Company

> -----Original Message-----
> From:	Richard L. Peskin [SMTP:rlpcon at vermontel.net]
> Sent:	Thursday, February 18, 1999 9:05 AM
> To:	squeak at cs.uiuc.edu
> Subject:	That Linux Squeak 2.3 float error again
> 
> Has anyone verified the float error in Squeak 2.3 Linux, that is the
> error:
> 0.0 raisedTo: 0.75 ==> NaN     ?
> 
> I am trying to see if it is my system or a primitive error.
> 
> thanks,
> --dick peskin
> 
> 
> =================================
> R. L. Peskin,  Rutgers Univ. ; <peskin at caip.rutgers.edu>;
> <http://www.caip.rutgers.edu/~peskin>
> VT Phone (802) 824-4558  NJ Phone (732) 445-4208
> "The corporate culture is concerned less with Occam's razor than his
> aftershave lotion."





More information about the Squeak-dev mailing list