[squeak-dev] FloatArray gives unexpected results with float numbers.

James Foster Smalltalk at JGFoster.net
Sun Dec 21 02:27:47 UTC 2008


On Dec 20, 2008, at 5:54 PM, Nikolay Suslov wrote:

> Hello,
>
> It is a bug.. or?

No.

> FloatArray newFrom: {0.938611557944869}.
> Expecting result is the entered float number, but evaluating gives -  
> a FloatArray(0.938611567020416).

The comment in the #'newFrom:' methods reads as follows: "Answer an  
instance of me containing the same elements as aCollection." What the  
above does is take a float, add it to an Array, then create a  
FloatArray and add to it each element in the Array.

If you want just the float number, you already have it:

0.938611557944869 class == Float

James Foster

> Nikolay



More information about the Squeak-dev mailing list