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