feat(math/abs): adding ft_abs function
- Return the absolute value
This commit is contained in:
parent
2be64a8f1b
commit
6879b46aee
1 changed files with 21 additions and 0 deletions
21
math/ft_abs.c
Normal file
21
math/ft_abs.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_abs.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/09/17 16:37:35 by rparodi #+# #+# */
|
||||
/* Updated: 2025/09/17 16:39:43 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t ft_abs(int64_t value)
|
||||
{
|
||||
if (value < 0)
|
||||
return (-value);
|
||||
else
|
||||
return (value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue