Post Reply 
NEIGHBOR function in RPL
06-05-2015, 09:03 PM
Post: #1
NEIGHBOR function in RPL
The HP-71B Math ROM has a nifty function called NEIGHBOR(X,Y) which returns the nearest machine-representable number to X in the direction towards Y. For example, NEIGHBOR(5,7) returns 5.00000000001, and NEIGHBOR(5,1) returns 4.99999999999.

I'm looking for a User RPL implementation of that function. All my attempts fail when X is a power of 10 and Y<X. For example, NEIGHBOR(1,0) should return 0.999999999999 (twelve 9's), but I'm only getting eleven 9's. It's driving me crazier.

Any and all insights will be greatly appreciated.

BTW, I want to use the NEIGHBOR function in an program to be called "UNROUND", which takes any input J (which contains N digits after the decimal point) and returns the smallest and greatest numbers which round to J when N RND is executed. Example: 0.123 UNROUND should yield 0.1225 and 0.123499999999 because those are the smallest and greatest numbers (respectively) which yield 0.123 when 3 RND is executed. If you already have such a program, I'd love to see that too.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
NEIGHBOR function in RPL - Joe Horn - 06-05-2015 09:03 PM
RE: NEIGHBOR function in RPL - Gerald H - 06-06-2015, 09:17 AM
RE: NEIGHBOR function in RPL - Werner - 06-06-2015, 12:55 PM
RE: NEIGHBOR function in RPL - Gerald H - 06-06-2015, 03:03 PM
RE: NEIGHBOR function in RPL - Werner - 06-06-2015, 03:30 PM
RE: NEIGHBOR function in RPL - Gerald H - 06-06-2015, 03:45 PM
RE: NEIGHBOR function in RPL - Gerald H - 06-06-2015, 03:41 PM
RE: NEIGHBOR function in RPL - Gerald H - 06-06-2015, 03:50 PM



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