[ << ]  [ < ]  [ Up ]  [ > ]  [ >> ]  [Top]  [Contents]  [Index]  [ ? ] 
5.1 Internal and printed representation
All computations deal with the internal representations of the numbers.
Every number has an external representation as a sequence of ASCII characters. Several external representations may denote the same number, for example, "20.0" and "20.000".
Converting an internal to an external representation is called “printing”,
converting an external to an internal representation is called “reading”.
In CLN, it is always true that conversion of an internal to an external
representation and then back to an internal representation will yield the
same internal representation. Symbolically: read(print(x)) == x
.
This is called “printread consistency”.
Different types of numbers have different external representations (case is insignificant):
 Integers
External representation: sign{digit}+. The reader also accepts the Common Lisp syntaxes sign{digit}+
.
with a trailing dot for decimal integers and the#nR
,#b
,#o
,#x
prefixes. Rational numbers
External representation: sign{digit}+
/
{digit}+. The#nR
,#b
,#o
,#x
prefixes are allowed here as well. Floatingpoint numbers
External representation: sign{digit}*exponent or sign{digit}*
.
{digit}*exponent or sign{digit}*.
{digit}+. A precision specifier of the form _prec may be appended. There must be at least one digit in the nonexponent part. The exponent has the syntax expmarker expsign {digit}+. The exponent marker is ‘s’ for shortfloats,
 ‘f’ for singlefloats,
 ‘d’ for doublefloats,
 ‘L’ for longfloats,
or ‘e’, which denotes a default float format. The precision specifying suffix has the syntax _prec where prec denotes the number of valid mantissa digits (in decimal, excluding leading zeroes), cf. also function ‘float_format’.
 Complex numbers
External representation:

In algebraic notation:
realpart+imagparti
. Of course, if imagpart is negative, its printed representation begins with a ‘’, and the ‘+’ between realpart and imagpart may be omitted. Note that this notation cannot be used when the imagpart is rational and the rational number’s base is >18, because the ‘i’ is then read as a digit. 
In Common Lisp notation:
#C(realpart imagpart)
.

In algebraic notation:
[ << ]  [ < ]  [ Up ]  [ > ]  [ >> ]  [Top]  [Contents]  [Index]  [ ? ] 
This document was generated on August 27, 2013 using texi2html 5.0.