update .rt et norme

This commit is contained in:
H3XploR
2025-02-18 17:20:28 +01:00
parent c6c13573cb
commit 6e963545c9
9 changed files with 172 additions and 166 deletions
+12 -6
View File
@@ -6,12 +6,22 @@
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/17 21:19:17 by yantoine #+# #+# */
/* Updated: 2025/02/17 21:20:13 by yantoine ### ########.fr */
/* Updated: 2025/02/18 17:14:00 by yantoine ### ########.fr */
/* */
/* ************************************************************************** */
#include "miniRT.h"
inline static char *check_sign(char *str, int *sign)
{
if (*str == '-')
{
*sign = -1;
str++;
}
return (str);
}
float ft_atof(char *str)
{
float res;
@@ -21,11 +31,7 @@ float ft_atof(char *str)
res = 0;
dec = 0;
sign = 1;
if (*str == '-')
{
sign = -1;
str++;
}
str = check_sign(str, &sign);
while (*str >= '0' && *str <= '9')
{
res = res * 10 + *str - '0';