Blame sysdeps/ieee754/flt-32/s_issignalingf.c

Packit Service 82fcde
/* Test for signaling NaN.
Packit Service 82fcde
   Copyright (C) 2013-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <math.h>
Packit Service 82fcde
#include <math_private.h>
Packit Service 82fcde
#include <nan-high-order-bit.h>
Packit Service 82fcde
Packit Service 82fcde
int
Packit Service 82fcde
__issignalingf (float x)
Packit Service 82fcde
{
Packit Service 82fcde
  uint32_t xi;
Packit Service 82fcde
  GET_FLOAT_WORD (xi, x);
Packit Service 82fcde
#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
Packit Service 82fcde
  /* We only have to care about the high-order bit of x's significand, because
Packit Service 82fcde
     having it set (sNaN) already makes the significand different from that
Packit Service 82fcde
     used to designate infinity.  */
Packit Service 82fcde
  return (xi & 0x7fc00000) == 0x7fc00000;
Packit Service 82fcde
#else
Packit Service 82fcde
  /* To keep the following comparison simple, toggle the quiet/signaling bit,
Packit Service 82fcde
     so that it is set for sNaNs.  This is inverse to IEEE 754-2008 (as well as
Packit Service 82fcde
     common practice for IEEE 754-1985).  */
Packit Service 82fcde
  xi ^= 0x00400000;
Packit Service 82fcde
  /* We have to compare for greater (instead of greater or equal), because x's
Packit Service 82fcde
     significand being all-zero designates infinity not NaN.  */
Packit Service 82fcde
  return (xi & 0x7fffffff) > 0x7fc00000;
Packit Service 82fcde
#endif
Packit Service 82fcde
}
Packit Service 82fcde
libm_hidden_def (__issignalingf)