1*c36abe0dSDavid Schultz$NetBSD: softfloat.txt,v 1.2 2006/11/24 19:46:58 christos Exp $
215144b0fSOlivier Houchard$FreeBSD$
315144b0fSOlivier Houchard
415144b0fSOlivier HouchardSoftFloat Release 2a General Documentation
515144b0fSOlivier Houchard
615144b0fSOlivier HouchardJohn R. Hauser
715144b0fSOlivier Houchard1998 December 13
815144b0fSOlivier Houchard
915144b0fSOlivier Houchard
1015144b0fSOlivier Houchard-------------------------------------------------------------------------------
1115144b0fSOlivier HouchardIntroduction
1215144b0fSOlivier Houchard
1315144b0fSOlivier HouchardSoftFloat is a software implementation of floating-point that conforms to
1415144b0fSOlivier Houchardthe IEC/IEEE Standard for Binary Floating-Point Arithmetic.  As many as four
1515144b0fSOlivier Houchardformats are supported:  single precision, double precision, extended double
1615144b0fSOlivier Houchardprecision, and quadruple precision.  All operations required by the standard
1715144b0fSOlivier Houchardare implemented, except for conversions to and from decimal.
1815144b0fSOlivier Houchard
1915144b0fSOlivier HouchardThis document gives information about the types defined and the routines
2015144b0fSOlivier Houchardimplemented by SoftFloat.  It does not attempt to define or explain the
2115144b0fSOlivier HouchardIEC/IEEE Floating-Point Standard.  Details about the standard are available
2215144b0fSOlivier Houchardelsewhere.
2315144b0fSOlivier Houchard
2415144b0fSOlivier Houchard
2515144b0fSOlivier Houchard-------------------------------------------------------------------------------
2615144b0fSOlivier HouchardLimitations
2715144b0fSOlivier Houchard
2815144b0fSOlivier HouchardSoftFloat is written in C and is designed to work with other C code.  The
2915144b0fSOlivier HouchardSoftFloat header files assume an ISO/ANSI-style C compiler.  No attempt
30*c36abe0dSDavid Schultzhas been made to accommodate compilers that are not ISO-conformant.  In
3115144b0fSOlivier Houchardparticular, the distributed header files will not be acceptable to any
3215144b0fSOlivier Houchardcompiler that does not recognize function prototypes.
3315144b0fSOlivier Houchard
3415144b0fSOlivier HouchardSupport for the extended double-precision and quadruple-precision formats
3515144b0fSOlivier Houcharddepends on a C compiler that implements 64-bit integer arithmetic.  If the
3615144b0fSOlivier Houchardlargest integer format supported by the C compiler is 32 bits, SoftFloat is
3715144b0fSOlivier Houchardlimited to only single and double precisions.  When that is the case, all
3815144b0fSOlivier Houchardreferences in this document to the extended double precision, quadruple
3915144b0fSOlivier Houchardprecision, and 64-bit integers should be ignored.
4015144b0fSOlivier Houchard
4115144b0fSOlivier Houchard
4215144b0fSOlivier Houchard-------------------------------------------------------------------------------
4315144b0fSOlivier HouchardContents
4415144b0fSOlivier Houchard
4515144b0fSOlivier Houchard    Introduction
4615144b0fSOlivier Houchard    Limitations
4715144b0fSOlivier Houchard    Contents
4815144b0fSOlivier Houchard    Legal Notice
4915144b0fSOlivier Houchard    Types and Functions
5015144b0fSOlivier Houchard    Rounding Modes
5115144b0fSOlivier Houchard    Extended Double-Precision Rounding Precision
5215144b0fSOlivier Houchard    Exceptions and Exception Flags
5315144b0fSOlivier Houchard    Function Details
5415144b0fSOlivier Houchard        Conversion Functions
5515144b0fSOlivier Houchard        Standard Arithmetic Functions
5615144b0fSOlivier Houchard        Remainder Functions
5715144b0fSOlivier Houchard        Round-to-Integer Functions
5815144b0fSOlivier Houchard        Comparison Functions
5915144b0fSOlivier Houchard        Signaling NaN Test Functions
6015144b0fSOlivier Houchard        Raise-Exception Function
6115144b0fSOlivier Houchard    Contact Information
6215144b0fSOlivier Houchard
6315144b0fSOlivier Houchard
6415144b0fSOlivier Houchard
6515144b0fSOlivier Houchard-------------------------------------------------------------------------------
6615144b0fSOlivier HouchardLegal Notice
6715144b0fSOlivier Houchard
6815144b0fSOlivier HouchardSoftFloat was written by John R. Hauser.  This work was made possible in
6915144b0fSOlivier Houchardpart by the International Computer Science Institute, located at Suite 600,
7015144b0fSOlivier Houchard1947 Center Street, Berkeley, California 94704.  Funding was partially
7115144b0fSOlivier Houchardprovided by the National Science Foundation under grant MIP-9311980.  The
7215144b0fSOlivier Houchardoriginal version of this code was written as part of a project to build
7315144b0fSOlivier Houcharda fixed-point vector processor in collaboration with the University of
7415144b0fSOlivier HouchardCalifornia at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
7515144b0fSOlivier Houchard
7615144b0fSOlivier HouchardTHIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
7715144b0fSOlivier Houchardhas been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
7815144b0fSOlivier HouchardTIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
7915144b0fSOlivier HouchardPERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
8015144b0fSOlivier HouchardAND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
8115144b0fSOlivier Houchard
8215144b0fSOlivier Houchard
8315144b0fSOlivier Houchard-------------------------------------------------------------------------------
8415144b0fSOlivier HouchardTypes and Functions
8515144b0fSOlivier Houchard
8615144b0fSOlivier HouchardWhen 64-bit integers are supported by the compiler, the `softfloat.h' header
8715144b0fSOlivier Houchardfile defines four types:  `float32' (single precision), `float64' (double
8815144b0fSOlivier Houchardprecision), `floatx80' (extended double precision), and `float128'
8915144b0fSOlivier Houchard(quadruple precision).  The `float32' and `float64' types are defined in
9015144b0fSOlivier Houchardterms of 32-bit and 64-bit integer types, respectively, while the `float128'
9115144b0fSOlivier Houchardtype is defined as a structure of two 64-bit integers, taking into account
9215144b0fSOlivier Houchardthe byte order of the particular machine being used.  The `floatx80' type
9315144b0fSOlivier Houchardis defined as a structure containing one 16-bit and one 64-bit integer, with
9415144b0fSOlivier Houchardthe machine's byte order again determining the order of the `high' and `low'
9515144b0fSOlivier Houchardfields.
9615144b0fSOlivier Houchard
9715144b0fSOlivier HouchardWhen 64-bit integers are _not_ supported by the compiler, the `softfloat.h'
9815144b0fSOlivier Houchardheader file defines only two types:  `float32' and `float64'.  Because
9915144b0fSOlivier HouchardISO/ANSI C guarantees at least one built-in integer type of 32 bits,
10015144b0fSOlivier Houchardthe `float32' type is identified with an appropriate integer type.  The
10115144b0fSOlivier Houchard`float64' type is defined as a structure of two 32-bit integers, with the
10215144b0fSOlivier Houchardmachine's byte order determining the order of the fields.
10315144b0fSOlivier Houchard
10415144b0fSOlivier HouchardIn either case, the types in `softfloat.h' are defined such that if a system
10515144b0fSOlivier Houchardimplements the usual C `float' and `double' types according to the IEC/IEEE
10615144b0fSOlivier HouchardStandard, then the `float32' and `float64' types should be indistinguishable
10715144b0fSOlivier Houchardin memory from the native `float' and `double' types.  (On the other hand,
10815144b0fSOlivier Houchardwhen `float32' or `float64' values are placed in processor registers by
10915144b0fSOlivier Houchardthe compiler, the type of registers used may differ from those used for the
11015144b0fSOlivier Houchardnative `float' and `double' types.)
11115144b0fSOlivier Houchard
11215144b0fSOlivier HouchardSoftFloat implements the following arithmetic operations:
11315144b0fSOlivier Houchard
11415144b0fSOlivier Houchard-- Conversions among all the floating-point formats, and also between
11515144b0fSOlivier Houchard   integers (32-bit and 64-bit) and any of the floating-point formats.
11615144b0fSOlivier Houchard
11715144b0fSOlivier Houchard-- The usual add, subtract, multiply, divide, and square root operations
11815144b0fSOlivier Houchard   for all floating-point formats.
11915144b0fSOlivier Houchard
12015144b0fSOlivier Houchard-- For each format, the floating-point remainder operation defined by the
12115144b0fSOlivier Houchard   IEC/IEEE Standard.
12215144b0fSOlivier Houchard
12315144b0fSOlivier Houchard-- For each floating-point format, a ``round to integer'' operation that
12415144b0fSOlivier Houchard   rounds to the nearest integer value in the same format.  (The floating-
12515144b0fSOlivier Houchard   point formats can hold integer values, of course.)
12615144b0fSOlivier Houchard
12715144b0fSOlivier Houchard-- Comparisons between two values in the same floating-point format.
12815144b0fSOlivier Houchard
12915144b0fSOlivier HouchardThe only functions required by the IEC/IEEE Standard that are not provided
13015144b0fSOlivier Houchardare conversions to and from decimal.
13115144b0fSOlivier Houchard
13215144b0fSOlivier Houchard
13315144b0fSOlivier Houchard-------------------------------------------------------------------------------
13415144b0fSOlivier HouchardRounding Modes
13515144b0fSOlivier Houchard
13615144b0fSOlivier HouchardAll four rounding modes prescribed by the IEC/IEEE Standard are implemented
13715144b0fSOlivier Houchardfor all operations that require rounding.  The rounding mode is selected
13815144b0fSOlivier Houchardby the global variable `float_rounding_mode'.  This variable may be set
13915144b0fSOlivier Houchardto one of the values `float_round_nearest_even', `float_round_to_zero',
14015144b0fSOlivier Houchard`float_round_down', or `float_round_up'.  The rounding mode is initialized
14115144b0fSOlivier Houchardto nearest/even.
14215144b0fSOlivier Houchard
14315144b0fSOlivier Houchard
14415144b0fSOlivier Houchard-------------------------------------------------------------------------------
14515144b0fSOlivier HouchardExtended Double-Precision Rounding Precision
14615144b0fSOlivier Houchard
14715144b0fSOlivier HouchardFor extended double precision (`floatx80') only, the rounding precision
14815144b0fSOlivier Houchardof the standard arithmetic operations is controlled by the global variable
14915144b0fSOlivier Houchard`floatx80_rounding_precision'.  The operations affected are:
15015144b0fSOlivier Houchard
15115144b0fSOlivier Houchard   floatx80_add   floatx80_sub   floatx80_mul   floatx80_div   floatx80_sqrt
15215144b0fSOlivier Houchard
15315144b0fSOlivier HouchardWhen `floatx80_rounding_precision' is set to its default value of 80, these
15415144b0fSOlivier Houchardoperations are rounded (as usual) to the full precision of the extended
15515144b0fSOlivier Houcharddouble-precision format.  Setting `floatx80_rounding_precision' to 32
15615144b0fSOlivier Houchardor to 64 causes the operations listed to be rounded to reduced precision
15715144b0fSOlivier Houchardequivalent to single precision (`float32') or to double precision
15815144b0fSOlivier Houchard(`float64'), respectively.  When rounding to reduced precision, additional
15915144b0fSOlivier Houchardbits in the result significand beyond the rounding point are set to zero.
16015144b0fSOlivier HouchardThe consequences of setting `floatx80_rounding_precision' to a value other
16115144b0fSOlivier Houchardthan 32, 64, or 80 is not specified.  Operations other than the ones listed
16215144b0fSOlivier Houchardabove are not affected by `floatx80_rounding_precision'.
16315144b0fSOlivier Houchard
16415144b0fSOlivier Houchard
16515144b0fSOlivier Houchard-------------------------------------------------------------------------------
16615144b0fSOlivier HouchardExceptions and Exception Flags
16715144b0fSOlivier Houchard
16815144b0fSOlivier HouchardAll five exception flags required by the IEC/IEEE Standard are
16915144b0fSOlivier Houchardimplemented.  Each flag is stored as a unique bit in the global variable
17015144b0fSOlivier Houchard`float_exception_flags'.  The positions of the exception flag bits within
17115144b0fSOlivier Houchardthis variable are determined by the bit masks `float_flag_inexact',
17215144b0fSOlivier Houchard`float_flag_underflow', `float_flag_overflow', `float_flag_divbyzero', and
17315144b0fSOlivier Houchard`float_flag_invalid'.  The exception flags variable is initialized to all 0,
17415144b0fSOlivier Houchardmeaning no exceptions.
17515144b0fSOlivier Houchard
17615144b0fSOlivier HouchardAn individual exception flag can be cleared with the statement
17715144b0fSOlivier Houchard
17815144b0fSOlivier Houchard    float_exception_flags &= ~ float_flag_<exception>;
17915144b0fSOlivier Houchard
18015144b0fSOlivier Houchardwhere `<exception>' is the appropriate name.  To raise a floating-point
18115144b0fSOlivier Houchardexception, the SoftFloat function `float_raise' should be used (see below).
18215144b0fSOlivier Houchard
18315144b0fSOlivier HouchardIn the terminology of the IEC/IEEE Standard, SoftFloat can detect tininess
18415144b0fSOlivier Houchardfor underflow either before or after rounding.  The choice is made by
18515144b0fSOlivier Houchardthe global variable `float_detect_tininess', which can be set to either
18615144b0fSOlivier Houchard`float_tininess_before_rounding' or `float_tininess_after_rounding'.
18715144b0fSOlivier HouchardDetecting tininess after rounding is better because it results in fewer
18815144b0fSOlivier Houchardspurious underflow signals.  The other option is provided for compatibility
18915144b0fSOlivier Houchardwith some systems.  Like most systems, SoftFloat always detects loss of
19015144b0fSOlivier Houchardaccuracy for underflow as an inexact result.
19115144b0fSOlivier Houchard
19215144b0fSOlivier Houchard
19315144b0fSOlivier Houchard-------------------------------------------------------------------------------
19415144b0fSOlivier HouchardFunction Details
19515144b0fSOlivier Houchard
19615144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19715144b0fSOlivier HouchardConversion Functions
19815144b0fSOlivier Houchard
19915144b0fSOlivier HouchardAll conversions among the floating-point formats are supported, as are all
20015144b0fSOlivier Houchardconversions between a floating-point format and 32-bit and 64-bit signed
20115144b0fSOlivier Houchardintegers.  The complete set of conversion functions is:
20215144b0fSOlivier Houchard
20315144b0fSOlivier Houchard   int32_to_float32      int64_to_float32
20415144b0fSOlivier Houchard   int32_to_float64      int64_to_float32
20515144b0fSOlivier Houchard   int32_to_floatx80     int64_to_floatx80
20615144b0fSOlivier Houchard   int32_to_float128     int64_to_float128
20715144b0fSOlivier Houchard
20815144b0fSOlivier Houchard   float32_to_int32      float32_to_int64
20915144b0fSOlivier Houchard   float32_to_int32      float64_to_int64
21015144b0fSOlivier Houchard   floatx80_to_int32     floatx80_to_int64
21115144b0fSOlivier Houchard   float128_to_int32     float128_to_int64
21215144b0fSOlivier Houchard
21315144b0fSOlivier Houchard   float32_to_float64    float32_to_floatx80   float32_to_float128
21415144b0fSOlivier Houchard   float64_to_float32    float64_to_floatx80   float64_to_float128
21515144b0fSOlivier Houchard   floatx80_to_float32   floatx80_to_float64   floatx80_to_float128
21615144b0fSOlivier Houchard   float128_to_float32   float128_to_float64   float128_to_floatx80
21715144b0fSOlivier Houchard
21815144b0fSOlivier HouchardEach conversion function takes one operand of the appropriate type and
21915144b0fSOlivier Houchardreturns one result.  Conversions from a smaller to a larger floating-point
22015144b0fSOlivier Houchardformat are always exact and so require no rounding.  Conversions from 32-bit
22115144b0fSOlivier Houchardintegers to double precision and larger formats are also exact, and likewise
22215144b0fSOlivier Houchardfor conversions from 64-bit integers to extended double and quadruple
22315144b0fSOlivier Houchardprecisions.
22415144b0fSOlivier Houchard
22515144b0fSOlivier HouchardConversions from floating-point to integer raise the invalid exception if
22615144b0fSOlivier Houchardthe source value cannot be rounded to a representable integer of the desired
22715144b0fSOlivier Houchardsize (32 or 64 bits).  If the floating-point operand is a NaN, the largest
22815144b0fSOlivier Houchardpositive integer is returned.  Otherwise, if the conversion overflows, the
22915144b0fSOlivier Houchardlargest integer with the same sign as the operand is returned.
23015144b0fSOlivier Houchard
23115144b0fSOlivier HouchardOn conversions to integer, if the floating-point operand is not already an
23215144b0fSOlivier Houchardinteger value, the operand is rounded according to the current rounding
23315144b0fSOlivier Houchardmode as specified by `float_rounding_mode'.  Because C (and perhaps other
23415144b0fSOlivier Houchardlanguages) require that conversions to integers be rounded toward zero, the
23515144b0fSOlivier Houchardfollowing functions are provided for improved speed and convenience:
23615144b0fSOlivier Houchard
23715144b0fSOlivier Houchard   float32_to_int32_round_to_zero    float32_to_int64_round_to_zero
23815144b0fSOlivier Houchard   float64_to_int32_round_to_zero    float64_to_int64_round_to_zero
23915144b0fSOlivier Houchard   floatx80_to_int32_round_to_zero   floatx80_to_int64_round_to_zero
24015144b0fSOlivier Houchard   float128_to_int32_round_to_zero   float128_to_int64_round_to_zero
24115144b0fSOlivier Houchard
24215144b0fSOlivier HouchardThese variant functions ignore `float_rounding_mode' and always round toward
24315144b0fSOlivier Houchardzero.
24415144b0fSOlivier Houchard
24515144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24615144b0fSOlivier HouchardStandard Arithmetic Functions
24715144b0fSOlivier Houchard
24815144b0fSOlivier HouchardThe following standard arithmetic functions are provided:
24915144b0fSOlivier Houchard
25015144b0fSOlivier Houchard   float32_add    float32_sub    float32_mul    float32_div    float32_sqrt
25115144b0fSOlivier Houchard   float64_add    float64_sub    float64_mul    float64_div    float64_sqrt
25215144b0fSOlivier Houchard   floatx80_add   floatx80_sub   floatx80_mul   floatx80_div   floatx80_sqrt
25315144b0fSOlivier Houchard   float128_add   float128_sub   float128_mul   float128_div   float128_sqrt
25415144b0fSOlivier Houchard
25515144b0fSOlivier HouchardEach function takes two operands, except for `sqrt' which takes only one.
25615144b0fSOlivier HouchardThe operands and result are all of the same type.
25715144b0fSOlivier Houchard
25815144b0fSOlivier HouchardRounding of the extended double-precision (`floatx80') functions is affected
25915144b0fSOlivier Houchardby the `floatx80_rounding_precision' variable, as explained above in the
26015144b0fSOlivier Houchardsection _Extended_Double-Precision_Rounding_Precision_.
26115144b0fSOlivier Houchard
26215144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26315144b0fSOlivier HouchardRemainder Functions
26415144b0fSOlivier Houchard
26515144b0fSOlivier HouchardFor each format, SoftFloat implements the remainder function according to
26615144b0fSOlivier Houchardthe IEC/IEEE Standard.  The remainder functions are:
26715144b0fSOlivier Houchard
26815144b0fSOlivier Houchard   float32_rem
26915144b0fSOlivier Houchard   float64_rem
27015144b0fSOlivier Houchard   floatx80_rem
27115144b0fSOlivier Houchard   float128_rem
27215144b0fSOlivier Houchard
27315144b0fSOlivier HouchardEach remainder function takes two operands.  The operands and result are all
27415144b0fSOlivier Houchardof the same type.  Given operands x and y, the remainder functions return
27515144b0fSOlivier Houchardthe value x - n*y, where n is the integer closest to x/y.  If x/y is exactly
27615144b0fSOlivier Houchardhalfway between two integers, n is the even integer closest to x/y.  The
27715144b0fSOlivier Houchardremainder functions are always exact and so require no rounding.
27815144b0fSOlivier Houchard
27915144b0fSOlivier HouchardDepending on the relative magnitudes of the operands, the remainder
28015144b0fSOlivier Houchardfunctions can take considerably longer to execute than the other SoftFloat
28115144b0fSOlivier Houchardfunctions.  This is inherent in the remainder operation itself and is not a
28215144b0fSOlivier Houchardflaw in the SoftFloat implementation.
28315144b0fSOlivier Houchard
28415144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28515144b0fSOlivier HouchardRound-to-Integer Functions
28615144b0fSOlivier Houchard
28715144b0fSOlivier HouchardFor each format, SoftFloat implements the round-to-integer function
28815144b0fSOlivier Houchardspecified by the IEC/IEEE Standard.  The functions are:
28915144b0fSOlivier Houchard
29015144b0fSOlivier Houchard   float32_round_to_int
29115144b0fSOlivier Houchard   float64_round_to_int
29215144b0fSOlivier Houchard   floatx80_round_to_int
29315144b0fSOlivier Houchard   float128_round_to_int
29415144b0fSOlivier Houchard
29515144b0fSOlivier HouchardEach function takes a single floating-point operand and returns a result of
29615144b0fSOlivier Houchardthe same type.  (Note that the result is not an integer type.)  The operand
29715144b0fSOlivier Houchardis rounded to an exact integer according to the current rounding mode, and
29815144b0fSOlivier Houchardthe resulting integer value is returned in the same floating-point format.
29915144b0fSOlivier Houchard
30015144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30115144b0fSOlivier HouchardComparison Functions
30215144b0fSOlivier Houchard
30315144b0fSOlivier HouchardThe following floating-point comparison functions are provided:
30415144b0fSOlivier Houchard
30515144b0fSOlivier Houchard   float32_eq    float32_le    float32_lt
30615144b0fSOlivier Houchard   float64_eq    float64_le    float64_lt
30715144b0fSOlivier Houchard   floatx80_eq   floatx80_le   floatx80_lt
30815144b0fSOlivier Houchard   float128_eq   float128_le   float128_lt
30915144b0fSOlivier Houchard
31015144b0fSOlivier HouchardEach function takes two operands of the same type and returns a 1 or 0
31115144b0fSOlivier Houchardrepresenting either _true_ or _false_.  The abbreviation `eq' stands for
31215144b0fSOlivier Houchard``equal'' (=); `le' stands for ``less than or equal'' (<=); and `lt' stands
31315144b0fSOlivier Houchardfor ``less than'' (<).
31415144b0fSOlivier Houchard
31515144b0fSOlivier HouchardThe standard greater-than (>), greater-than-or-equal (>=), and not-equal
31615144b0fSOlivier Houchard(!=) functions are easily obtained using the functions provided.  The
31715144b0fSOlivier Houchardnot-equal function is just the logical complement of the equal function.
31815144b0fSOlivier HouchardThe greater-than-or-equal function is identical to the less-than-or-equal
31915144b0fSOlivier Houchardfunction with the operands reversed; and the greater-than function can be
32015144b0fSOlivier Houchardobtained from the less-than function in the same way.
32115144b0fSOlivier Houchard
32215144b0fSOlivier HouchardThe IEC/IEEE Standard specifies that the less-than-or-equal and less-than
32315144b0fSOlivier Houchardfunctions raise the invalid exception if either input is any kind of NaN.
32415144b0fSOlivier HouchardThe equal functions, on the other hand, are defined not to raise the invalid
32515144b0fSOlivier Houchardexception on quiet NaNs.  For completeness, SoftFloat provides the following
32615144b0fSOlivier Houchardadditional functions:
32715144b0fSOlivier Houchard
32815144b0fSOlivier Houchard   float32_eq_signaling    float32_le_quiet    float32_lt_quiet
32915144b0fSOlivier Houchard   float64_eq_signaling    float64_le_quiet    float64_lt_quiet
33015144b0fSOlivier Houchard   floatx80_eq_signaling   floatx80_le_quiet   floatx80_lt_quiet
33115144b0fSOlivier Houchard   float128_eq_signaling   float128_le_quiet   float128_lt_quiet
33215144b0fSOlivier Houchard
33315144b0fSOlivier HouchardThe `signaling' equal functions are identical to the standard functions
33415144b0fSOlivier Houchardexcept that the invalid exception is raised for any NaN input.  Likewise,
33515144b0fSOlivier Houchardthe `quiet' comparison functions are identical to their counterparts except
33615144b0fSOlivier Houchardthat the invalid exception is not raised for quiet NaNs.
33715144b0fSOlivier Houchard
33815144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33915144b0fSOlivier HouchardSignaling NaN Test Functions
34015144b0fSOlivier Houchard
34115144b0fSOlivier HouchardThe following functions test whether a floating-point value is a signaling
34215144b0fSOlivier HouchardNaN:
34315144b0fSOlivier Houchard
34415144b0fSOlivier Houchard   float32_is_signaling_nan
34515144b0fSOlivier Houchard   float64_is_signaling_nan
34615144b0fSOlivier Houchard   floatx80_is_signaling_nan
34715144b0fSOlivier Houchard   float128_is_signaling_nan
34815144b0fSOlivier Houchard
34915144b0fSOlivier HouchardThe functions take one operand and return 1 if the operand is a signaling
35015144b0fSOlivier HouchardNaN and 0 otherwise.
35115144b0fSOlivier Houchard
35215144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
35315144b0fSOlivier HouchardRaise-Exception Function
35415144b0fSOlivier Houchard
35515144b0fSOlivier HouchardSoftFloat provides a function for raising floating-point exceptions:
35615144b0fSOlivier Houchard
35715144b0fSOlivier Houchard    float_raise
35815144b0fSOlivier Houchard
35915144b0fSOlivier HouchardThe function takes a mask indicating the set of exceptions to raise.  No
36015144b0fSOlivier Houchardresult is returned.  In addition to setting the specified exception flags,
36115144b0fSOlivier Houchardthis function may cause a trap or abort appropriate for the current system.
36215144b0fSOlivier Houchard
36315144b0fSOlivier Houchard- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36415144b0fSOlivier Houchard
36515144b0fSOlivier Houchard
36615144b0fSOlivier Houchard-------------------------------------------------------------------------------
36715144b0fSOlivier HouchardContact Information
36815144b0fSOlivier Houchard
36915144b0fSOlivier HouchardAt the time of this writing, the most up-to-date information about
37015144b0fSOlivier HouchardSoftFloat and the latest release can be found at the Web page `http://
37115144b0fSOlivier HouchardHTTP.CS.Berkeley.EDU/~jhauser/arithmetic/SoftFloat.html'.
37215144b0fSOlivier Houchard
37315144b0fSOlivier Houchard
374