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 ------------------------------------------------------*/
43 /*----- Macros provided ---------------------------------------------------*/
47 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
50 * Returns: Nonzero if @x@ is not-a-number.
54 # define NANP(x) isnan(x)
56 # define NANP(x) (!((x) == (x)))
61 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
64 * Returns: Nonzero if @x@ is infinite.
68 # define INFP(x) isinf(x)
70 # define INFP(x) ((x) > LDBL_MAX || (x) < -LDBL_MAX)
75 * Arguments: @floatish x@ = a floating-point number (evaluated multiple
78 * Returns: Nonzero if @x@ is negative. This won't give the right answer
79 * for negative zero unless the system provides explicit
84 # define NEGP(x) signbit(x)
86 # define NEGP(x) ((x) < 0)
89 /*----- Floating-point encoding and decoding ------------------------------*/
91 /*----- That's all, folks -------------------------------------------------*/