[squeak-dev] Float parsed as a Fraction bug

J. Vuletich (mail lists) juanlists at jvuletich.org
Thu Aug 7 19:03:59 UTC 2014


  Hi Eliot,

Quoting Eliot Miranda <eliot.miranda at gmail.com>:

> Hi Juan,
>
>     On Thu, Aug 7, 2014 at 9:40 AM, J. Vuletich (mail lists)
> <juanlists at jvuletich.org> wrote:
>
>> Hi Folks,
>>
>> Just tried Smalltalk-80 (actually Apple Smalltalk-80 running in Mini
>> vMac).
>> 1e-3 "printIt" (1/1000)
>> 1e-3 class "printIt" Fraction
>> 1e3 "printIt" 1000
>> 1e3 class "printIt" SmallInteger
>>
>> This has always been the behavior in Squeak too.
>
>       
>      What happens if you try compiling a method containing a literal
> Fraction and both debug it and decompile it. 
>

The attach shows that in ST-80 a CompiledMethod can contain a Fraction  
literal. Source code form for that is '1e-3'. Debugger works as in  
Squeak or Cuis.


>> Also check these comments from Dan:
>>
http://lists.squeakfoundation.org/pipermail/squeak-dev/2000-March/013368.html
>
>       
>      Dan doesn't say anything about Fraction literals in this message.

He does talk about scientific notation '1e3' and '1e-3' meaning not  
Float, but SmallInteger and Fraction. The subject of this thread is  
"Float parsed as Fraction bug".     

>> I don't think this is a bug at all.
>
>       
>      What, that 1e-3 is a Fraction, not a Float?
       
Yes. That, and allowing for Fraction literals in methods.


>> BTW, Cuis also supports 1r111111111111 = 12 after this :)

Cheers,
Juan Vuletich

-------------- next part --------------
A non-text attachment was scrubbed...
Name: St80FractionLiteral.PNG
Type: image/png
Size: 23321 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140807/c5bd308a/St80FractionLiteral.png


More information about the Squeak-dev mailing list