Skip to main content
Also address the images of code;
Source Link
Henry Ecker Mod
  • 35.5k
  • 4
  • 59
  • 89

I disagree with the closure reason of needs debugging details. You haveThere are two complete programs (formatted using appropriate markdown) which are complete and can easily be run to reproduce the behaviour you are unclear aboutdescribed. One value rounds up to 3 and the other rounds down to 2, which doesn't quite follow the human understanding of numbers (2.4999999999999999999 < 2.5 so it should round down).

While it is true that there are also images of code and output (which are unnecessary and discouraged), that does not change the fact that the minimal necessary information is contained within the question in a useful format (appropriately formatted text).

Having said this, however, I do believe the other close vote which proposed a duplicate of Is floating-point math broken? was likely correct as it explains the underlying cause.

There are many other examples on Stack Overflow. Here is one that may be more relevant (in python): Why round(1.4999999999999999) = 2?

I disagree with the closure reason of needs debugging details. You have two complete programs which reproduce the behaviour you are unclear about. One rounds up to 3 and the other rounds down to 2, which doesn't quite follow the human understanding of numbers (2.4999999999999999999 < 2.5 so it should round down).

Having said this, however, I do believe the other close vote which proposed a duplicate of Is floating-point math broken? was likely correct as it explains the underlying cause.

There are many other examples on Stack Overflow. Here is one that may be more relevant (in python): Why round(1.4999999999999999) = 2?

I disagree with the closure reason of needs debugging details. There are two complete programs (formatted using appropriate markdown) which are complete and can easily be run to reproduce the behaviour described. One value rounds up to 3 and the other rounds down to 2, which doesn't quite follow the human understanding of numbers (2.4999999999999999999 < 2.5 so it should round down).

While it is true that there are also images of code and output (which are unnecessary and discouraged), that does not change the fact that the minimal necessary information is contained within the question in a useful format (appropriately formatted text).

Having said this, however, I do believe the other close vote which proposed a duplicate of Is floating-point math broken? was likely correct as it explains the underlying cause.

There are many other examples on Stack Overflow. Here is one that may be more relevant (in python): Why round(1.4999999999999999) = 2?

Source Link
Henry Ecker Mod
  • 35.5k
  • 4
  • 59
  • 89

I disagree with the closure reason of needs debugging details. You have two complete programs which reproduce the behaviour you are unclear about. One rounds up to 3 and the other rounds down to 2, which doesn't quite follow the human understanding of numbers (2.4999999999999999999 < 2.5 so it should round down).

Having said this, however, I do believe the other close vote which proposed a duplicate of Is floating-point math broken? was likely correct as it explains the underlying cause.

There are many other examples on Stack Overflow. Here is one that may be more relevant (in python): Why round(1.4999999999999999) = 2?