You will see this behavior in *any* implementation of *floating-point*
math.  By its very definition, operations in floating point imply a loss
of precision.

There are *lots* of websites that discuss the implications of this.
Some preliminary reading:

    http://www.linuxsupportline.com/~billm/floating-point.html
    http://www.validgh.com/goldberg/paper.pdf
    http://www.math.grin.edu/~stone/courses/fundamentals/IEEE-reals.html

Particularly the second link, "What every computer scientist should know
about floating point".

                        -=- D. J.

Sylvain Roche wrote:
> This may be a bit off topic, but I think it might concern any java
> developper.
>
> I'm using Blackdown's 1.2.2 JDK, but I remember having the same trouble in
> the past with others jdk too. I must be misdoing something :
> take two floats and multiply them : it works in most cases. Most cases ?
> for example
> (float)0.05 * (float)2179 = 108.950005 instead of 108.95
>
> in some cases, an operation like x / ( 1/y) works. In some others (including
> this one) it doesn't.
>
> The margin error is always less than 0.00001.
>
> Is it a cast problem, or is it worse. (By the way, the same thing happens
> also in javascript both in IE and Netscape).
http://www.math.grin.edu/~stone/courses/fundamentals/IEEE-reals.html
http://www.linuxsupportline.com/~billm/floating-point.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to