(49G) Integer to Long Real Programme
|
05-21-2015, 08:27 PM
(This post was last modified: 06-15-2017 01:45 PM by Gene.)
Post: #1
|
|||
|
|||
(49G) Integer to Long Real Programme
Some time ago I wrote a programme to convert zints to long reals. Looking at the programme again, I realised it was only good for values < 10^500. Here's the old programme:
OLDPROG :: CK1&Dispatch # FF :: DUPDUP CODE 00025 143174E78FB9760131174143818F858DC7530 DUP BINT13 #< case2drop FPTR2 ^Z2%% BINT12 #- Z10_ SWAP FPTR2 ^PPow# FPTR2 ^ZMod DUPUNROT FPTR2 ^RSUBext FPTR2 ^Z2%% SWAP FPTR2 ^Z2%% %%+ ; ; And here's the new programme good for zints as large as you like. If anyone else has done this please tell me - improvements most welcome. NEWPROG :: CK1&Dispatch # FF :: FPTR2 ^DupZIsNeg? ITE %% -1E0 %%1 SWAP FPTR2 ^ZAbs DUP FPTR2 ^Z>S DUPLEN$ DUP BINT13 #< case2drop :: FPTR2 ^Z2%% %%* ; ROTDROP OVER BINT1 BINT12 SUB$ FPTR2 ^S>Z FPTR2 ^Z>R %MANTISSA %>%% ROT BINT13 BINT16 SUB$ FPTR2 ^S>Z FPTR2 ^Z2%% %% 1E15 %%/ %%+ %%10 ROT #1- FPTR2 ^PPow# %%* %%* ; ; |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(49G) Integer to Long Real Programme - Gerald H - 05-21-2015 08:27 PM
RE: HP 49G: Integer to Long Real Programme - Gerald H - 05-22-2015, 07:20 AM
|
User(s) browsing this thread: 1 Guest(s)