(50G) Large Integer to Base 10 Log Programme
|
05-21-2015, 07:14 AM
(This post was last modified: 06-15-2017 01:40 PM by Gene.)
Post: #1
|
|||
|
|||
(50G) Large Integer to Base 10 Log Programme
For integer input the programme BIGLOG returns the log base 10.
eg For input 60972196495985322369469798850801395302233069288389279166718517378288539199086752537728283958074869553280577116024079093544779755893987405091184995248604552648641110603776440546339839647264111552557603222875101873669396575421583919947812596964270533633515722663098931197911783761324710519769622826678690931698397717528770808943904809201523069336174422259494102545699707141452854771536951614279872959456937618851114056041769640689982233258357640946276893516864539997244407157297692816417139456756647645884487127633870919566186250410033473994566303930900748694810303248723705063260604351404340740328587657908374238115635589712203176718985343198274963140044996857687788606654510309416439143666614561626561903170292034515168450637351147189005554917928090509138364148203538729458116306434784561668463437648145255325638992807528445415350522817463853770772552985910869198336086346705793448944000623177821681114941654632182768056876632111049632391607775751376562788195752629084676115012532176672831536458918920389549244757682931704018959877582875378601750801456211249412028211746260061275763936562264154781686504614662077706856447851834600540973049448117232883761507878155323723967768151799413156968737635265440209414250942595024112911401104501906901321737665793600952875293931544216860453919263167381209577331874973676019328917767533110123932102390728773621925958301215568185790109493253437055430098236673171901316436654090815874414709858623020128844328172198171573831859353822145544709467861053167253147641559353356127933542788755274361792389821224133687682854127504386560001906595796414091539707070781357660847988377597942010101952300996117148758847901353605999982095353866224621522686344058343091513072703175200157752922856174815662295033980304125418288912564841618618783499313558442008516552101961069349877194185958958995787884480177063349806823690222564029124785529300534608293060323430508208475837344277395686432577551120330341994513746000838363840219610433344021155120705343745170392498048026889718726 BIGLOG returns 1999.78513184 BIGLOG :: CK1&Dispatch # FF :: DUP PTR 2F3A3 %1- SWAP FPTR2 ^Z>S DUP ONEONE SUB$ CHR_. >T$ SWAP CDR$ &$ palparse DROP %LOG %+ ; ; |
|||
05-21-2015, 04:24 PM
(This post was last modified: 05-21-2015 09:15 PM by Gerald H.)
Post: #2
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
But this is smaller & faster:
Edit: Do not use this programme, see next posting. :: CK1&Dispatch # FF :: DUP PTR 2F3A3 %1- SWAP FPTR2 ^Z>S BINT1 BINT13 SUB$ FPTR2 ^S>Z FPTR2 ^Z>R %MANTISSA %LOG %+ ; ; |
|||
05-21-2015, 07:01 PM
Post: #3
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Bug due to roundoff error: the program returns 12 for 9999999999999 (that's 13 nines), and similarly its output is 1 too low for any longer string of 9's.
<0|ɸ|0> -Joe- |
|||
05-21-2015, 09:14 PM
Post: #4
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Thanks for the advice - smaller & faster loses to correct.
|
|||
05-23-2015, 04:44 AM
Post: #5
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Oh dear... hate to be a pest, but I found another bug.
Both programs return 12 for an input of 999999999884 (that's nine 9's followed by 884), but the correct answer is 11.99999999994962184... which should round to 11.9999999999, not 12. Notice that the 50g, Prime Home and Prime CAS all correctly get 11.9999999999 for log10(999999999884). If this tiny inaccuracy is admissible, forgive my intrusion. <0|ɸ|0> -Joe- |
|||
05-23-2015, 06:57 AM
Post: #6
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Placing a programme under the spotlight of forum members hopefully finds bugs - thanks Joe for the keen eyes. Are you the only one bothered or interested? I trust the critique from more eyes will produce a finally correct programme - Come on you others!
Meanwhile the amended programme below deals with the immediate error: :: CK1&Dispatch # FF :: DUP PTR 2F3A3 %1- SWAP FPTR2 ^Z>S DUP ONEONE SUB$ CHR_. >T$ SWAP CDR$ &$ palparse DROP 2%>%% %%LN %%10 %%LN %%/ %%+ %%>% ; ; A drastic remedy for a unique(?) error. Better suggestions? Signed: Waiting for the next bug whichever pest may find it. |
|||
05-24-2015, 06:45 PM
Post: #7
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Just for those interested, here a programme taking integer input & returning base ten log as a long real. For the 2,000 digit integer above the programme returned
%% 1.99978513184057E3 PARI answered the same problem with 1999.785131840567325356093351 Name of programme: LONGLOG :: CK1&Dispatch # FF :: DUP Z0_ Z<= caseSIZEERR FPTR2 ^Z>S DUPLEN$ #1- OVER BINT13 1_#1-SUB$ FPTR2 ^S>Z FPTR2 ^Z>R %MANTISSA %>%% ROT BINT13 LAST$ CHR_. >H$ CHR_0 >H$ palparse DROP %>%% %% 1E11 %%/ %%+ %%LN %%10 %%LN %%/ SWAP UNCOERCE%% %%+ ; ; |
|||
05-27-2015, 09:06 PM
Post: #8
|
|||
|
|||
RE: HP 50G: Large Integer to Base 10 Log Programme
Hello Gerald H,
Quote:Are you the only one bothered or interested? Definitly not, but SysRPL is too hard for me. I'm happy to retrace an interesting UserRPL program. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)