Home | History | Annotate | Download | only in machine
      1 /*  $NetBSD: fenv.h,v 1.2 2014/01/29 00:22:09 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_FENV_H_
     21 #define _ARM_FENV_H_
     22 
     23 #ifdef __ARM_PCS_AAPCS64
     24 /* AArch64 split FPSCR into two registers FPCR and FPSR */
     25 typedef struct {
     26     unsigned int __fpcr;
     27     unsigned int __fpsr;
     28 } fenv_t;
     29 #else
     30 typedef int fenv_t;     /* FPSCR */
     31 #endif
     32 typedef int fexcept_t;
     33 
     34 #define FE_INVALID      0x01    /* invalid operation exception */
     35 #define FE_DIVBYZERO    0x02    /* divide-by-zero exception */
     36 #define FE_OVERFLOW     0x04    /* overflow exception */
     37 #define FE_UNDERFLOW    0x08    /* underflow exception */
     38 #define FE_INEXACT      0x10    /* imprecise (loss of precision; "inexact") */
     39 
     40 #define FE_ALL_EXCEPT   0x1f
     41 
     42 #define FE_TONEAREST    0   /* round to nearest representable number */
     43 #define FE_UPWARD       1   /* round toward positive infinity */
     44 #define FE_DOWNWARD     2   /* round toward negative infinity */
     45 #define FE_TOWARDZERO   3   /* round to zero (truncate) */
     46 
     47 __BEGIN_DECLS
     48 
     49 /* Default floating-point environment */
     50 extern const fenv_t   __fe_dfl_env;
     51 #define FE_DFL_ENV    (&__fe_dfl_env)
     52 
     53 __END_DECLS
     54 
     55 #endif /* _ARM_FENV_H_ */
     56