H
harryos
hi
I am trying this calculation
double a=2.2;
double b=1.8;
double sum=a+b;
double diff=a-b;
double remainder=a%b;
when I print the values of these, I get
a=2.2
b=1.8
sum=4.0
diff=0.40000000000000013
remainder=0.3999999999999988
In my calculations, I want to use diff as 0.4 instead of
40000000000000013 .Also I would like to get remainder as 0.4 instead
of 0.3999999999999988.
Is there some way to do this using any java api?
thanks
harry.
I am trying this calculation
double a=2.2;
double b=1.8;
double sum=a+b;
double diff=a-b;
double remainder=a%b;
when I print the values of these, I get
a=2.2
b=1.8
sum=4.0
diff=0.40000000000000013
remainder=0.3999999999999988
In my calculations, I want to use diff as 0.4 instead of
40000000000000013 .Also I would like to get remainder as 0.4 instead
of 0.3999999999999988.
Is there some way to do this using any java api?
thanks
harry.