0

In java while add the float number a and b getting wrong output.

Float a = 39.97757f;
Float b = 59.96636f;

System.out.println(a+b);

getting output as 99.943924 instead of 99.94393

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • `Float` (uppercase F) and `float` (lowercase f) are not the same thing. You should not use objects when you only need numbers. (But it has nothing to do with floating point precision.) – VGR Aug 23 '23 at 15:04

0 Answers0