Download User's Guide for Gappa
Transcript
Chapter 4. Rounding operators
4.2. Floating-point operators
This class of operators covers all the formats whose number sets are F (p, d) = {m × 2e ; |m| <
2p , e ≥ d}. In particular, IEEE-754 floating-point formats (with subnormal numbers) are part of this
class, if we set apart overflow issues. Both parameters p and d select a particular format. The last
parameter selects the rounding direction.
float< precision, minimum_exponent, rounding_direction >(...)
Having to remember the precision and minimum exponent parameters may be a bit tedious, so an
alternate syntax is provided: instead of these two parameters, a name can be given to the float class.
float< name, rounding_direction >(...)
There are four predefined formats:
ieee_32
IEEE-754 single precision
ieee_64
IEEE-754 double precision
ieee_128
IEEE-754 quadruple precision
x86_80
extended precision on x86-like processors
4.3. Fixed-point operators
This class of operators covers all the formats whose number sets are F (e) = {m × 2e }. The first
parameter selects the weight of the least significant bit. The second parameter selects the rounding
direction.
fixed< lsb_weight, rounding_direction >(...)
Rounding to integer is a special case of fixed point rounding of weight 0. A syntactic shortcut is
provided.
int< rounding_direction >(...)
4.4. Miscellaneous operators
4.4.1. Functions with relative error
This set of functions is defined with related theorems on relative error. They can be used to express
properties that cannot be directly expressed through unary rounding operators.
{add|sub|mul}_rel< precision [, minimum_exponent] >(..., ...)
13