Re: Overflow challenge summary of results Message #44 Posted by Valentin Albillo on 7 Sept 2006, 6:53 a.m., in response to message #43 by Paul Dale
Hi, Paul:
Paul posted:
"On my 71b (without maths rom) I enter MINREAL and get "WRN:Underflow" followed, after a pause, by "0""
First of all, if you have a "71b (without maths rom)" then you don't actually have an HP-71B but the crippled, maimed version the bean counters at HP decided to release instead at the time. Go get a Math ROM (or use Emu71, which already includes it) and then you're in business. That said, MINREAL behaviour has nothing to do with the Math ROM being present or not, but get one anyway :-)
Then about your statement, notice that I say in my original post that "I don't claim that this is the minimum keystroke solution, it's only for informational purposes". This is because the original challenge explicitly requests that the starting point is a factory-reset machine ("Memory Lost"), and after such a memory reset, the HP-71B is left in DEFAULT ON mode, which specifies that
mathematical exceptions (such as division by zero, overflow, underflow, etc), are to result in a warning message being issued, plus a default value automatically supplied for the offending operation, then the computation or program resumes using that default value instead.
So, in the factory-reset DEFAULT ON mode, you would get this:
>DEFAULT ON
>MINREAL
WRN:Underflow
0
i.e., a message is displayed warning of the underflow (as MINREAL is less than 1E-499), a "0" is reported as the result, and your
computation or program proceeds using it.
If you'd rather have no default values supplied but a hard error being reported instead (which would perhaps be specially desirable for Division by Zero or Overflow exceptions), you specify DEFAULT OFF instead, in which case you'll get this:
>DEFAULT OFF
>MINREAL
ERR:Underflow
and, as you may see, you'll get an ERRor message (not a WaRNing),
no default value is supplied (no "0" output this time) and your computation or program would stop at once (unless the error was caught by an ON ERROR statement, but that's another story ...)
Fortunately, the HP-71B (even your maimed version) does implement full IEEE compliance, and that includes gradual denormalization of values at the extremes of the representable range, and in the case of the Underflow exception, values as low as MINREAL ( 0.00000000001E-499) can thus be used if necessary. As this is an extension to the usual, non-IEEE behavior, the user is given the decision to allow for this extension or not. If you'd like to turn on this extension by default, you simply specify DEFAULT EXTEND,
like this:
>DEFAULT EXTEND
>MINREAL
0.00000000001E-499
and, as you may see, this time there are no warning or error messages, and no default value is supplied but the actual, denormalized value of MINREAL, which you can further use in computations.
There's much more to this topic about DEFAULT exception handling
modes and TRAP settings, a good place to start are the "Math Exceptions" section (HP-71B's Owner's Handbook pp. 57 and following) and the entries for DEFAULT, TRAP, and MINREAL in the Reference Manual.
In any case, take note that I didn't say that my posting was to be considered as an entry to the 'challenge', which it isn't, but merely to point out the fact than in the HP-71B, 1E-499 is not the smallest representable value, that would be MINREAL. If you'd rather have the smallest representable normalized value, use EPS instead. That would be 1E-499.
Best regards from V.
|