Print this page
5261 libm should stop using synonyms.h


  22 /*
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 #pragma weak nearbyint = __nearbyint
  31 
  32 /*
  33  * nearbyint(x) returns the nearest fp integer to x in the direction
  34  * corresponding to the current rounding direction without raising
  35  * the inexact exception.
  36  *
  37  * nearbyint(x) is x unchanged if x is +/-0 or +/-inf.  If x is NaN,
  38  * nearbyint(x) is also NaN.
  39  */
  40 
  41 #include "libm.h"
  42 #include "fenv_synonyms.h"
  43 #include <fenv.h>
  44 
  45 double
  46 __nearbyint(double x) {
  47         union {
  48                 unsigned i[2];
  49                 double d;
  50         } xx;
  51         unsigned hx, sx, i, frac;
  52         int rm, j;
  53 
  54         xx.d = x;
  55         sx = xx.i[HIWORD] & 0x80000000;
  56         hx = xx.i[HIWORD] & ~0x80000000;
  57 
  58         /* handle trivial cases */
  59         if (hx >= 0x43300000) {      /* x is nan, inf, or already integral */
  60                 if (hx >= 0x7ff00000)        /* x is inf or nan */
  61 #if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
  62                         return (hx >= 0x7ff80000 ? x : x + x);




  22 /*
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 #pragma weak nearbyint = __nearbyint
  31 
  32 /*
  33  * nearbyint(x) returns the nearest fp integer to x in the direction
  34  * corresponding to the current rounding direction without raising
  35  * the inexact exception.
  36  *
  37  * nearbyint(x) is x unchanged if x is +/-0 or +/-inf.  If x is NaN,
  38  * nearbyint(x) is also NaN.
  39  */
  40 
  41 #include "libm.h"

  42 #include <fenv.h>
  43 
  44 double
  45 __nearbyint(double x) {
  46         union {
  47                 unsigned i[2];
  48                 double d;
  49         } xx;
  50         unsigned hx, sx, i, frac;
  51         int rm, j;
  52 
  53         xx.d = x;
  54         sx = xx.i[HIWORD] & 0x80000000;
  55         hx = xx.i[HIWORD] & ~0x80000000;
  56 
  57         /* handle trivial cases */
  58         if (hx >= 0x43300000) {      /* x is nan, inf, or already integral */
  59                 if (hx >= 0x7ff00000)        /* x is inf or nan */
  60 #if defined(FPADD_TRAPS_INCOMPLETE_ON_NAN)
  61                         return (hx >= 0x7ff80000 ? x : x + x);