summaryrefslogtreecommitdiffstats
path: root/kjs/operations.cpp
diff options
context:
space:
mode:
authorMatías Fonzo <[email protected]>2020-01-21 21:56:02 -0300
committerSlávek Banko <[email protected]>2020-01-23 00:04:23 +0100
commit53d42e24728cd7ef3949fcb0bd62ed05f254c588 (patch)
tree855f5c9f7951211157768868408c3aa2a46da940 /kjs/operations.cpp
parentf109868e22a301799fe2210317d659b54f483a4b (diff)
downloadtdelibs-53d42e24728cd7ef3949fcb0bd62ed05f254c588.tar.gz
tdelibs-53d42e24728cd7ef3949fcb0bd62ed05f254c588.zip
Use the correct macros isnan, isinf for libc compatibility
Changes related to this commit: - Clean up #if mess. - Use unconditionally the correct macros isnan, isinf. - Remove redudant macros from the build system. Signed-off-by: Matías Fonzo <[email protected]> (cherry picked from commit 8ae17a5d9d77d489a2d16529f16680d31374537e)
Diffstat (limited to 'kjs/operations.cpp')
-rw-r--r--kjs/operations.cpp37
1 files changed, 2 insertions, 35 deletions
diff --git a/kjs/operations.cpp b/kjs/operations.cpp
index 63c1e669e..b9314eccb 100644
--- a/kjs/operations.cpp
+++ b/kjs/operations.cpp
@@ -25,7 +25,6 @@
#endif
#ifndef HAVE_FLOAT_H /* just for !Windows */
#define HAVE_FLOAT_H 0
-#define HAVE_FUNC__FINITE 0
#endif
#include <stdio.h>
@@ -38,11 +37,9 @@
#include <sunmath.h>
#endif
-#ifndef HAVE_FUNC_ISINF
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
-#endif /* HAVE_FUNC_ISINF */
#if HAVE_FLOAT_H
#include <float.h>
@@ -55,52 +52,22 @@ using namespace KJS;
bool KJS::isNaN(double d)
{
-#ifdef HAVE_FUNC_ISNAN
return isnan(d);
-#elif defined HAVE_FLOAT_H
- return _isnan(d) != 0;
-#else
- return !(d == d);
-#endif
}
bool KJS::isInf(double d)
{
-#if defined(HAVE_FUNC_ISINF)
return isinf(d);
-#elif HAVE_FUNC_FINITE
- return finite(d) == 0 && d == d;
-#elif HAVE_FUNC__FINITE
- return _finite(d) == 0 && d == d;
-#else
- return false;
-#endif
}
bool KJS::isPosInf(double d)
{
-#if defined(HAVE_FUNC_ISINF)
- return (isinf(d) == 1);
-#elif HAVE_FUNC_FINITE
- return finite(d) == 0 && d == d; // ### can we distinguish between + and - ?
-#elif HAVE_FUNC__FINITE
- return _finite(d) == 0 && d == d; // ###
-#else
- return false;
-#endif
+ return ( isinf(d) && d > 0 );
}
bool KJS::isNegInf(double d)
{
-#if defined(HAVE_FUNC_ISINF)
- return (isinf(d) == -1);
-#elif HAVE_FUNC_FINITE
- return finite(d) == 0 && d == d; // ###
-#elif HAVE_FUNC__FINITE
- return _finite(d) == 0 && d == d; // ###
-#else
- return false;
-#endif
+ return ( isinf(d) && d < 0 );
}
// ECMA 11.9.3