1Long double format
2==================
3
4  Each long double is made up of two IEEE doubles.  The value of the
5long double is the sum of the values of the two parts (except for
6-0.0).  The most significant part is required to be the value of the
7long double rounded to the nearest double, as specified by IEEE.  For
8Inf values, the least significant part is required to be one of +0.0
9or -0.0.  No other requirements are made; so, for example, 1.0 may be
10represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a NaN
11is don't-care.
12
13Classification
14--------------
15
16A long double can represent any value of the form
17  s * 2^e * sum(k=0...105: f_k * 2^(-k))
18where 's' is +1 or -1, 'e' is between 1022 and -968 inclusive, f_0 is
191, and f_k for k>0 is 0 or 1.  These are the 'normal' long doubles.
20
21A long double can also represent any value of the form
22  s * 2^-968 * sum(k=0...105: f_k * 2^(-k))
23where 's' is +1 or -1, f_0 is 0, and f_k for k>0 is 0 or 1.  These are
24the 'subnormal' long doubles.
25
26There are four long doubles that represent zero, two that represent
27+0.0 and two that represent -0.0.  The sign of the high part is the
28sign of the long double, and the sign of the low part is ignored.
29
30Likewise, there are four long doubles that represent infinities, two
31for +Inf and two for -Inf.
32
33Each NaN, quiet or signalling, that can be represented as a 'double'
34can be represented as a 'long double'.  In fact, there are 2^64
35equivalent representations for each one.
36
37There are certain other valid long doubles where both parts are
38nonzero but the low part represents a value which has a bit set below
392^(e-105).  These, together with the subnormal long doubles, make up
40the denormal long doubles.
41
42Many possible long double bit patterns are not valid long doubles.
43These do not represent any value.
44
45Limits
46------
47
48The maximum representable long double is 2^1024-2^918.  The smallest
49*normal* positive long double is 2^-968.  The smallest denormalised
50positive long double is 2^-1074 (this is the same as for 'double').
51
52Conversions
53-----------
54
55A double can be converted to a long double by adding a zero low part.
56
57A long double can be converted to a double by removing the low part.
58
59Comparisons
60-----------
61
62Two long doubles can be compared by comparing the high parts, and if
63those compare equal, comparing the low parts.
64
65Arithmetic
66----------
67
68The unary negate operation operates by negating the low and high parts.
69
70An absolute or absolute-negate operation must be done by comparing
71against zero and negating if necessary.
72
73Addition and subtraction are performed using library routines.  They
74are not at present performed perfectly accurately, the result produced
75will be within 1ulp of the range generated by adding or subtracting
761ulp from the input values, where a 'ulp' is 2^(e-106) given the
77exponent 'e'.  In the presence of cancellation, this may be
78arbitrarily inaccurate.  Subtraction is done by negation and addition.
79
80Multiplication is also performed using a library routine.  Its result
81will be within 2ulp of the correct result.
82
83Division is also performed using a library routine.  Its result will
84be within 3ulp of the correct result.
85