[squeak-dev] Decimals as fractions

Stéphane Rollandin lecteur at zogotounga.net
Sun Apr 7 14:37:16 UTC 2019


> 3.41 - 3.40 0.010000000000000231
> vs
> ((341/100) - (340/100)) asFloat 0.01

On my system:

[3.41 - 3.40] bench
	--> '76,200,000 per second. 13.1 nanoseconds per run.'

[((341/100) - (340/100)) asFloat] bench
	--> '1,230,000 per second. 816 nanoseconds per run.'

a := 341/100.
b := 340/100.
[a - b] bench
	--> '4,050,000 per second. 247 nanoseconds per run.'

Stef


More information about the Squeak-dev mailing list