[Newbies] is 0.1 a Float or a ScaledDecimal ?

Bert Freudenberg bert at freudenbergs.de
Wed Feb 20 13:37:31 UTC 2008


On Feb 20, 2008, at 14:21 , cdrick wrote:

>>> To achieve that,
>>
>> ... write it as 0.1s1
>>
> ok, so 0.1 asFraction " (3602879701896397/36028797018963968)" is no  
> problem ;-)

Indeed, because it is correct.

Perhaps #asApproximateFraction is what you are after.

> The problem I have is the intention... I think everybody who
> writes/enters 0.1 means 1/10... and not a flotting point value...

Computers generally do what you tell them, not what you mean. 0.1  
does have a different meaning than 1/10 in computing land. If you  
mean a fraction, write a fraction. If you mean a float, write a  
dotted decimal. Smalltalk even has means to write fractions as  
decimals (0.1s1). So simply choose what you mean and write that in  
the language your computer understands.

- Bert -



More information about the Beginners mailing list