update for HEAD-2003021201
[reactos.git] / lib / crtdll / math / modf.c
index 6864e52..336a7d7 100644 (file)
@@ -10,9 +10,9 @@
  * ====================================================
  */
 
-#include <crtdll/float.h>
-#include <crtdll/math.h>
-#include <crtdll/internal/ieee.h>
+#include <msvcrt/float.h>
+#include <msvcrt/math.h>
+#include <msvcrt/internal/ieee.h>
 
 
 
@@ -20,7 +20,6 @@
 
 double modf(double __x, double *__i)
 {
-
        double_t * x = (double_t *)&__x;
        double_t * iptr = ( double_t *)__i;
 
@@ -39,7 +38,7 @@ double modf(double __x, double *__i)
                                return 0.0;
                        }
 
-                       i = (0x000fffff)>>j0;
+                       i = (0x000fffff)>>j0;
                        iptr->sign = x->sign;
                        iptr->exponent = x->exponent;
                        iptr->mantissah = x->mantissah&(~i);
@@ -48,48 +47,43 @@ double modf(double __x, double *__i)
                                __x = 0.0;
                                x->sign = iptr->sign;
                                return __x;
-                       }                               
-                       return __x - *__i;        
+                       }
+                       return __x - *__i;
                }
        } else if (j0>51) {             /* no fraction part */
-                       *__i = __x;     
-                       if ( _isnan(__x) || _isinf(__x) )
-                               return __x;
-                       
-                               
-                       __x = 0.0;
-                       x->sign = iptr->sign;
+               *__i = __x;
+               if ( _isnan(__x) || _isinf(__x) )
                        return __x;
-       } else {                        /* fraction part in low x */
 
+               __x = 0.0;
+               x->sign = iptr->sign;
+               return __x;
+       } else {                        /* fraction part in low x */
 
-               i = ((unsigned)(0xffffffff))>>(j0-20);
-                       iptr->sign = x->sign;
-                       iptr->exponent = x->exponent;
-                       iptr->mantissah = x->mantissah;
-                       iptr->mantissal = x->mantissal&(~i);
-                       if ( __x == *__i ) {
-                               __x = 0.0;
-                               x->sign = iptr->sign;
-                               return __x;
-                       }
-                       return __x - *__i;        
+               i = ((unsigned)(0xffffffff))>>(j0-20);
+               iptr->sign = x->sign;
+               iptr->exponent = x->exponent;
+               iptr->mantissah = x->mantissah;
+               iptr->mantissal = x->mantissal&(~i);
+               if ( __x == *__i ) {
+                       __x = 0.0;
+                       x->sign = iptr->sign;
+                       return __x;
+               }
+               return __x - *__i;
        }
 }
 
 
 long double modfl(long double __x, long double *__i)
 {
-
-
        long_double_t * x = (long_double_t *)&__x;
        long_double_t * iptr = (long_double_t *)__i;
 
        int j0;
        unsigned int i;
        j0 = x->exponent - 0x3fff;  /* exponent of x */
-       
-       
+
        if(j0<32) {                     /* integer part in high x */
                if(j0<0) {                  /* |x|<1 */
                        *__i = 0.0L;
@@ -97,7 +91,7 @@ long double modfl(long double __x, long double *__i)
                        return __x;
                } else {
 
-                       i = ((unsigned int)(0xffffffff))>>(j0+1);                       
+                       i = ((unsigned int)(0xffffffff))>>(j0+1);
                        if ( x->mantissal == 0 && (x->mantissal & i) == 0 ) {
                                *__i =  __x;
                                __x = 0.0L;
@@ -106,36 +100,33 @@ long double modfl(long double __x, long double *__i)
                        }
                        iptr->sign = x->sign;
                        iptr->exponent = x->exponent;
-                       iptr->mantissah = x->mantissah&((~i));          
+                       iptr->mantissah = x->mantissah&((~i));
                        iptr->mantissal = 0;
                
-
-                       return __x - *__i;    
+                       return __x - *__i;
                }
        } else if (j0>63) {             /* no fraction part */
-                       *__i = __x;     
-                       if (  _isnanl(__x) ||  _isinfl(__x)  )
-                               return __x;
-                               
-                       __x = 0.0L;
-                       x->sign = iptr->sign;
+               *__i = __x;
+               if (  _isnanl(__x) ||  _isinfl(__x)  )
                        return __x;
+
+               __x = 0.0L;
+               x->sign = iptr->sign;
+               return __x;
        } else {                        /* fraction part in low x */
 
-                       i = ((unsigned int)(0xffffffff))>>(j0-32);
-                       if ( x->mantissal == 0 ) {
-                               *__i =  __x;
-                               __x = 0.0L;
-                               x->sign = iptr->sign;
-                               return __x;
-                       }
-                       iptr->sign = x->sign;
-                       iptr->exponent = x->exponent;
-                       iptr->mantissah = x->mantissah;
-                       iptr->mantissal = x->mantissal&(~i);
+               i = ((unsigned int)(0xffffffff))>>(j0-32);
+               if ( x->mantissal == 0 ) {
+                       *__i =  __x;
+                       __x = 0.0L;
+                       x->sign = iptr->sign;
+                       return __x;
+               }
+               iptr->sign = x->sign;
+               iptr->exponent = x->exponent;
+               iptr->mantissah = x->mantissah;
+               iptr->mantissal = x->mantissal&(~i);
        
-                       return __x - *__i;        
-
-
+               return __x - *__i;
        }
 }