Home | History | Annotate | Line # | Download | only in include
systfloat.h revision 1.3
      1 /*	$NetBSD: systfloat.h,v 1.3 2002/02/21 07:38:17 itojun Exp $	*/
      2 
      3 /* This is a derivative work. */
      4 
      5 /*-
      6  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      7  * All rights reserved.
      8  *
      9  * This code is derived from software contributed to The NetBSD Foundation
     10  * by Ross Harvey.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. All advertising materials mentioning features or use of this software
     21  *    must display the following acknowledgement:
     22  *        This product includes software developed by the NetBSD
     23  *        Foundation, Inc. and its contributors.
     24  * 4. Neither the name of The NetBSD Foundation nor the names of its
     25  *    contributors may be used to endorse or promote products derived
     26  *    from this software without specific prior written permission.
     27  *
     28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     38  * POSSIBILITY OF SUCH DAMAGE.
     39  */
     40 
     41 /*
     42 ===============================================================================
     43 
     44 This C header file is part of TestFloat, Release 2a, a package of programs
     45 for testing the correctness of floating-point arithmetic complying to the
     46 IEC/IEEE Standard for Floating-Point.
     47 
     48 Written by John R. Hauser.  More information is available through the Web
     49 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
     50 
     51 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
     52 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
     53 TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
     54 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
     55 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
     56 
     57 Derivative works are acceptable, even for commercial purposes, so long as
     58 (1) they include prominent notice that the work is derivative, and (2) they
     59 include prominent notice akin to these four paragraphs for those parts of
     60 this code that are retained.
     61 
     62 ===============================================================================
     63 */
     64 
     65 /*
     66 -------------------------------------------------------------------------------
     67 The following macros are defined to indicate that the corresponding
     68 functions exist.
     69 -------------------------------------------------------------------------------
     70 */
     71 #define SYST_INT32_TO_FLOAT32
     72 #define SYST_INT32_TO_FLOAT64
     73 #ifdef BITS64
     74 #define SYST_INT64_TO_FLOAT32
     75 #define SYST_INT64_TO_FLOAT64
     76 #endif
     77 #define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
     78 #ifdef BITS64
     79 #define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
     80 #endif
     81 #define SYST_FLOAT32_TO_FLOAT64
     82 #define SYST_FLOAT32_ADD
     83 #define SYST_FLOAT32_SUB
     84 #define SYST_FLOAT32_MUL
     85 #define SYST_FLOAT32_DIV
     86 #define SYST_FLOAT32_EQ
     87 #define SYST_FLOAT32_LE
     88 #define SYST_FLOAT32_LT
     89 #define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
     90 #ifdef BITS64
     91 #define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
     92 #endif
     93 #define SYST_FLOAT64_TO_FLOAT32
     94 #define SYST_FLOAT64_ADD
     95 #define SYST_FLOAT64_SUB
     96 #define SYST_FLOAT64_MUL
     97 #define SYST_FLOAT64_DIV
     98 #define SYST_FLOAT64_SQRT
     99 #define SYST_FLOAT64_EQ
    100 #define SYST_FLOAT64_LE
    101 #define SYST_FLOAT64_LT
    102 #if defined( FLOATX80 )
    103 #define SYST_INT32_TO_FLOATX80
    104 #ifdef BITS64
    105 #define SYST_INT64_TO_FLOATX80
    106 #endif
    107 #define SYST_FLOAT32_TO_FLOATX80
    108 #define SYST_FLOAT64_TO_FLOATX80
    109 #define SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
    110 #ifdef BITS64
    111 #define SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
    112 #endif
    113 #define SYST_FLOATX80_TO_FLOAT32
    114 #define SYST_FLOATX80_TO_FLOAT64
    115 #define SYST_FLOATX80_ADD
    116 #define SYST_FLOATX80_SUB
    117 #define SYST_FLOATX80_MUL
    118 #define SYST_FLOATX80_DIV
    119 #define SYST_FLOATX80_EQ
    120 #define SYST_FLOATX80_LE
    121 #define SYST_FLOATX80_LT
    122 #endif
    123 #if defined( FLOAT128 ) && defined( LONG_DOUBLE_IS_FLOAT128 )
    124 #define SYST_INT32_TO_FLOAT128
    125 #ifdef BITS64
    126 #define SYST_INT64_TO_FLOAT128
    127 #endif
    128 #define SYST_FLOAT32_TO_FLOAT128
    129 #define SYST_FLOAT64_TO_FLOAT128
    130 #define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
    131 #ifdef BITS64
    132 #define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
    133 #endif
    134 #define SYST_FLOAT128_TO_FLOAT32
    135 #define SYST_FLOAT128_TO_FLOAT64
    136 #define SYST_FLOAT128_ADD
    137 #define SYST_FLOAT128_SUB
    138 #define SYST_FLOAT128_MUL
    139 #define SYST_FLOAT128_DIV
    140 #define SYST_FLOAT128_EQ
    141 #define SYST_FLOAT128_LE
    142 #define SYST_FLOAT128_LT
    143 #endif
    144 
    145 /*
    146 -------------------------------------------------------------------------------
    147 System function declarations.  (Some of these functions may not exist.)
    148 -------------------------------------------------------------------------------
    149 */
    150 float32 syst_int32_to_float32( int32 );
    151 float64 syst_int32_to_float64( int32 );
    152 #ifdef FLOATX80
    153 floatx80 syst_int32_to_floatx80( int32 );
    154 #endif
    155 #ifdef FLOAT128
    156 float128 syst_int32_to_float128( int32 );
    157 #endif
    158 #ifdef BITS64
    159 float32 syst_int64_to_float32( int64 );
    160 float64 syst_int64_to_float64( int64 );
    161 #ifdef FLOATX80
    162 floatx80 syst_int64_to_floatx80( int64 );
    163 #endif
    164 #ifdef FLOAT128
    165 float128 syst_int64_to_float128( int64 );
    166 #endif
    167 #endif
    168 int32 syst_float32_to_int32( float32 );
    169 int32 syst_float32_to_int32_round_to_zero( float32 );
    170 #ifdef BITS64
    171 int64 syst_float32_to_int64( float32 );
    172 int64 syst_float32_to_int64_round_to_zero( float32 );
    173 #endif
    174 float64 syst_float32_to_float64( float32 );
    175 #ifdef FLOATX80
    176 floatx80 syst_float32_to_floatx80( float32 );
    177 #endif
    178 #ifdef FLOAT128
    179 float128 syst_float32_to_float128( float32 );
    180 #endif
    181 float32 syst_float32_round_to_int( float32 );
    182 float32 syst_float32_add( float32, float32 );
    183 float32 syst_float32_sub( float32, float32 );
    184 float32 syst_float32_mul( float32, float32 );
    185 float32 syst_float32_div( float32, float32 );
    186 float32 syst_float32_rem( float32, float32 );
    187 float32 syst_float32_sqrt( float32 );
    188 flag syst_float32_eq( float32, float32 );
    189 flag syst_float32_le( float32, float32 );
    190 flag syst_float32_lt( float32, float32 );
    191 flag syst_float32_eq_signaling( float32, float32 );
    192 flag syst_float32_le_quiet( float32, float32 );
    193 flag syst_float32_lt_quiet( float32, float32 );
    194 int32 syst_float64_to_int32( float64 );
    195 int32 syst_float64_to_int32_round_to_zero( float64 );
    196 #ifdef BITS64
    197 int64 syst_float64_to_int64( float64 );
    198 int64 syst_float64_to_int64_round_to_zero( float64 );
    199 #endif
    200 float32 syst_float64_to_float32( float64 );
    201 #ifdef FLOATX80
    202 floatx80 syst_float64_to_floatx80( float64 );
    203 #endif
    204 #ifdef FLOAT128
    205 float128 syst_float64_to_float128( float64 );
    206 #endif
    207 float64 syst_float64_round_to_int( float64 );
    208 float64 syst_float64_add( float64, float64 );
    209 float64 syst_float64_sub( float64, float64 );
    210 float64 syst_float64_mul( float64, float64 );
    211 float64 syst_float64_div( float64, float64 );
    212 float64 syst_float64_rem( float64, float64 );
    213 float64 syst_float64_sqrt( float64 );
    214 flag syst_float64_eq( float64, float64 );
    215 flag syst_float64_le( float64, float64 );
    216 flag syst_float64_lt( float64, float64 );
    217 flag syst_float64_eq_signaling( float64, float64 );
    218 flag syst_float64_le_quiet( float64, float64 );
    219 flag syst_float64_lt_quiet( float64, float64 );
    220 #ifdef FLOATX80
    221 int32 syst_floatx80_to_int32( floatx80 );
    222 int32 syst_floatx80_to_int32_round_to_zero( floatx80 );
    223 #ifdef BITS64
    224 int64 syst_floatx80_to_int64( floatx80 );
    225 int64 syst_floatx80_to_int64_round_to_zero( floatx80 );
    226 #endif
    227 float32 syst_floatx80_to_float32( floatx80 );
    228 float64 syst_floatx80_to_float64( floatx80 );
    229 #ifdef FLOAT128
    230 float128 syst_floatx80_to_float128( floatx80 );
    231 #endif
    232 floatx80 syst_floatx80_round_to_int( floatx80 );
    233 floatx80 syst_floatx80_add( floatx80, floatx80 );
    234 floatx80 syst_floatx80_sub( floatx80, floatx80 );
    235 floatx80 syst_floatx80_mul( floatx80, floatx80 );
    236 floatx80 syst_floatx80_div( floatx80, floatx80 );
    237 floatx80 syst_floatx80_rem( floatx80, floatx80 );
    238 floatx80 syst_floatx80_sqrt( floatx80 );
    239 flag syst_floatx80_eq( floatx80, floatx80 );
    240 flag syst_floatx80_le( floatx80, floatx80 );
    241 flag syst_floatx80_lt( floatx80, floatx80 );
    242 flag syst_floatx80_eq_signaling( floatx80, floatx80 );
    243 flag syst_floatx80_le_quiet( floatx80, floatx80 );
    244 flag syst_floatx80_lt_quiet( floatx80, floatx80 );
    245 #endif
    246 #ifdef FLOAT128
    247 int32 syst_float128_to_int32( float128 );
    248 int32 syst_float128_to_int32_round_to_zero( float128 );
    249 #ifdef BITS64
    250 int64 syst_float128_to_int64( float128 );
    251 int64 syst_float128_to_int64_round_to_zero( float128 );
    252 #endif
    253 float32 syst_float128_to_float32( float128 );
    254 float64 syst_float128_to_float64( float128 );
    255 #ifdef FLOATX80
    256 floatx80 syst_float128_to_floatx80( float128 );
    257 #endif
    258 float128 syst_float128_round_to_int( float128 );
    259 float128 syst_float128_add( float128, float128 );
    260 float128 syst_float128_sub( float128, float128 );
    261 float128 syst_float128_mul( float128, float128 );
    262 float128 syst_float128_div( float128, float128 );
    263 float128 syst_float128_rem( float128, float128 );
    264 float128 syst_float128_sqrt( float128 );
    265 flag syst_float128_eq( float128, float128 );
    266 flag syst_float128_le( float128, float128 );
    267 flag syst_float128_lt( float128, float128 );
    268 flag syst_float128_eq_signaling( float128, float128 );
    269 flag syst_float128_le_quiet( float128, float128 );
    270 flag syst_float128_lt_quiet( float128, float128 );
    271 #endif
    272 
    273