× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Tue, Mar 19, 2013 at 9:08 PM, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
But he's not dealing with floats, remember this is and has always been
business system. So there's another option besides integer and floats.
Namely, fixed decimal. In which case we do have an exact 0.2
and consequently an exact 3 * 0.2.

Of course there's fixed decimal. I didn't say you couldn't use fixed
decimal. But the OP may or may not be using fixed decimal. The
language may or may not use floats for intermediate calculations. And
even though fixed decimal won't be unintuitive the way floats are,
they still can't represent everything exactly.

As long as you manipulate the decimal values within the
system's precision and scale you will always have exact answers.

Well, there is no precision or scale in base 2 or base 10 which can
exactly represent one third. And as mentioned, intermediate
calculations are not always under our control.

My whole point was, it's important to know exactly what algorithm is
being used to define what a correct result is, and what data types are
being used (standard floats, binary coded decimal, arbitrary-precision
decimal, etc.). If the *reference algorithm* relies on
double-precision float behavior (for example), then a carefully
crafted, arbitrary-precision decimal solution may well be wrong, as
far as the business rules are concerned.

John

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.