cub3d/libft/src/ft_ftoi.c

34 lines
1.1 KiB
C
Raw Normal View History

2023-10-25 13:56:45 +02:00
/* ************************************************************************** */
/* */
/* :::::::: */
2023-10-26 19:11:30 +02:00
/* ft_ftoi.c :+: :+: */
2023-10-25 13:56:45 +02:00
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2021/02/02 21:30:30 by djonker #+# #+# */
2023-10-26 19:11:30 +02:00
/* Updated: 2023/10/18 16:56:29 by houtworm ######## odam.nl */
2023-10-25 13:56:45 +02:00
/* */
/* ************************************************************************** */
#include "../libft.h"
int ft_ftoi(double n)
{
int r;
int l;
double f;
if (ft_isneg(n))
n = n * -1;
l = ft_declen(n);
r = n;
f = n - r;
while (l > 0)
{
f = f * 10;
l--;
}
r = f;
return (r);
}