3
votes
Vote UpVote

Why is the result of RoundTo(87.285, -2) => 87.28 – Stack Overflow

The Wiert Corner – Programmers on all sorts of platforms get this wrong all the time (I admit having done this in bad ways myself too). In short: Don’t expect floating point values in a computer to be represented as decimals. Rob Kennedy wrote a very nice answer on this: The exact value 87.285 is not representable as a floating-point value in Delphi. A page on my Web site shows what that value really is, as Extended, Double, and Single: 87.285 = + 87.28500 00000 00000 00333 06690 73875 46962 12708 95004 27246 09375 87.285 = + 87.28499 99999 99996 58939 48683 51519 10781 86035 15625 87.285 = + 87.28500 ...
Favorite? Off-Topic? jpluimers @ 2011-03-08 11:00

Statistics

Visits: 1083
Votes: 3
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Alister Christie
stukelly
TDelphiHobbyist
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)