Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bug in Round()?

Status
Not open for further replies.

jemminger

Programmer
Jun 25, 2001
3,453
US
is there a reason why

Round(10.25, 1)

results in 10.2 instead of 10.3???
=========================================================
while (!succeed) try();
-jeff
 
Yes, as far as I know, there's a bug in Round method that leads to round bad the "5" digit to the inferior rather than superior. Water is not bad as long as it stays out human body ;-)
 
ok, i found some documentation that this is actually correct behavior according to the IEEE 754 standard for binary floating-point arithmetic...


standard or not, it's still wrong, or else every math teacher on the planet is teaching garbage when they say to round UP >=5, round DOWN < 5!!

here's a rounding lesson:
=========================================================
while (!succeed) try();
-jeff
 
After the war in Irak between Saddam and W, will we soon see a war on the net between programers and math teachers ???
[pc2][cannon][smarty]

LOL Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top