Re: Strange problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

Irv Mullins wrote:

>On Sat, 18 Mar 2000,
>> Everett Williams wrote:
>>
>> In one sense, this appears to be an Euphoria error, in the sense that the
>> float nature of the constant is not being maintained( if I am correct) when
>> it is assigned to an atom in the function. In another sense, it just points
>> out a contradiction that the use of floats causes in Euphoria. Decimal
>> arithmetic does not have to use floats. Floats are sometimes faster and
>> more efficient, but they almost always lose significance as compared to
>> direct decimal calculations according to the rules of arithmetic. I would
>> bet that if you called att an object that the problem would go away.
>
>How much were you betting?
>A lot, I hope, as I always wanted to be independently wealthy. :)
>
Momentary mental hiccup. It looks like a bet one "I told you so" and lost
it, but I got it right back. You are eminently correct, but as was noted in
later posts, the main culprit is the binary nature of our floats. Round pegs,
square holes. I still don't have an answer to my question about the
creation of floats. If I can remember some 20 year old conversations on
this subject, their are some points where decimals convert exactly to binary
float. This "could" throw off rounding routines using the old add .5 trick.
What is even more interesting is that your print routines are a reconversion
of that same binary float that may or may not suffer from rounding
problems of it's own. Without access to the actual code that does the
various conversions, or at least the mathematical algorithm for that code, it
will be damn difficult to determine. That is why this casual internal "float"
between decimal and binary formats makes Euphoria a disaster for any
kind of high resolution math and in some cases for much lower resolutions.
Of course the problem isn't limited to Euphoria. People who care about
such things use libraries of decimal integer math routines that never
convert to non-integer binary formats. The old IBM mainframes had the
packed decimal instructions that COBOL used extensively. I know of
no modern equivalent of that instruction set outside of those mainframes.
Rounding routines can have a sufficiently ugly effect on arithmetically
correct routines without the extra complication of the conversions.

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu