HP 3000 Manuals

DEFAULT ON [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

DEFAULT ON 

Values that are out of range cause the arithmetic errors in the following
table.  If a DEFAULT ON statement is executed before one of these errors
occurs, the error is overridden and a default value is substituted for
the value that is out of range.

Syntax 

DEFAULT ON

If one of the errors in Table 4-3 occurs before a DEFAULT ON statement is
executed or after a DEFAULT OFF statement is executed, program execution
is suspended.

The DEFAULT OFF value is set when you initially enter the interpreter.

          Table 4-3.  DEFAULT ON Values 

-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
|   Error   |           Error Description            |             Default Values             |
|  Number   |                                        |                                        |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 20        | Short integer precision overflow.      | 32767 or -32768                        |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 21        | Short decimal precision overflow.      | {+ -}9.99999E+63                       |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 22        | Decimal precision overflow.            | {+ -}9.99999999999E+511                |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 24        | TAN(N*PI/2) where N is an odd integer. | 1.157920892373161E+77                  |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 26        | Zero to negative power.                | 1.157920892373161E+77                  |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 29        | LGT or LOG of zero.                    | -1.79769313486231E+308                 |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 31        | Division by zero.                      | Default type maximum                   |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 1139      | Integer precision overflow.            | -2147483648 or 2147483647              |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 1140      | Real precision overflow.               | {+ -}1.79769313486231E+308             |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------
|           |                                        |                                        |
| 1141      | Short real precision overflow.         | {+ -}3.40282E+38                       |
|           |                                        |                                        |
-----------------------------------------------------------------------------------------------

Examples 

The following examples show the result of using the DEFAULT ON statement.
In the first example, the program does not have DEFAULT ON and a short
integer precision overflow results.  In the second example, there is a
DEFAULT ON statement and the default value of 32767 is substituted for
the out of range 2*A.

     >list
          10 SHORT INTEGER A,B
          20 A=32767
          30 B=2*A
          40 PRINT A
          50 PRINT B
          60 END
     >run
     Error 20 in line 30
     SHORT INTEGER precision overflow.
     >15 DEFAULT ON
     >list
          10 SHORT INTEGER A,B
          15 DEFAULT ON
          20 A=32767
          30 B=2*A
          40 PRINT A
          50 PRINT B
          60 END
     >run
      32767
      32767
     >



MPE/iX 5.0 Documentation