Blame sysdeps/ieee754/flt-32/s_logbf.c
|
Packit |
6c4009 |
/* s_logbf.c -- float version of s_logb.c.
|
|
Packit |
6c4009 |
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
Packit |
6c4009 |
*
|
|
Packit |
6c4009 |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
Packit |
6c4009 |
* Permission to use, copy, modify, and distribute this
|
|
Packit |
6c4009 |
* software is freely granted, provided that this notice
|
|
Packit |
6c4009 |
* is preserved.
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <math.h>
|
|
Packit |
6c4009 |
#include <math_private.h>
|
|
Packit |
6c4009 |
#include <libm-alias-float.h>
|
|
Packit |
6c4009 |
#include <fix-int-fp-convert-zero.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
float
|
|
Packit |
6c4009 |
__logbf (float x)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int32_t ix, rix;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
GET_FLOAT_WORD (ix, x);
|
|
Packit |
6c4009 |
ix &= 0x7fffffff; /* high |x| */
|
|
Packit |
6c4009 |
if (ix == 0)
|
|
Packit |
6c4009 |
return (float) -1.0 / fabsf (x);
|
|
Packit |
6c4009 |
if (ix >= 0x7f800000)
|
|
Packit |
6c4009 |
return x * x;
|
|
Packit |
6c4009 |
if (__glibc_unlikely ((rix = ix >> 23) == 0))
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* POSIX specifies that denormal number is treated as
|
|
Packit |
6c4009 |
though it were normalized. */
|
|
Packit |
6c4009 |
rix -= __builtin_clz (ix) - 9;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
if (FIX_INT_FP_CONVERT_ZERO && rix == 127)
|
|
Packit |
6c4009 |
return 0.0f;
|
|
Packit |
6c4009 |
return (float) (rix - 127);
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
libm_alias_float (__logb, logb)
|