Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 problems: 1. rounding 2. color
#11
Here is a simple version of a program I made to round numbers:

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)