> Hi,
>
> Could you tell me why this :
>
> public class A {
> public static void main (String[] args) {
> double d1 = 1.4;
> double d2 = 1.1;
> double res = d1-d2;
> Double RES = new Double(res);
>
> System.out.println("double >> " + res);
> System.out.println("DOUBLE >> " + RES);
> }
> }
>
> Display this result :
> double >> 0.2999999999999998
> DOUBLE >> 0.2999999999999998
>
> instead of 0.3
I suspect a major bug in your CPU...
or maybe in java core...
or maybe it's just the computers are stupid
and don't know how to subtract...

)))))))))
Seriously:
There's no way of having 0.3 (3/10) in binary system
(just like you can't have 1/3 in decimal system: 0.333333....)
Your result is an approximation, like most (all?) of floating-point
operations.
Adam