Float numbers are inexact and always been. Maybe you meant that they are more inexact than you expected? :) FloatArray stores floats using 32-bit floating point precision format. While Float(s) using 64 bits. No surprise that values stored in FloatArray are less precise. On 28 July 2011 08:34, Martin Dias <tinchodias@gmail.com> wrote:
If forgot to specify that I run this on Pharo 1.3 build #226 in Windows with :
Smalltalk vmVersion ----> 'Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.56]'
Martin
On Thu, Jul 28, 2011 at 3:30 AM, Martin Dias <tinchodias@gmail.com> wrote:
Hi
I found that FloatArray>>at:put: is inaccurate:
| floats | floats := FloatArray new: 1. floats at: 1 put: 11.22321. floats at: 1 " ------------> 11.223210334777832 "
Do you know this issue?
This is the implementation of at:put::
at: index put: value    <primitive: 'primitiveAtPut' module: 'FloatArrayPlugin'>    value isFloat       ifTrue:[self basicAt: index put: value asIEEE32BitWord]       ifFalse:[self at: index put: value asFloat].    ^value
Thanks in advance Martin
-- Best regards, Igor Stasenko AKA sig.