Relaxations

A relaxation is a less restrictive set of rules that are either chosen or exists natively in some environments. If a program runs well in a complete environment, it will also run in a relaxed environment.

It is recommended to develop and test a program in a complete environment. Then, after the program is done and ready to ship, it can be executed on a relaxed environment either because the user simply only has a reduced environment, or because of speed of execution. If a program has been thoroughly tested, and is known to be quite robust, then the additional checking is unecessary.

Types

  • Binary Relaxation
  • Exception Relaxation

Binary Relaxation

With binary relaxation, the decimal type is replaced with a binary type that contains the range of the decimal type.

The overflow exception is then instead caused at the new bounds.

Binary64 (or Double Precision) Binary Relaxation

The decimal variable type is a fractional, floating point 15 decimal digits fraction (mantissa), 2 decimal digit exponent. With binary relaxation, this type is, for example, replaced by double precision IEEE 754, also called binary64. This type has 52 bit fraction (mantissa), which can represent 15 to 17 decimal digits, and a 11 bit exponent, which can represent 3 decimal digits.

For more information on the double precision or Binary64 type, see double precision.

Value Type Value
max +1.797 693 134 862 32*10^+308
min -1.797 693 134 862 32*10^+308
min positive (normal*) +2.225 073 858 507 20*10^−308
min positive (denormal*) +4.940 656 458 412 47*10^-324
max negative (normal*) -2.225 073 858 507 20*10^−308
max positive (denormal*) -4.940 656 458 412 47*10^-324
smallest change See the Binary64 documentation from IEEE
zeros 0 and -0

* Denormal is an optional mode of Binary64 (or double precision). If denormal is turned off, the mode is called normal.

Note on special values
Question Answer
Can be Not a Number (NaN)? Yes
Can be Infinity? Yes
Can be Negative Infinity? Yes
Can be Undefined or Null? No
Can be negative zero? Yes

Exception Relaxation

An operator is replaced by one that does not throw exceptions.

Overflow

An overflow exception can be replaced by, for example, returning Infinity, -Infinity or NaN. These are not values supported in the ProgsBase system.

Invalid operand

An invalid operand exception can be replaced by returning, for example, Infinity, -Infinity or NaN, 0 or 1. Infinity, -Infinity and NaN are not values supported in the ProgsBase system.

Out of bounds

An out of bounds exception can be replaced by returning, for example, null, nil or undefined. These are not values supported in the ProgsBase system.