HP 50G: Long Reals Run Faster than Reals? - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: General Forum ( /forum-4.html)+--- Thread: HP 50G: Long Reals Run Faster than Reals? ( /thread-4526.html) |

HP 50G: Long Reals Run Faster than Reals? - Gerald H - 08-15-2015 04:35 PM
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:
RE: HP 50G: Long Reals Run Faster than Reals? - DavidM - 08-15-2015 10:01 PM
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. RE: HP 50G: Long Reals Run Faster than Reals? - Gerald H - 08-16-2015 05:37 AM
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. RE: HP 50G: Long Reals Run Faster than Reals? - Han - 08-21-2015 08:15 PM
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. |