rounding a number...

 BBS: Inland Empire Archive
Date: 02-05-93 (08:54)             Number: 360
From: DAVID COLSTON                Refer#: NONE
  To: CHRIS TRACY                   Recvd: NO  
Subj: rounding a number...           Conf: (2) Quik_Bas
CT>Does anyone know if there is a routine to actually round
CT>a number for real t
CT>certain decimal place? like 3.1415 (hehe) would become
CT>3.142? or something l
CT>that.... or have it round up or down... etc... you get the picture.. i know
CT>just kills all the number after it, but thats not really what i was looking

CT>-Night Crawler

There are several kinds of rounds. INT(X!) gives a truncated round. i.e.
INT(1.9) = 1
CINT rounds up
CINT(1.9) = 2
To use either round on a single or double precision number to X% places:
A! = CINT(A& * 10 * X%)/(10 * X%)

 * OLX 2.1 TD * C:\DOS\RUN       RUN\DOS\RUN

--- WM v2.06/92-0178
 * Origin: Paradox of Arkansas *Wildcat 3.0* 501-646-7158 (1:3822/1)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET