adding sign and abs for doubles
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_abs(int n)
|
||||
int ft_abs(int n)
|
||||
{
|
||||
if (n < 0)
|
||||
n *= -1;
|
||||
|
||||
8
srcs/ft_abs_f.c
Normal file
8
srcs/ft_abs_f.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
double ft_abs_f(double n)
|
||||
{
|
||||
if (n < 0)
|
||||
n *= -1;
|
||||
return (n);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_sign(int i)
|
||||
int ft_sign(int i)
|
||||
{
|
||||
if (i < 0)
|
||||
return (-1);
|
||||
|
||||
8
srcs/ft_sign_f.c
Normal file
8
srcs/ft_sign_f.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include "libft.h"
|
||||
|
||||
int ft_sign_f(double i)
|
||||
{
|
||||
if (i < 0)
|
||||
return (-1);
|
||||
return (1);
|
||||
}
|
||||
Reference in New Issue
Block a user