-/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv.h>
#include <math.h>
#include <math_private.h>
invalid_fn (long double x, long double fn)
{
if (__rintl (fn) != fn)
- {
- feraiseexcept (FE_INVALID);
- return __nan ("");
- }
+ return (fn - fn) / (fn - fn);
else if (fn > 65000.0L)
return __scalbnl (x, 65000);
else
long double
__ieee754_scalbl (long double x, long double fn)
{
- if (__builtin_expect (__isnanl (x), 0))
+ if (__glibc_unlikely (isnan (x)))
return x * fn;
- if (__builtin_expect (!__finitel (fn), 0))
+ if (__glibc_unlikely (!isfinite (fn)))
{
- if (__isnanl (fn) || fn > 0.0L)
+ if (isnan (fn) || fn > 0.0L)
return x * fn;
if (x == 0.0L)
return x;
return x / -fn;
}
- if (__builtin_expect ((long double) (int) fn != fn, 0))
+ if (__glibc_unlikely (fabsl (fn) >= 0x1p31L || (long double) (int) fn != fn))
return invalid_fn (x, fn);
return __scalbnl (x, (int) fn);