Author: pschweitzer
Date: Sat Nov 19 19:01:58 2011
New Revision: 54447
URL:
http://svn.reactos.org/svn/reactos?rev=54447&view=rev
Log:
[CRT]
Check for NaN and set error accordingly
Modified:
trunk/reactos/lib/sdk/crt/math/i386/ldexp.c
Modified: trunk/reactos/lib/sdk/crt/math/i386/ldexp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/ldex…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/i386/ldexp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/i386/ldexp.c [iso-8859-1] Sat Nov 19 19:01:58 2011
@@ -19,11 +19,22 @@
Boston, MA 02110-1301, USA.
*/
+#include <precomp.h>
#include <math.h>
+#include <float.h>
double ldexp (double value, int exp)
{
register double result;
+
+ /* Check for value correctness
+ * and set errno if required
+ */
+ if (_isnan(value))
+ {
+ errno = EDOM;
+ }
+
#ifdef __GNUC__
#if defined(__clang__)
asm ("fild %[exp]\n"
@@ -33,20 +44,20 @@
: [value] "0" (value), [exp] "m" (exp));
#else
asm ("fscale"
- : "=t" (result)
+ : "=t" (result)
: "0" (value), "u" ((double)exp)
: "1");
#endif
#else /* !__GNUC__ */
- register double __dy = (double)exp;
- __asm
- {
- fld __dy
- fld value
- fscale
- fstp result
- }
+ register double __dy = (double)exp;
+ __asm
+ {
+ fld __dy
+ fld value
+ fscale
+ fstp result
+ }
#endif /* !__GNUC__ */
- return result;
+ return result;
}