3 * Mathematical utilities
5 * (c) 2023 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software: you can redistribute it and/or modify it under
13 * the terms of the GNU Library General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or (at
15 * your option) any later version.
17 * mLib is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
20 * License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib. If not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
35 /*----- Header files ------------------------------------------------------*/
39 /*----- Macros provided ---------------------------------------------------*/
43 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
46 * Returns: Nonzero if @x@ is not-a-number.
50 # define NANP(x) isnan(x)
52 # define NANP(x) (!((x) == (x)))
57 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
60 * Returns: Nonzero if @x@ is infinite.
64 # define INFP(x) isinf(x)
66 # define INFP(x) ((x) > LDBL_MAX || (x) < -LDBL_MAX)
71 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
74 * Returns: Nonzero if @x@ is negative. This won't give the right answer
75 * for negative zero unless the system provides explicit
80 # define NEGP(x) signbit(x)
82 # define NEGP(x) ((x) < 0)
85 /*----- That's all, folks -------------------------------------------------*/