Forum Stats

  • 3,757,549 Users
  • 2,251,244 Discussions
  • 7,869,862 Comments

Discussions

issue with java calculator logic

d2d2d899-83af-4cd4-a092-27b20af0d27c
edited May 2, 2019 7:00AM in Java 8 Questions

HI

I am having a piece of code which does a simple division operation on double values . For example

  • 532/21 (25.33)
  • 8,470.56/21  (403.35)

The same can be verified with the sample java calculator downloaded from java tutorials website . I would like to know why there is a change in behaviour as in case 2 it should come as 403.36 instead of 403.55

Regards

Arun

Answers