Blame sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c

Packit Service 73c603
/* Test sinl for pseudo-zeros and unnormals for ldbl-96 (bug 25487).
Packit Service 73c603
   Copyright (C) 2020 Free Software Foundation, Inc.
Packit Service 73c603
   This file is part of the GNU C Library.
Packit Service 73c603
Packit Service 73c603
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 73c603
   modify it under the terms of the GNU Lesser General Public
Packit Service 73c603
   License as published by the Free Software Foundation; either
Packit Service 73c603
   version 2.1 of the License, or (at your option) any later version.
Packit Service 73c603
Packit Service 73c603
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 73c603
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 73c603
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 73c603
   Lesser General Public License for more details.
Packit Service 73c603
Packit Service 73c603
   You should have received a copy of the GNU Lesser General Public
Packit Service 73c603
   License along with the GNU C Library; if not, see
Packit Service 73c603
   <https://www.gnu.org/licenses/>.  */
Packit Service 73c603
Packit Service 73c603
#include <math.h>
Packit Service 73c603
#include <math_ldbl.h>
Packit Service 73c603
#include <stdint.h>
Packit Service 73c603
Packit Service 73c603
static int
Packit Service 73c603
do_test (void)
Packit Service 73c603
{
Packit Service 73c603
  for (int i = 0; i < 64; i++)
Packit Service 73c603
    {
Packit Service 73c603
      uint64_t sig = i == 63 ? 0 : 1ULL << i;
Packit Service 73c603
      long double ld;
Packit Service 73c603
      SET_LDOUBLE_WORDS (ld, 0x4141,
Packit Service 73c603
                        sig >> 32, sig & 0xffffffffULL);
Packit Service 73c603
      /* The requirement is that no stack overflow occurs when the
Packit Service 73c603
        pseudo-zero or unnormal goes through range reduction.  */
Packit Service 73c603
      volatile long double ldr;
Packit Service 73c603
      ldr = sinl (ld);
Packit Service 73c603
      (void) ldr;
Packit Service 73c603
    }
Packit Service 73c603
  return 0;
Packit Service 73c603
}
Packit Service 73c603
Packit Service 73c603
#include <support/test-driver.c>