(38G) Neighbour Function (Dedekind Cut) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (38G) Neighbour Function (Dedekind Cut) (/thread-9180.html) |
(38G) Neighbour Function (Dedekind Cut) - Gerald H - 09-28-2017 10:11 AM The three programmes below together perform the Neighbour function & Dedekind cut. For the development of the programmes please see: http://www.hpmuseum.org/forum/thread-9170.html The Neighbour function for a real number N finds the nearest number to N that the calculator can represent. The Dedekind cut returns for real input N the upper & lower nearest numbers to N that the calculator can represent. The first programme accepts a real number input on the Home screen & returns the upper nearest number in Ans. NXTUP Code: Ans►N: The next programme accepts a complex number as input on the Home screen, say (x,P) where you require the neighbour of x & P is either 1 or -1, 1 indicating the upper neighbour & -1 the lower, & returns the result in Ans. NEIGHBOR Code: Ans►Z0: Finally for real number input in the Home screen the programme DCUT returns a complex number in Ans, the real part being the upper & the imaginary part the lower neighbour. DCUT Code: Ans►D: |