forked from KolibriOS/kolibrios
libc.obj:
- Formatted by clang-format (WebKit-style). - Removed unnecessary errno linux. - Added KOS error codes. - String functions have been replaced with more optimal ones for x86. - Changed wrappers for 70 sysfunction. git-svn-id: svn://kolibrios.org@9765 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,26 +1,25 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
frexp(double x, int *exptr)
|
||||
double frexp(double x, int* exptr)
|
||||
{
|
||||
union {
|
||||
double d;
|
||||
unsigned char c[8];
|
||||
} u;
|
||||
union {
|
||||
double d;
|
||||
unsigned char c[8];
|
||||
} u;
|
||||
|
||||
u.d = x;
|
||||
/*
|
||||
* The format of the number is:
|
||||
* Sign, 12 exponent bits, 51 mantissa bits
|
||||
* The exponent is 1023 biased and there is an implicit zero.
|
||||
* We get the exponent from the upper bits and set the exponent
|
||||
* to 0x3fe (1022).
|
||||
*/
|
||||
*exptr = (int)(((u.c[7] & 0x7f) << 4) | (u.c[6] >> 4)) - 1022;
|
||||
u.c[7] &= 0x80;
|
||||
u.c[7] |= 0x3f;
|
||||
u.c[6] &= 0x0f;
|
||||
u.c[6] |= 0xe0;
|
||||
return u.d;
|
||||
u.d = x;
|
||||
/*
|
||||
* The format of the number is:
|
||||
* Sign, 12 exponent bits, 51 mantissa bits
|
||||
* The exponent is 1023 biased and there is an implicit zero.
|
||||
* We get the exponent from the upper bits and set the exponent
|
||||
* to 0x3fe (1022).
|
||||
*/
|
||||
*exptr = (int)(((u.c[7] & 0x7f) << 4) | (u.c[6] >> 4)) - 1022;
|
||||
u.c[7] &= 0x80;
|
||||
u.c[7] |= 0x3f;
|
||||
u.c[6] &= 0x0f;
|
||||
u.c[6] |= 0xe0;
|
||||
return u.d;
|
||||
}
|
||||
|
Reference in New Issue
Block a user