-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I came upon an alogrithm years ago somewhere that showed how to programmatically round 
numbers. Here
it is:

// num is the number we want to round. it may be int or fp.
// what is what we want to round num to (ie nearest 10, 1/100, etc)
// The rounding algorithm is:
//      1) Divide num by what (the base we want to round to. ie .01 for hundredths, 10 
for tens)
//      2) Add .5 to num
//      3) Truncate the result (keep the integer part)
//      4) Multiply the result by num

- --
/* All outgoing email scanned by AVG Antivirus */
Amer Neely, Softouch Information Services
Home of Spam Catcher & North Bay Information Technology Networking Group
W: www.softouch.on.ca
E: [EMAIL PROTECTED]
Perl | PHP | MySQL | CGI programming for all data entry forms.
"We make web sites work!"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (MingW32)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAkF+Aq4ACgkQ3RxspxLYVsXSMgCfRrMiiV6pmSxr3FqUPQcM3q+i
ZqoAn3fgt75oz1C+vmL/G7kanC0ZNrfH
=zQHq
-----END PGP SIGNATURE-----

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to