Author: pschweitzer
Date: Wed Nov 30 22:04:54 2011
New Revision: 54552
URL:
http://svn.reactos.org/svn/reactos?rev=54552&view=rev
Log:
[CRT]
Fix error handling for j0, j1, y0, y1 Bessel functions.
Remove useless defines
Modified:
trunk/reactos/lib/sdk/crt/math/j0_y0.c
trunk/reactos/lib/sdk/crt/math/j1_y1.c
Modified: trunk/reactos/lib/sdk/crt/math/j0_y0.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/j0_y0.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/j0_y0.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/j0_y0.c [iso-8859-1] Wed Nov 30 22:04:54 2011
@@ -2,8 +2,6 @@
#include <float.h>
#include "ieee754/ieee754.h"
-typedef int fpclass_t;
-fpclass_t _fpclass(double __d);
int *_errno(void);
/*
@@ -11,7 +9,7 @@
*/
double _j0(double num)
{
- /* FIXME: errno handling */
+ if (!_finite(num)) *_errno() = EDOM;
return __ieee754_j0(num);
}
@@ -21,7 +19,12 @@
double _y0(double num)
{
double retval;
- if (!_finite(num)) *_errno() = EDOM;
+ int fpclass = _fpclass(num);
+
+ if (!_finite(num) || fpclass == _FPCLASS_NN ||
+ fpclass == _FPCLASS_ND || fpclass == _FPCLASS_NZ)
+ *_errno() = EDOM;
+
retval = __ieee754_y0(num);
if (_fpclass(retval) == _FPCLASS_NINF)
{
Modified: trunk/reactos/lib/sdk/crt/math/j1_y1.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/j1_y1.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/j1_y1.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/j1_y1.c [iso-8859-1] Wed Nov 30 22:04:54 2011
@@ -2,8 +2,6 @@
#include <float.h>
#include "ieee754/ieee754.h"
-typedef int fpclass_t;
-fpclass_t _fpclass(double __d);
int *_errno(void);
/*
@@ -11,7 +9,7 @@
*/
double _j1(double num)
{
- /* FIXME: errno handling */
+ if (!_finite(num)) *_errno() = EDOM;
return __ieee754_j1(num);
}
@@ -21,7 +19,12 @@
double _y1(double num)
{
double retval;
- if (!_finite(num)) *_errno() = EDOM;
+ int fpclass = _fpclass(num);
+
+ if (!_finite(num) || fpclass == _FPCLASS_NN ||
+ fpclass == _FPCLASS_ND || fpclass == _FPCLASS_NZ)
+ *_errno() = EDOM;
+
retval = __ieee754_y1(num);
if (_fpclass(retval) == _FPCLASS_NINF)
{