Print this page
5261 libm should stop using synonyms.h


  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  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 nearbyintf = __nearbyintf
  31 
  32 #include "libm.h"
  33 #include "fenv_synonyms.h"
  34 #include <fenv.h>
  35 
  36 float
  37 __nearbyintf(float x) {
  38         union {
  39                 unsigned i;
  40                 float f;
  41         } xx;
  42         unsigned hx, sx, i, frac;
  43         int rm;
  44 
  45         xx.f = x;
  46         sx = xx.i & 0x80000000;
  47         hx = xx.i & ~0x80000000;
  48 
  49         /* handle trivial cases */
  50         if (hx >= 0x4b000000) {      /* x is nan, inf, or already integral */
  51                 if (hx > 0x7f800000) /* x is nan */
  52                         return (x * x);         /* + -> * for Cheetah */
  53                 return (x);




  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  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 nearbyintf = __nearbyintf
  31 
  32 #include "libm.h"

  33 #include <fenv.h>
  34 
  35 float
  36 __nearbyintf(float x) {
  37         union {
  38                 unsigned i;
  39                 float f;
  40         } xx;
  41         unsigned hx, sx, i, frac;
  42         int rm;
  43 
  44         xx.f = x;
  45         sx = xx.i & 0x80000000;
  46         hx = xx.i & ~0x80000000;
  47 
  48         /* handle trivial cases */
  49         if (hx >= 0x4b000000) {      /* x is nan, inf, or already integral */
  50                 if (hx > 0x7f800000) /* x is nan */
  51                         return (x * x);         /* + -> * for Cheetah */
  52                 return (x);