You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
388 B

#include <soft.h>
/* Stores binary exponent of d in e, and returns whole fraction of d
* (with binary exponent of 0) (special case for d=0)
*/
double frexp(double d, int *e)
{
struct bitdouble *dp = (struct bitdouble *)&d;
if (dp->exp == 0) /* value is zero, return exponent of 0 */
*e = 0;
else {
*e = dp->exp - BIAS + 1;
dp->exp = BIAS - 1;
}
return d;
}