_isnan.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 36a7e80f..809653a7 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -395,10 +395,6 @@ check_function_exists( setgroups HAVE_SETGROUPS )
  6. check_function_exists( setlocale HAVE_SETLOCALE )
  7. check_function_exists( setmntent HAVE_SETMNTENT )
  8. check_function_exists( setpriority HAVE_SETPRIORITY )
  9. -check_function_exists( isnan HAVE_FUNC_ISNAN )
  10. -check_function_exists( _finite HAVE_FUNC__FINITE )
  11. -check_function_exists( finite HAVE_FUNC_FINITE )
  12. -check_function_exists( isinf HAVE_FUNC_ISINF )
  13. check_function_exists( freeaddrinfo HAVE_FREEADDRINFO )
  14. check_function_exists( strtoll HAVE_STRTOLL )
  15. check_function_exists( socket HAVE_SOCKET )
  16. diff --git a/config.h.cmake b/config.h.cmake
  17. index 5ee6f156..49b68998 100644
  18. --- a/config.h.cmake
  19. +++ b/config.h.cmake
  20. @@ -212,18 +212,6 @@
  21. /* Define to 1 if you have the <fstab.h> header file. */
  22. #cmakedefine HAVE_FSTAB_H 1
  23. -/* Define if you have finite */
  24. -#cmakedefine HAVE_FUNC_FINITE 1
  25. -
  26. -/* Define if you have isinf */
  27. -#cmakedefine HAVE_FUNC_ISINF 1
  28. -
  29. -/* Define if you have isnan */
  30. -#cmakedefine HAVE_FUNC_ISNAN 1
  31. -
  32. -/* Define if you have _finite */
  33. -#cmakedefine HAVE_FUNC__FINITE 1
  34. -
  35. /* Define to 1 if you have the `gai_strerror' function. */
  36. #cmakedefine HAVE_GAI_STRERROR 1
  37. diff --git a/kjs/configure.in.in b/kjs/configure.in.in
  38. index fd23612e..1c4d3ac5 100644
  39. --- a/kjs/configure.in.in
  40. +++ b/kjs/configure.in.in
  41. @@ -1,46 +1,6 @@
  42. dnl KDE JavaScript specific configure tests
  43. AC_CHECK_HEADERS(ieeefp.h float.h)
  44. -AC_CHECK_LIB(m, finite, [
  45. - AC_DEFINE_UNQUOTED(HAVE_FUNC_FINITE, 1, [Define if you have finite])
  46. -])
  47. -AC_CHECK_LIB(m, _finite, [
  48. - AC_DEFINE_UNQUOTED(HAVE_FUNC__FINITE, 1, [Define if you have _finite])
  49. -])
  50. -
  51. -dnl The C99 standard says that isinf and isnan are macros, but they might
  52. -dnl be functions on some platforms.
  53. -AC_DEFUN([AC_CHECK_ISNAN],
  54. -[
  55. - ac_save_libs="$LIBS"
  56. - LIBS="-lm"
  57. - AC_MSG_CHECKING([for isnan with <math.h>])
  58. - AC_TRY_LINK(
  59. - [#include <math.h>
  60. - float f;], [return isnan(f)],
  61. - [AC_MSG_RESULT(yes)
  62. - AC_DEFINE([HAVE_FUNC_ISNAN], [1], [Define if you have isnan])],
  63. - AC_MSG_RESULT(no)
  64. - )
  65. - LIBS="$ac_save_libs"
  66. -])
  67. -AC_DEFUN([AC_CHECK_ISINF],
  68. -[
  69. - ac_save_libs="$LIBS"
  70. - LIBS="-lm"
  71. - AC_MSG_CHECKING([for isinf with <math.h>])
  72. - AC_TRY_LINK(
  73. - [#include <math.h>
  74. - float f;], [return isinf(f)],
  75. - [AC_MSG_RESULT(yes)
  76. - AC_DEFINE([HAVE_FUNC_ISINF], [1], [Define if you have isinf])],
  77. - AC_MSG_RESULT(no)
  78. - )
  79. - LIBS="$ac_save_libs"
  80. -])
  81. -
  82. -AC_CHECK_ISNAN
  83. -AC_CHECK_ISINF
  84. AC_DEFUN([AC_CHECK_PCREPOSIX],
  85. [
  86. diff --git a/kjs/operations.cpp b/kjs/operations.cpp
  87. index 63c1e669..b9314ecc 100644
  88. --- a/kjs/operations.cpp
  89. +++ b/kjs/operations.cpp
  90. @@ -25,7 +25,6 @@
  91. #endif
  92. #ifndef HAVE_FLOAT_H /* just for !Windows */
  93. #define HAVE_FLOAT_H 0
  94. -#define HAVE_FUNC__FINITE 0
  95. #endif
  96. #include <stdio.h>
  97. @@ -38,11 +37,9 @@
  98. #include <sunmath.h>
  99. #endif
  100. -#ifndef HAVE_FUNC_ISINF
  101. #ifdef HAVE_IEEEFP_H
  102. #include <ieeefp.h>
  103. #endif
  104. -#endif /* HAVE_FUNC_ISINF */
  105. #if HAVE_FLOAT_H
  106. #include <float.h>
  107. @@ -55,52 +52,22 @@ using namespace KJS;
  108. bool KJS::isNaN(double d)
  109. {
  110. -#ifdef HAVE_FUNC_ISNAN
  111. return isnan(d);
  112. -#elif defined HAVE_FLOAT_H
  113. - return _isnan(d) != 0;
  114. -#else
  115. - return !(d == d);
  116. -#endif
  117. }
  118. bool KJS::isInf(double d)
  119. {
  120. -#if defined(HAVE_FUNC_ISINF)
  121. return isinf(d);
  122. -#elif HAVE_FUNC_FINITE
  123. - return finite(d) == 0 && d == d;
  124. -#elif HAVE_FUNC__FINITE
  125. - return _finite(d) == 0 && d == d;
  126. -#else
  127. - return false;
  128. -#endif
  129. }
  130. bool KJS::isPosInf(double d)
  131. {
  132. -#if defined(HAVE_FUNC_ISINF)
  133. - return (isinf(d) == 1);
  134. -#elif HAVE_FUNC_FINITE
  135. - return finite(d) == 0 && d == d; // ### can we distinguish between + and - ?
  136. -#elif HAVE_FUNC__FINITE
  137. - return _finite(d) == 0 && d == d; // ###
  138. -#else
  139. - return false;
  140. -#endif
  141. + return ( isinf(d) && d > 0 );
  142. }
  143. bool KJS::isNegInf(double d)
  144. {
  145. -#if defined(HAVE_FUNC_ISINF)
  146. - return (isinf(d) == -1);
  147. -#elif HAVE_FUNC_FINITE
  148. - return finite(d) == 0 && d == d; // ###
  149. -#elif HAVE_FUNC__FINITE
  150. - return _finite(d) == 0 && d == d; // ###
  151. -#else
  152. - return false;
  153. -#endif
  154. + return ( isinf(d) && d < 0 );
  155. }
  156. // ECMA 11.9.3