adding sign and abs for doubles
This commit is contained in:
2
Makefile
2
Makefile
@@ -120,9 +120,11 @@ SRCS = ft_memset.c \
|
|||||||
pf_utils.c \
|
pf_utils.c \
|
||||||
\
|
\
|
||||||
ft_abs.c \
|
ft_abs.c \
|
||||||
|
ft_abs_f.c \
|
||||||
ft_greater.c \
|
ft_greater.c \
|
||||||
ft_smaller.c \
|
ft_smaller.c \
|
||||||
ft_sign.c \
|
ft_sign.c \
|
||||||
|
ft_sign_f.c \
|
||||||
ft_sqrt.c \
|
ft_sqrt.c \
|
||||||
ft_free_tab.c \
|
ft_free_tab.c \
|
||||||
\
|
\
|
||||||
|
|||||||
@@ -122,9 +122,11 @@ void ft_putnbrendl(int n);
|
|||||||
void ft_putnbrendl_fd(int n, int fd);
|
void ft_putnbrendl_fd(int n, int fd);
|
||||||
char *ft_concat_free(char *str1, char *str2);
|
char *ft_concat_free(char *str1, char *str2);
|
||||||
int ft_abs(int n);
|
int ft_abs(int n);
|
||||||
|
double ft_abs_f(double n);
|
||||||
int ft_greater(int a, int b);
|
int ft_greater(int a, int b);
|
||||||
int ft_smaller(int a, int b);
|
int ft_smaller(int a, int b);
|
||||||
int ft_sign(int i);
|
int ft_sign(int i);
|
||||||
|
int ft_sign_f(double i);
|
||||||
int ft_sqrt(int i);
|
int ft_sqrt(int i);
|
||||||
void ft_free_tab(char **tab);
|
void ft_free_tab(char **tab);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "libft.h"
|
#include "libft.h"
|
||||||
|
|
||||||
int ft_abs(int n)
|
int ft_abs(int n)
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
n *= -1;
|
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"
|
#include "libft.h"
|
||||||
|
|
||||||
int ft_sign(int i)
|
int ft_sign(int i)
|
||||||
{
|
{
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return (-1);
|
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