Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 21909, DecimalRounding (JH1)

by John Herbster Email: Anonymous

Routines For Rounding IEEE-754 Floats (i.e. single, double, and extended) To Specified Number Of Decimal Fractions (code revised 2005-06-15)
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 2.0  to 7.0 3045 downloads
Copyright: No significant restrictions

Size: 4,553 bytes
Updated on Mon, 24 Jul 2006 06:43:50 GMT
Originally uploaded on Tue, 29 Jun 2004 15:05:38 GMT
SHA1 Hash: 8B0C017D8F5CEF925BC447A91D8289285445C4F0
MD5 Hash: 94B276A6EE0F27879CA3922445DD8DF5

    Explore the files in this upload

These routines round input values to fit as closely as possible to an output number with desired number of decimal fraction digits.

Because, in general, numbers with decimal fractions cannot be exactly represented in IEEE-754 floating binary point variables, error limits are used to determine if the input numbers are intended to represent an exact decimal fraction rather than a nearby value. Thus an error limit will be taken into account when deciding that a number input such as 1.295, which internally is represented 1.29499 99999 …, really should be considered exactly 1.295 and that 0.29999 99999 ... really should be interpreted as 0.3 when applying rounding rules.

Nine rounding rules are implemented.

This (JH1) version should be a drop-in fix for DecimalRounding_JH0, which would fail with certain types of rounding which produced more than 9 decimal digits.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03