03-21-2003, 12:24 PM
Here is a simple version of a program I made to round numbers:
You can make this a function, and call it to round the numbers, passing through the number and the amount of decimal places you want. This version is limited - if you try rounding to 3 d.p you will see what I mean - I'll post a full version that corrects this problem if anyone is interested 8)
edit: Bannana, are you there? I didn't just kill this forum, did I? (posted 24 march)
Code:
num = 10 - 1.94 ' This doesn't round properly
PRINT num
INPUT "How many dp? ", dp
nr = num * (10 ^ dp)
nr = SGN(nr) * (ABS(INT(nr + .5)))
nr = nr / (10 ^ dp)
PRINT nr
END
You can make this a function, and call it to round the numbers, passing through the number and the amount of decimal places you want. This version is limited - if you try rounding to 3 d.p you will see what I mean - I'll post a full version that corrects this problem if anyone is interested 8)
edit: Bannana, are you there? I didn't just kill this forum, did I? (posted 24 march)