rounding a number...

 BBS: Inland Empire Archive
Date: 02-05-93 (18:46)             Number: 362
From: FRANCOIS ROY                 Refer#: NONE
  To: CHRIS TRACY                   Recvd: NO  
Subj: rounding a number...           Conf: (2) Quik_Bas
One way to round a number might be:

MyNumber# = 3.14159
Decimals% = 3

Factor# = 10 ^ Decimals%
RoundedNumber# = INT(Factor# * MyNumber# + 0.5) / Factor#

--- msgedsq 2.1
 * Origin: R&D BBS 'The VAX Heaven' {819/772-9277} 9600 HST/V32 (1:163/506)
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