-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_frexp.c
35 lines (33 loc) · 1.12 KB
/
ft_frexp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_frexp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ohachim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/10 14:00:57 by ohachim #+# #+# */
/* Updated: 2019/05/26 05:35:52 by ohachim ### ########.fr */
/* */
/* ************************************************************************** */
double ft_frexp(double value, int *expo)
{
int sign;
sign = 1;
if (value < 0)
{
value *= -1;
sign *= -1;
}
*expo = 0;
if (value)
{
while (value >= 1.0)
{
value /= 2;
*expo += 1;
}
}
else
value = 0.0;
return (sign * value);
}