[squeak-dev] Re: The joys (or not) of floating point numbers

Stéphane Rollandin lecteur at zogotounga.net
Tue Mar 26 11:26:24 UTC 2013


In my image I have:

precision: aNumber

	| pten |

	self isInfinite ifTrue: [^ self].

	pten := 10 raisedTo: aNumber.
	^ (pten * self) rounded / pten asFloat


54.25125260474855 precision: 1 ==> 54.3

What do you think of it Nicolas ? Does it make sense ?

Stef


More information about the Squeak-dev mailing list