Post Reply 
HP 50G: Long Reals Run Faster than Reals?
08-15-2015, 04:35 PM (This post was last modified: 08-15-2015 04:36 PM by Gerald H.)
Post: #1
HP 50G: Long Reals Run Faster than Reals?
Below are two programmes to find the number of prime integers up to the input limit.

The programme using long reals requires less time than the one with reals.

Why?

Code:

::
  CK1&Dispatch
  BINT1
  ::
    DUP
    %LN
    DUPUNROT
    %/
    DUPUNROT
    OVER
    %IP
    %3
    %-
    COERCE
    ONE_DO
    INDEX@
    UNCOERCE
    %*
    OVER
    %/
    ROTOVER
    %+
    3UNROLL
    LOOP
    2DROP
  ;
;

::
  CK1&Dispatch
  BINT1
  ::
    %>%%
    DUP
    %%LN
    DUPUNROT
    %%/
    DUPUNROT
    OVER
    %%INT
    %%3
    %%-
    %%>%
    COERCE
    ONE_DO
    INDEX@
    UNCOERCE%%
    %%*
    OVER
    %%/
    ROTOVER
    %%+
    3UNROLL
    LOOP
    2DROP
    %%>%
  ;
;
Find all posts by this user
Quote this message in a reply
08-15-2015, 10:01 PM
Post: #2
RE: HP 50G: Long Reals Run Faster than Reals?
I've had similar results in the past. Don't know for sure, but I suspect that the short real math is actually implemented with long real operations. So the extra time would be a result of the extra conversions taking place behind the scenes. Shouldn't be too hard to confirm with Nosy, but I'm not able to verify at the moment.
Find all posts by this user
Quote this message in a reply
08-16-2015, 05:37 AM (This post was last modified: 08-16-2015 05:43 AM by Gerald H.)
Post: #3
RE: HP 50G: Long Reals Run Faster than Reals?
Thanks for your suggestion, Dave.

I have compared times for %%+ & %+, %%/ & %/, %%- & %- with the result that the individual real operations are faster for some input values, slower for others, than the individual long real operations. ( Loop from 1 to 1000, just the one command in the loop.)

My timings for the long real programme above were c 3% lower than for reals & on the 49G (1.19-6 & 2.10-7) more like 10% lower.
Find all posts by this user
Quote this message in a reply
08-21-2015, 08:15 PM
Post: #4
RE: HP 50G: Long Reals Run Faster than Reals?
DavidM is correct. Even before the HP48 series (I know as far back as the HP42S), real-number operations were always done after promotion to extended reals. The internal algorithms were/are all done in extended real format and "packed" upon completion. Thus, even a pure SysRPL program that uses regular reals as opposed to extended reals will eventually accumulate enough conversion overhead that it becomes significantly noticeable.

You can check for yourself by simply decompiling one of the SysRPL words that deal with real-number operations using Jazz or the built-in disassembler.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




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