From ea0bbb48b37dc43c3a1cec4e87ed7049e13b4ff9 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 14 Jan 2018 21:41:21 -0600 Subject: math: Clean up, add additional functions * Add finite() variants, needed by some applications. * Add remaining long double variants of existing functions. * Sort and document existing functions, including where referenced in the LSB standard. Signed-off-by: Samuel Holland --- libgcompat/math.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 80 insertions(+), 11 deletions(-) diff --git a/libgcompat/math.c b/libgcompat/math.c index 2982116..db123f8 100644 --- a/libgcompat/math.c +++ b/libgcompat/math.c @@ -1,27 +1,96 @@ -#include /* isinf, isnan */ +#include /* isfinite, isinf, isnan */ #include "alias.h" /* weak_alias */ -int __isinff(float number) +/** + * Test for finite value. + */ +int __finite(double arg) { - return isinf(number); + return isfinite(arg); } -weak_alias(__isinff, isinff); +weak_alias(__finite, finite); + +/** + * Test for finite value. + */ +int __finitef(float arg) +{ + return isfinite(arg); +} +weak_alias(__finitef, finitef); + +/** + * Test for finite value. + */ +int __finitel(long double arg) +{ + return isfinite(arg); +} +weak_alias(__finitel, finitel); -int __isinf(double number) +/** + * Test for infinity. + * + * LSB 5.0: LSB-Core-generic/baselib---isinf.html + */ +int __isinf(double arg) { - return isinf(number); + return isinf(arg); } weak_alias(__isinf, isinf); -int __isnanf(float number) +/** + * Test for infinity. + * + * LSB 5.0: LSB-Core-generic/baselib---isinff.html + */ +int __isinff(float arg) { - return isnan(number); + return isinf(arg); } -weak_alias(__isnanf, isnanf); +weak_alias(__isinff, isinff); -int __isnan(double number) +/** + * Test for infinity. + * + * LSB 5.0: LSB-Core-generic/baselib---isinfl.html + */ +int __isinfl(long double arg) { - return isnan(number); + return isinf(arg); +} +weak_alias(__isinfl, isinfl); + +/** + * Test for a NaN. + * + * LSB 5.0: LSB-Core-generic/baselib---isnan.html + */ +int __isnan(double arg) +{ + return isnan(arg); } weak_alias(__isnan, isnan); + +/** + * Test for a NaN. + * + * LSB 5.0: LSB-Core-generic/baselib---isnanf.html + */ +int __isnanf(float arg) +{ + return isnan(arg); +} +weak_alias(__isnanf, isnanf); + +/** + * Test for a NaN. + * + * LSB 5.0: LSB-Core-generic/baselib---isnanl.html + */ +int __isnanl(long double arg) +{ + return isnan(arg); +} +weak_alias(__isnanl, isnanl); -- cgit v1.2.3-70-g09d2