RPN-PRGM: New Windows console application emulating HP calculators
|
02-01-2021, 03:33 AM
(This post was last modified: 02-01-2021 03:38 AM by Aacini.)
Post: #13
|
|||
|
|||
RE: RPN-PRGM: New Windows console application emulating HP calculators
Ok, there are several points involved here:
(01-29-2021 01:50 PM)Albert Chan Wrote:(01-28-2021 04:16 PM)Aacini Wrote: [*] The management of 80-bits floating point numbers, that allows to enter and display numbers with 19 decimal digits and an exponent of ten above 4000. The number of bits vs. decimal digits described in the "Exploring Binary" article is a theoretical approach. In a practical implementation, the 80-bits floating point number (the 64-bits mantissa, really) must be converted into a 64-bits integer number that can contain a maximum of 19 decimal digits: RPN.exe users manual Wrote:The X register have an internal 80-bits precision of 19 decimal digits and an exponent of ten of ±4932; however, printf function can only display a 64-bits precision value with 16 digits and an exponent of ten of ±308. Any value outside this range is shown as +Infinite or zero. However, if ENG:p format is given then an attempt to show the X register with its full precision is done. The method I used to display the 80-bits floating point number as a 19 decimal digits may introduce some rounding errors in the least significand digit(s). This means that you can NOT trust in the precision of the number displayed with ENG:p format. The central part of my conversion method is this: Code:
I am open to any suggestion of a more precise method to perform this conversion. (01-29-2021 01:50 PM)Albert Chan Wrote: Better yet, have an option to enter/display hex-float. Well, this can be done in an easier way, but the problem then is to read the hex format (by us) as a direct copy of the FPU ST(0) register with no conversion. I will add the HEX output format in the next RPN.exe version. ---- (01-29-2021 01:50 PM)Albert Chan Wrote: Is this a RPN.exe bug ? RPN.exe users manual Wrote:RPN.exe is a Windows console application designed to evaluate floating-point arithmetic operations based on an entirely different philosophy that allow the user to have access to FPU operations in a way as direct as possible with just the minimum indispensable additional code. To do that, the operations given by the user are directly translated to native machine code and then executed. The operations you enter are exactly the same operations that the FPU executes, so the result you get is the way the FPU works. I invite you to review the FPURM (FPU Rounding Mode) and FPUPC (FPU Precision Control) operations in chapter 7 "System operations" in the user's manual. ---- (01-29-2021 01:50 PM)Albert Chan Wrote: A minor issue, numbers starting with decimal point are not recognized: RPN.exe users manual Wrote:The correct number formats are these: Yes. The digits part before the decimal point is the only mandatory part of a number. Note that you can't enter a number with positive sign either. Antonio |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)