|
|
Round floating point numbers off to nearest ten
Added on 11/8/2005
|
Compatibilities:
|
This item has not yet been rated
|
Round off floating point numbers to the nearest ten. Does not work with integers
on roundOff num
tempFP = the floatPrecision
numString = string(num)
--put "original number:"&&numString
repeat with i = 0 to tempFP
tot = numString.char.count
--put "deleting char:"&&numString.char[tot]
delete char tot of numString
end repeat
tot = numString.char.count
dependent = numString.char[tot]
--put "dependent is:"&&dependent
dependent = integer(dependent)
if dependent>=5 then
dif = 10-dependent
myNum = integer(numString)+dif
else
myNum = integer(numString)-dependent
end if
return myNum
end
|
|