/* @(#)e_fmod.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <LibConfig.h>
#include <sys/EfiCdefs.h>
#endif
/*
* __ieee754_fmod(x,y)
* Return x mod y in exact arithmetic
* Method: shift and subtract
*/
#include "math.h"
#include "math_private.h"
#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
// unary minus operator applied to unsigned type, result still unsigned
#endif
double
__ieee754_fmod(double x, double y)
{
/* purge off exception values */
return (x*y)/(x*y);
}
/* determine ix = ilogb(x) */
if(hx==0) {
} else {
}
/* determine iy = ilogb(y) */
if(hy==0) {
} else {
}
/* set up {hx,lx}, {hy,ly} and align y to x */
if(ix >= -1022)
else { /* subnormal x, shift x to normal */
n = -1022-ix;
if(n<=31) {
lx <<= n;
} else {
lx = 0;
}
}
if(iy >= -1022)
else { /* subnormal y, shift y to normal */
n = -1022-iy;
if(n<=31) {
ly <<= n;
} else {
ly = 0;
}
}
/* fix point fmod */
while(n--) {
else {
}
}
/* convert back to floating value and restore the sign */
iy -= 1;
}
} else { /* subnormal output */
n = -1022 - iy;
if(n<=20) {
hx >>= n;
} else if (n<=31) {
} else {
}
x *= one; /* create necessary signal */
}
return x; /* exact output */
}