CodeBase - Rounding Function
Return to the CodeBase listing
Category: Core
Version: 1.0
Information
Uploaded: 16th Nov 2006 11:55
Modified: 16th Nov 2006 11:58
Author: Anonymous Coder
Summary
Function for cleaning up float decimals
Full Description
This function returns a string from a decimal number, allowing float type decimals to be rounded off to any place. To use, type num$ = Round(number, places) the number can be anything, a decimal, a whole number, or even negative. The places can also be positive or negative, but cannot contain a decimal place. Positive numbers cause a decimal place rounding, such as round(1.2345,3) would return a string "1.235" Using a negative number allows rounding to the tens, hundreds, thousands, etc. ie round(12345,-3) returns "12000" The code is a bit long, I haven't gone through and tried to streamline it, but it does the job for returning cleaner numbers for display.
Comments
No comments yet.