mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 16:51:39 +00:00
- Cleanup the /lib directory, by putting more 3rd-party libs in /3rdparty, and by creating a new directory called /sdk where libraries which emulate the ones in the WDK are present (Such as uuid, nt, crt, etc).
- Removed lib/interlck and lib/string. - Removed math routines from lib/rtl. - Created a new library called libcntpr which is what NT/WDK use when compiling the kernel/system libraries. This is an "NT-Private" version of the CRT which is supposed to contain what we had in lib/string and lib/rtl. svn path=/trunk/; revision=26095
This commit is contained in:
parent
e4cfaf284e
commit
85985d712e
629 changed files with 27340 additions and 7038 deletions
86
reactos/lib/sdk/crt/math/modf.c
Normal file
86
reactos/lib/sdk/crt/math/modf.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/* @(#)s_modf.c 1.3 95/01/18 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Developed at SunSoft, a Sun Microsystems, Inc. business.
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
//static const double one = 1.0;
|
||||
|
||||
|
||||
|
||||
long double modfl(long double __x, long double *__i)
|
||||
{
|
||||
union
|
||||
{
|
||||
long double* __x;
|
||||
long_double_t* x;
|
||||
} x;
|
||||
union
|
||||
{
|
||||
long double* __i;
|
||||
long_double_t* iptr;
|
||||
} iptr;
|
||||
|
||||
int j0;
|
||||
unsigned int i;
|
||||
|
||||
x.__x = &__x;
|
||||
iptr.__i = __i;
|
||||
|
||||
|
||||
j0 = x.x->exponent - 0x3fff; /* exponent of x */
|
||||
|
||||
if(j0<32) { /* integer part in high x */
|
||||
if(j0<0) { /* |x|<1 */
|
||||
*__i = 0.0L;
|
||||
iptr.iptr->sign = x.x->sign;
|
||||
return __x;
|
||||
} else {
|
||||
|
||||
i = ((unsigned int)(0xffffffff))>>(j0+1);
|
||||
if ( x.x->mantissal == 0 && (x.x->mantissal & i) == 0 ) {
|
||||
*__i = __x;
|
||||
__x = 0.0L;
|
||||
x.x->sign = iptr.iptr->sign;
|
||||
return __x;
|
||||
}
|
||||
iptr.iptr->sign = x.x->sign;
|
||||
iptr.iptr->exponent = x.x->exponent;
|
||||
iptr.iptr->mantissah = x.x->mantissah&((~i));
|
||||
iptr.iptr->mantissal = 0;
|
||||
|
||||
return __x - *__i;
|
||||
}
|
||||
} else if (j0>63) { /* no fraction part */
|
||||
*__i = __x;
|
||||
if ( _isnanl(__x) || _isinfl(__x) )
|
||||
return __x;
|
||||
|
||||
__x = 0.0L;
|
||||
x.x->sign = iptr.iptr->sign;
|
||||
return __x;
|
||||
} else { /* fraction part in low x */
|
||||
|
||||
i = ((unsigned int)(0xffffffff))>>(j0-32);
|
||||
if ( x.x->mantissal == 0 ) {
|
||||
*__i = __x;
|
||||
__x = 0.0L;
|
||||
x.x->sign = iptr.iptr->sign;
|
||||
return __x;
|
||||
}
|
||||
iptr.iptr->sign = x.x->sign;
|
||||
iptr.iptr->exponent = x.x->exponent;
|
||||
iptr.iptr->mantissah = x.x->mantissah;
|
||||
iptr.iptr->mantissal = x.x->mantissal&(~i);
|
||||
|
||||
return __x - *__i;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue