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