Post Reply 
HP 50g: Neighbour Function (Dedekind Cut) Programme Challenge
09-27-2017, 10:43 AM (This post was last modified: 09-27-2017 11:25 AM by Werner.)
Post: #8
RE: HP 50g: Neighbour Function (Dedekind Cut) Programme Challenge
I created this when Joe first mentioned the NEIGHBOR function.
It returns the next number larger than x=s*m*10^n

Basically, if x=0, return 1e-499
elsif s*m=-1, return (s.m + 1e-12)*10^n
else return (s.m + 1e-11)*10^n

Code:
\<<
  IF DUP
  THEN DUP XPON ALOG
  ELSE 1E-488 END
  SWAP OVER /     @ 10^n s*m
  DUP -1 \=/ 6 - 6 - ALOG + *
\>>

If I call this program NXT, then NEIGHBOR as defined in the 71 would be
Code:
\<< IF OVER < THEN +/- NXT +/- ELSE NXT END \>>
Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 50g: Neighbour Function (Dedekind Cut) Programme Challenge - Werner - 09-27-2017 10:43 AM



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