CLOS and MOPGBBopen ToolsPseudo ProbabilitiesDeclared NumericsGoTo Top

Declared Numerics

The :gbbopen-tools module contains a set of declared-numeric and pseudo probability operators that provide convenient shorthands for declaring fixnum, short-float, single-float, double-float, long-float, and pseudo-probability numeric operations. If the feature :full-safety is present at compile time, these operators do not make their fixnum, single-float, double-float, and long-float declarations.

The names of the declared-numeric and pseudo-probability operators include these “type-indicator” characters:

      Characters       Declared Type
& fixnum
$& short-float
$ single-float
$$ double-float
$$$ long-float
% pseudo-probability

Thus, the declared-numeric + operators are:

      +&       fixnum addition
+$& short-float addition
+$ single-float addition
+$$ double-float addition
+$$$ long-float addition
+% pseudo-probability addition

Most Common Lisp implementations map double-float numbers to the 64-bit IEEE 754 double format and single-float numbers to the 32-bit IEEE 754 single format. The four types of floating-point declared numeric operators (short-float, single-float, double-float, and long-float) are always defined, even if the Common Lisp implementation provides fewer distinct internal float representations. The features :has-short-float, :has-single-float, :has-double-float, and :has-long-float are added when the implementation provides that distinct internal float representation. (The feature :has-single-float is always defined.)

The following two features related to fixnum capabilities are defined when appropriate: :fixnum-size-below-29 and :fixnum-size-supports-unsigned-byte-32.

Some examples of declared-numeric operators include:

  (& x) ==> (the fixnum x)
  (+& x y) ==> (the fixnum (+ (the fixnum x) (the fixnum y))
  (>$ a b) ==> (> (the single-float a) (the single-float b))
  (minusp$$ value) ==> (minusp (the double-float value))
  (truncate& x y)) ==> (the (values fixnum fixnum) (truncate (& x) (& y)))
The complete set of operators for each declared numeric type are listed in the following sections. (Pseudo probability operators are listed in the Pseudo Probabilities section of the manual.)


The GBBopen Project


CLOS and MOPGBBopen ToolsPseudo ProbabilitiesDeclared NumericsGoTo Top