Strange math behaviour... could someone explain this ?

Alex Tweedly alex at tweedly.net
Sun Oct 9 06:20:25 EDT 2005


Richard Gaskin wrote:

> Maybe not.  We know, for example, that Excel already accounts for this 
> in its own code, correcting for the critical failure of the 
> microprocessor designers.  Anyone have time to check if RB, VB, and 
> others do too?
>
Python doesn't - though since it's a strongly typed (though dynamically 
typed) language, I wouldn't expect it to- once it decides that a 
variable should be a floating-point, it uses the native type and 
processing for it.

As of Python2.4, the "Decimal" package provides an excellent solution to 
this (and many similar but harder) problems.
See 
http://www.python.org/peps/pep-0327.html#the-problem-with-binary-float 
for the discussion explaining the problems, alternative solutions 
considered and the rationale for the version chosen.

> I just checked HyperCard and it allows the wrong answer (one more 
> reason we can be glad it died with dignity while it could).
>
> Way back when there was a question about date calculations, and we 
> found a similar problem with the Win OS, and a similar message from 
> RunRev about how it's an OS limitation.  But on further investigation 
> we discovered that RB, VB, VBA, and many others had long been 
> correcting for that OS limitation on their own languages.
>
> If we find that other high-level systems follow Excel's lead on this 
> one, perhaps there's an even stronger argument to asking Rev to 
> account for this processor failure (that is, in addition to the answer 
> being wrong).
>
>> Bring BCD , that's what I say .... :-)
>
>
> "BCD"?
>
Binary Coded Decimal.   (I'm showing my age :-)


-- Alex.

-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/123 - Release Date: 06/10/2005




More information about the use-livecode mailing list