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