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