-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_ftoa.c
27 lines (24 loc) · 1.13 KB
/
ft_ftoa.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ftoa.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dlenskyi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/11 11:13:22 by dlenskyi #+# #+# */
/* Updated: 2018/12/11 11:13:41 by dlenskyi ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
char *ft_ftoa(double n)
{
uint64_t *data;
data = (uint64_t *)&n;
if (*data >> 63 & 1)
return (ft_strdup("-0"));
if (!n)
return (ft_strdup("0"));
if (n == LONG_MIN)
return (ft_strdup("-9223372036854775808"));
return (NULL);
}