rounding numbers rounding numbers shanley06 (Programmer) (OP) 16 Dec 02 15:02 i was wondering if someone could tell me how to round numbers with decimals to a whole number RE: rounding numbers MiggyD (Programmer) 16 Dec 02 15:14 Look in the help files for INT() function. RE: rounding numbers Great008 (Programmer) 6 Mar 03 01:01 INT() always rounds the number down.If you want it to round as a normal human would round such as 4.5 to 5 instead of what Qbasic would do and round 4.5 to 4 then just add .5a=4.5If you wanted to round like a normal human then you woulda=a+.5PRINT INT(a)Answer is 5Or just round like the computer wouldPRINT INT(a)Answer is 4 RE: rounding numbers qbasicking (Programmer) 6 Mar 03 08:51 a = 4.55IF a > INT(a) + .5 THEN a = INT(a) + 1ELSE a = INT(a)END IFPRINT a RE: rounding numbers Buff1 (Programmer) 6 Mar 03 14:24 Since QB4.5 doesnt have a currency floating point type hereis what I did.DIM Dollar as longDIM Cents as integerDIM Amount as doubleinput amountDollar=AmountCents=(Amount-Dollar)*100print Dollar;".";Centsprint using "##,###.##";Dollar+cents/100this can also be stored in 5 bytes using mkl$ and chr$amt$=msk$(Dollar)+chr$(cents)one Caveat: you need to check for negative cents beforeusing chr$(cents)If Cents<0 then Dollar=Dollar-1:Cents=Cents+100then to get them backDollar=CVL(mid$(amt$,1,4))Cents=asc(mid$(amt$,5,1)) RE: rounding numbers quebasic2 (Programmer) 6 Mar 03 20:43 To round like a human, use the CINT() function. On extremely large numbers, using CINT() will give you an error. That is why most people use the INT() function whenever possible.