As in most other programming languages float 
and double are implemented in way that numbers 
are not represented exactly. That's caused by 
the internal format which is used to store
floats and doubles.

If you want know more of the basics have a look at
http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf

If you want more accuracy you can use
java.math.BigDecimal.

> -----Ursprüngliche Nachricht-----
> Von: Laurent Michenaud [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 14. November 2001 16:39
> An: [EMAIL PROTECTED]
> Betreff: Java and double
> 
> 
> Hi,
> 
> Excuse me... this mail shouldnot be on this mailing list but
> it is an hurry.
> 
> public class TestDouble
> {
>   static public void main(String args[]) {
> 
>         double val = 0.5055 * 1000 ;
>         System.out.println( val );
>   }
> }
> 
> This program gives me the following results :
> 505.49999999999994
> 
> I've tried with Sun Jdk 1.2.2rev9, Sun jdk1.3.1 and Ibm Jdk 1.3.1.
> 
> Have u got informations about this ?
> Can u try too ?
> 
> Thanks a lot and sorry again
> 
> Bye
> 
> Michenaud Laurent
> - Adeuza -
> [ Développeur Web - Administrateur Réseau ]
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 
> 
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to