Print this page
5261 libm should stop using synonyms.h
5298 fabs is 0-sized, confuses dis(1) and others
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>
5262 libm needs to be carefully unifdef'd
5268 libm doesn't need to hide symbols which are already local
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Approved by: Gordon Ross <gwr@nexenta.com>


  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  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 #if defined(ELFOBJ)
  31 #pragma weak nearbyintf = __nearbyintf
  32 #endif
  33 
  34 #include "libm.h"
  35 #include "fenv_synonyms.h"
  36 #include <fenv.h>
  37 
  38 float
  39 __nearbyintf(float x) {
  40         union {
  41                 unsigned i;
  42                 float f;
  43         } xx;
  44         unsigned hx, sx, i, frac;
  45         int rm;
  46 
  47         xx.f = x;
  48         sx = xx.i & 0x80000000;
  49         hx = xx.i & ~0x80000000;
  50 
  51         /* handle trivial cases */
  52         if (hx >= 0x4b000000) {      /* x is nan, inf, or already integral */
  53                 if (hx > 0x7f800000) /* x is nan */
  54                         return (x * x);         /* + -> * for Cheetah */
  55                 return (x);




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  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);