Cub3D/libft/src/ft_math/ft_round.c
2024-11-08 19:37:30 +01:00

24 lines
1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_round.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/23 23:10:18 by bgoulard #+# #+# */
/* Updated: 2024/05/23 23:10:36 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
double ft_round(double x)
{
double dec;
double round;
dec = x - (int)x;
if (dec >= 0.5)
round = (int)x + 1;
else
round = (int)x;
return (round);
}