Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmodf.c
Go to the documentation of this file.
00001 /* @(#)s_modf.c 1.3 95/01/18 */ 00002 /* 00003 * ==================================================== 00004 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 00005 * 00006 * Developed at SunSoft, a Sun Microsystems, Inc. business. 00007 * Permission to use, copy, modify, and distribute this 00008 * software is freely granted, provided that this notice 00009 * is preserved. 00010 * ==================================================== 00011 */ 00012 #define modfl _dummy_modfl 00013 #include <precomp.h> 00014 #undef modfl 00015 00016 //static const double one = 1.0; 00017 00018 00019 00020 long double modfl(long double __x, long double *__i) 00021 { 00022 union 00023 { 00024 long double* __x; 00025 long_double_s* x; 00026 } x; 00027 union 00028 { 00029 long double* __i; 00030 long_double_s* iptr; 00031 } iptr; 00032 00033 int j0; 00034 unsigned int i; 00035 00036 x.__x = &__x; 00037 iptr.__i = __i; 00038 00039 00040 j0 = x.x->exponent - 0x3fff; /* exponent of x */ 00041 00042 if(j0<32) { /* integer part in high x */ 00043 if(j0<0) { /* |x|<1 */ 00044 *__i = 0.0L; 00045 iptr.iptr->sign = x.x->sign; 00046 return __x; 00047 } else { 00048 00049 i = ((unsigned int)(0xffffffff))>>(j0+1); 00050 if ( x.x->mantissal == 0 && (x.x->mantissal & i) == 0 ) { 00051 *__i = __x; 00052 __x = 0.0L; 00053 x.x->sign = iptr.iptr->sign; 00054 return __x; 00055 } 00056 iptr.iptr->sign = x.x->sign; 00057 iptr.iptr->exponent = x.x->exponent; 00058 iptr.iptr->mantissah = x.x->mantissah&((~i)); 00059 iptr.iptr->mantissal = 0; 00060 00061 return __x - *__i; 00062 } 00063 } else if (j0>63) { /* no fraction part */ 00064 *__i = __x; 00065 if ( _isnanl(__x) || _isinfl(__x) ) 00066 return __x; 00067 00068 __x = 0.0L; 00069 x.x->sign = iptr.iptr->sign; 00070 return __x; 00071 } else { /* fraction part in low x */ 00072 00073 i = ((unsigned int)(0xffffffff))>>(j0-32); 00074 if ( x.x->mantissal == 0 ) { 00075 *__i = __x; 00076 __x = 0.0L; 00077 x.x->sign = iptr.iptr->sign; 00078 return __x; 00079 } 00080 iptr.iptr->sign = x.x->sign; 00081 iptr.iptr->exponent = x.x->exponent; 00082 iptr.iptr->mantissah = x.x->mantissah; 00083 iptr.iptr->mantissal = x.x->mantissal&(~i); 00084 00085 return __x - *__i; 00086 } 00087 } Generated on Sat May 26 2012 04:35:27 for ReactOS by
1.7.6.1
|