aboutsummaryrefslogtreecommitdiff
path: root/libs/libc/math.c
blob: c8142b5b2200eccb36894eda9950d5c7f730ccec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// MIT License, Copyright (c) 2020 Marvin Borner

#include <math.h>

int pow(int base, int exp)
{
	if (exp < 0)
		return 0;

	if (!exp)
		return 1;

	int ret = base;
	for (int i = 1; i < exp; i++)
		ret *= base;
	return ret;
}