can someone please explain java code to me
I'm not a new bie by any means, but I found a rather perculier java code that execute differently from one line to another.
with double value = 0.349575
double val1 = value * 100;
double val2 = Math.round(val1);
double val3 = val2/100;
this produces 0.35 in val3.
double val3 = Math.round(value * 100)/100;
this produces 0.0 in val3.
can someone please explain what the difference is? as the second one should evaluate in the same order as the first is setup.
Cheers for explanation anyone.