adding modf pow and round
This commit is contained in:
19
srcs/ft_pow.c
Normal file
19
srcs/ft_pow.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "libft.h"
|
||||
|
||||
/**
|
||||
* returns the value of 'base' raised to the power of 'exponent'
|
||||
*/
|
||||
double ft_pow(double base, int exponent)
|
||||
{
|
||||
int i;
|
||||
double result;
|
||||
|
||||
result = 1.0;
|
||||
i = 0;
|
||||
while (i < exponent)
|
||||
{
|
||||
result *= base;
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user