HP-71 Reals Faster Than Integers
|
07-01-2024, 09:50 AM
(This post was last modified: 07-01-2024 09:51 AM by toml_12953.)
Post: #1
|
|||
|
|||
HP-71 Reals Faster Than Integers
On some computers, using integers not only saves space but calculations are done faster. On the HP-71B, integers do save space but are slower than reals. In the N-Queens program (below) I commented out lines 10 and 30 and the runtime dropped from 2:57 to 2:35
Code: 5 T0=TIME Tom L Cui bono? |
|||
07-01-2024, 10:21 AM
Post: #2
|
|||
|
|||
RE: HP-71 Reals Faster Than Integers
This could have something to do with the fact that the registers of the Saturn CPU are optimised for the storage and manipulation of floating point numbers.
Current daily drivers: HP-41CL, HP-15C, HP-16C |
|||
07-03-2024, 03:46 AM
(This post was last modified: 07-03-2024 03:49 AM by brouhaha.)
Post: #3
|
|||
|
|||
RE: HP-71 Reals Faster Than Integers
I haven't checked, but it's possible that all the calculations are done in floating point, and then converted to integers for storage. Float to int could perhaps be a bit slow, though int to float should be fast. But still, it's extra conversions.
The Saturn processor architecture is definitely designed to perform _reasonably_ efficient floating point, but nevertheless, it can perform arithmetic on binary integers of up to 64 bits MUCH faster than floating point. It can do a 64-bit integer (either bniary or BCD) addition or subtraction in about 30 microseconds in the 71B I haven't timed it, but floating point calculations take hundreds of instructions, so probably at least 100x slow than the 64-bit integer operatinos. That's the raw processor capability, which is why I think the user-level slowness with integers is a result of software architecture decisions, not that the CPU is faster at floating point, since it clearly isn't. |
|||
07-03-2024, 04:49 AM
Post: #4
|
|||
|
|||
RE: HP-71 Reals Faster Than Integers
I agree, my immediate suspicion was that computations were being done in floating point regardless.
The Saturn is actually pretty good with integers up to 64 bits in length. They are much faster than floating point equivalents despite the apparent optimisations for floating point arithmetic. |
|||
07-03-2024, 07:24 AM
Post: #5
|
|||
|
|||
RE: HP-71 Reals Faster Than Integers
(07-03-2024 03:46 AM)brouhaha Wrote: I haven't checked, but it's possible that all the calculations are done in floating point, and then converted to integers for storage. Float to int could perhaps be a bit slow, though int to float should be fast. But still, it's extra conversions. Yes, that's exactly the reason. All calculations on the HP-71 internal "Math Stack" (in RPN form) are done on floating point numbers. The HP-75, as I indicated several times, has a clever "fast integer processing" feature. When a REAL-type variable holds a integer value, then the calculations are done by integer routines, about 2x faster. Still, even on the HP-75, INTEGER- and SHORT-type variables are slower and must be used only to save RAM or disc space. J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)