aboutsummaryrefslogtreecommitdiff
path: root/src/libc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libc')
-rw-r--r--src/libc/math.c18
-rw-r--r--src/libc/math.h4
2 files changed, 21 insertions, 1 deletions
diff --git a/src/libc/math.c b/src/libc/math.c
index 2051dc1..80b1d3a 100644
--- a/src/libc/math.c
+++ b/src/libc/math.c
@@ -11,4 +11,22 @@ int pow(int x,int n){
for(int i=0;i<(n-1);i++)
ret*=x;
return ret;
+}
+
+int max(int x,int y){
+ if(x>y)
+ return x;
+ return y;
+}
+
+int min(int x,int y){
+ if(x<y)
+ return x;
+ return y;
+}
+
+int abs(int x){
+ if(x<0)
+ return -x;
+ return x;
} \ No newline at end of file
diff --git a/src/libc/math.h b/src/libc/math.h
index 56f1788..9f9bd58 100644
--- a/src/libc/math.h
+++ b/src/libc/math.h
@@ -2,5 +2,7 @@
#define MATH_H
int pow(int x,int n);
-
+int max(int x,int y);
+int min(int x,int y);
+int abs(int x);
#endif \ No newline at end of file