X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-math.c;h=aa51f8581a3890389bfeea4c9d2461c6d611908f;hb=85d1b55820e902eaa52df973859282a43ac33530;hp=d78baabcb7bf1acc6acc9a3b0f92079d5429e4ab;hpb=a55c4f872c5004057f01f649978e79bb3e932415;p=gnulib.git diff --git a/tests/test-math.c b/tests/test-math.c index d78baabcb..aa51f8581 100644 --- a/tests/test-math.c +++ b/tests/test-math.c @@ -1,10 +1,10 @@ /* Test of substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2008 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + the Free Software Foundation; either version 3 of the License, 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 @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* Written by Bruno Haible , 2007. */ @@ -21,8 +20,34 @@ #include +#ifndef NAN +# error NAN should be defined +choke me +#endif + +#if 0 +/* Check that NAN expands into a constant expression. */ +static float n = NAN; +#endif + +/* Compare two numbers with ==. + This is a separate function because IRIX 6.5 "cc -O" miscompiles an + 'x == x' test. */ +static int +numeric_equal (double x, double y) +{ + return x == y; +} + int main () { + double d = NAN; + double zero = 0.0; + if (numeric_equal (d, d)) + return 1; + d = HUGE_VAL; + if (!numeric_equal (d, 1.0 / zero)) + return 1; return 0; }