Detecting an emulator's number representation
|
11-18-2019, 10:51 AM
Post: #1
|
|||
|
|||
Detecting an emulator's number representation
Aside from the question of how many bits or bytes are used, an emulator can either use binary or decimal internally. I'm thinking the kinds of inaccuracies of the two systems will differ, so there might be some simple calculation which shows whether binary or decimal is in use.
For example, and where I first noticed this, 800/81 has a pleasing form on a decimal machine such as the 15C: 800 ENTER 81 / 9.876543210 Whereas a workalike emulator which uses (binary) floats internally returns 9.876543209 I see the same two results respectively on an HP35 microcode emulator and an HP35 workalike emulator. However, I can imagine a mere difference in precision or in rounding tactics might also show this difference: with a few more digits we see the more precise result 9.87654320988 and indeed the mathematic result is a repeating fraction: 9.87654320987654320... Any ideas for simple calculations which might expose the difference? |
|||
11-18-2019, 11:04 AM
Post: #2
|
|||
|
|||
RE: Detecting an emulator's number representation
You need to try and force a calculation to return a number that can be represented exactly only in decimal, not in binary. Try \(\frac{1}{10^n}\) for various positive integer values of n.
Conversely, there are values that can only be represented exactly in binary, not in decimal with a fixed number of digits available, such as \(\frac{1}{2^n}\). There are only 10 types of people in this world. Those who understand binary and those who don't. |
|||
11-18-2019, 04:54 PM
Post: #3
|
|||
|
|||
RE: Detecting an emulator's number representation
A simple test: evaluate (1 + 1E-8) - 1 , it returns *exactly* 1E-8 on a decimal machine, and *approximatively* 1E-8 on a binary machine.
J-F |
|||
11-18-2019, 06:14 PM
(This post was last modified: 11-18-2019 06:14 PM by toml_12953.)
Post: #4
|
|||
|
|||
RE: Detecting an emulator's number representation
(11-18-2019 10:51 AM)EdS2 Wrote: Aside from the question of how many bits or bytes are used, an emulator can either use binary or decimal internally. I'm thinking the kinds of inaccuracies of the two systems will differ, so there might be some simple calculation which shows whether binary or decimal is in use. Here's an ANSI BASIC program by Peter Norton from the March 10, 1987 issue of PC Magazine. It should be easy to convert to any other language such as HPPL on Prime. Code: ! A BASIC program to investigate floating point Tom L Cui bono? |
|||
11-19-2019, 09:02 AM
Post: #5
|
|||
|
|||
RE: Detecting an emulator's number representation | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)