Blame sysdeps/m68k/m680x0/fpu/s_logbl.c

Packit 6c4009
/* s_logbl.c -- long double version of s_logb.c.
Packit 6c4009
 * Conversion to long double by Ulrich Drepper,
Packit 6c4009
 * Cygnus Support, drepper@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
/*
Packit 6c4009
 * long double logbl(x)
Packit 6c4009
 * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
Packit 6c4009
 * Use ilogb instead.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <math.h>
Packit 6c4009
#include <math_private.h>
Packit 6c4009
Packit 6c4009
long double
Packit 6c4009
__logbl (long double x)
Packit 6c4009
{
Packit 6c4009
  int32_t es, lx, ix;
Packit 6c4009
Packit 6c4009
  GET_LDOUBLE_WORDS (es, ix, lx, x);
Packit 6c4009
  es &= 0x7fff;			/* exponent */
Packit 6c4009
  if ((es | ix | lx) == 0)
Packit 6c4009
    return -1.0 / fabsl (x);
Packit 6c4009
  if (es == 0x7fff)
Packit 6c4009
    return x * x;
Packit 6c4009
  if (es == 0)			/* IEEE 754 logb */
Packit 6c4009
    {
Packit 6c4009
      /* POSIX specifies that denormal number is treated as
Packit 6c4009
         though it were normalized.  */
Packit 6c4009
      if (ix == 0)
Packit 6c4009
	es = -(__builtin_clz (lx) + 32);
Packit 6c4009
      else
Packit 6c4009
	es = -__builtin_clz (ix);
Packit 6c4009
    }
Packit 6c4009
  return (long double) (es - 16383);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
weak_alias (__logbl, logbl)