Roundup

See all articles from CATS v3 n7
Author(s): Terry Hardenbergh
Publication: CATS Newsletter
Pub Details: CATS v3 n7 (Volume 3, Issue 7)
Date: October 1985
Pages: 14

ROUNDUP……………FROM TERRY
[address omitted]
[phone number omitted]

   1 PRINT "   ENTER YOUR DECIMAL NUMBER"
2 LET D=100
3 INPUT N$
4 LET M$=STR$ (INT (VAL N$*D+.5)/D)
5 PRINT N$,M$
6 GOTO 3
7 REM

TO CHANGE NUMBER OF DECIMAL PLACES ADJUST VALUE VARIABLE D

The KEY LINE is line 4 … for most internal program use it should be written:

LET N$=STR$(INT(VAL N$*100+.5)/100)

This provides two decimal places as in dollars and cents, rounds the last penny up corectly and only uses up one program line. It should ALWAYS be used when any monetary figures are DEVIDED within your program as this is the place you will get an endless decimal answer that messes up your nice printout format!

Terry Hardenbergh

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.