The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(41) Round To The Nearest 1/n
04-12-2018, 01:10 PM
Post: #1
(41) Round To The Nearest 1/n
Original Blog Entry: https://edspi31415.blogspot.com/2018/04/...arest.html

The program RNEAR rounds a number x to the nearest 1/n. For example, to round x to the nearest 10th, n = 10. To round to the nearest 16th, n = 16.

Keystrokes: x [ENTER] y [XEQ] [ALPHA] RNEAR [ALPHA]
Code:

01 LBL^T REAR
02 FIX 0
03 STO 01
04 X<>Y
05 STO 02
06 RFC
07 *
08 RND
09 RCL 01
10 /
11 RCL 02
12 INT
13 +
14 FIX 4
15 RTN


Examples:

x = π
n = 10, result: 3.10 (nearest 10th)
n = 1000, result: 3.142 (nearest 1000th)
n = 16, result: 3.125 (nearest 16th)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(41) Round To The Nearest 1/n - Eddie W. Shore - 04-12-2018 01:10 PM
RE: (41) Round To The Nearest 1/n - hth - 04-12-2018, 06:12 PM
RE: (41) Round To The Nearest 1/n - Dieter - 04-12-2018, 06:57 PM



User(s) browsing this thread: 2 Guest(s)