Home | History | Annotate | Download | only in machine
      1 /*  $NetBSD: ieeefp.h,v 1.3 2013/04/23 05:42:23 matt Exp $  */
      2 /** @file
      3 *
      4 *  Copyright (c) 2013 - 2014, ARM Limited. All rights reserved.
      5 *
      6 *  This program and the accompanying materials
      7 *  are licensed and made available under the terms and conditions of the BSD License
      8 *  which accompanies this distribution.  The full text of the license may be found at
      9 *  http://opensource.org/licenses/bsd-license.php
     10 *
     11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 *
     14 **/
     15 /*
     16  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
     17  * Public domain.
     18  */
     19 
     20 #ifndef _ARM_IEEEFP_H_
     21 #define _ARM_IEEEFP_H_
     22 
     23 #include <LibConfig.h>
     24 #include <sys/featuretest.h>
     25 
     26 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
     27 
     28 //#include <arm/fenv.h>
     29 #include <machine/fenv.h>
     30 
     31 #if !defined(_ISOC99_SOURCE)
     32 
     33 /* Exception type (used by fpsetmask() et al.) */
     34 
     35 typedef int fp_except;
     36 
     37 /* Bit defines for fp_except */
     38 
     39 #define FP_X_INV    FE_INVALID      /* invalid operation exception */
     40 #define FP_X_DZ     FE_DIVBYZERO    /* divide-by-zero exception */
     41 #define FP_X_OFL    FE_OVERFLOW     /* overflow exception */
     42 #define FP_X_UFL    FE_UNDERFLOW    /* underflow exception */
     43 #define FP_X_IMP    FE_INEXACT      /* imprecise (prec. loss; "inexact") */
     44 
     45 /* Rounding modes */
     46 
     47 typedef enum {
     48     FP_RN=FE_TONEAREST,     /* round to nearest representable number */
     49     FP_RP=FE_UPWARD,        /* round toward positive infinity */
     50     FP_RM=FE_DOWNWARD,      /* round toward negative infinity */
     51     FP_RZ=FE_TOWARDZERO     /* round to zero (truncate) */
     52 } fp_rnd;
     53 
     54 #endif /* !_ISOC99_SOURCE */
     55 
     56 #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
     57 
     58 #endif /* _ARM_IEEEFP_H_ */
     59