[Glass] '7.3470570000000004E+02' asNumber -> 7.3470570000000004E+00

Martin McClure martin.mcclure at gemtalksystems.com
Fri May 2 15:38:09 PDT 2014


On 05/02/2014 03:18 PM, Mariano Martinez Peck wrote:
> Terrible WTF or I am too tired?  note the +02 and the +00 ...
> 

It's best to avoid putting a $+ in front of a float's exponent. The ANSI
Smalltalk standard says that this is supposed to be illegal. Various
Smalltalks do different things with it.

The results I get:

GemStone/S 64-bit 3.2
	7.3470570000000009E02

VW 7.10
	7.34706

Pharo 3.0 (pre-release)
	7.347057

VA Smalltalk 8.6
	7 (asNumber is defined to answer a SmallInteger in VA)


If I omit the $+, and make the E to be lowercase e instead (ANSI also
only recognizes e, d, and q, not the uppercase varieties), I get:

'7.3470570000000004e02' asNumber

GemStone
	7.3470570000000009E02

VW
	734.706

Pharo
	734.7057000000001

Regards,

-Martin


More information about the Glass mailing list