isinf.c 1.01 KB
Newer Older
Ben Pfaff's avatar
Ben Pfaff committed
1
/* Test for positive or negative infinity.
Paul Eggert's avatar
Paul Eggert committed
2
   Copyright (C) 2007-2016 Free Software Foundation, Inc.
Ben Pfaff's avatar
Ben Pfaff committed
3 4 5 6 7 8 9 10 11 12 13 14

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along
15
   with this program; if not, see <http://www.gnu.org/licenses/>.  */
Ben Pfaff's avatar
Ben Pfaff committed
16 17 18 19 20 21 22

/* Written by Ben Pfaff <blp@gnu.org>, 2008. */

#include <config.h>

#include <float.h>

Bruno Haible's avatar
Bruno Haible committed
23 24
int
gl_isinff (float x)
Ben Pfaff's avatar
Ben Pfaff committed
25 26 27 28
{
  return x < -FLT_MAX || x > FLT_MAX;
}

Bruno Haible's avatar
Bruno Haible committed
29 30
int
gl_isinfd (double x)
Ben Pfaff's avatar
Ben Pfaff committed
31 32 33 34
{
  return x < -DBL_MAX || x > DBL_MAX;
}

Bruno Haible's avatar
Bruno Haible committed
35 36
int
gl_isinfl (long double x)
Ben Pfaff's avatar
Ben Pfaff committed
37 38 39
{
  return x < -LDBL_MAX || x > LDBL_MAX;
}