changeset 130:550840bcc140

moved the simple operations from math.c
author Jonathan Pevarnek <pevarnj@gmail.com>
date Wed, 31 Aug 2011 16:11:06 -0400
parents 86ec817aa4f4
children b6b3f04a732f
files include/math.h src/os/math.c src/prog/operations.c
diffstat 3 files changed, 24 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/include/math.h	Thu Aug 18 16:54:59 2011 -0400
+++ b/include/math.h	Wed Aug 31 16:11:06 2011 -0400
@@ -6,9 +6,4 @@
 double log(double num);
 double pow(double base, double exponent);
 
-double math_add(double first, double sec);
-double math_sub(double first, double sec);
-double math_mult(double first, double sec);
-double math_div(double first, double sec);
-
 #endif //__MATH_H
--- a/src/os/math.c	Thu Aug 18 16:54:59 2011 -0400
+++ b/src/os/math.c	Wed Aug 31 16:11:06 2011 -0400
@@ -62,23 +62,3 @@
 		return iPow(base, (int) exponent);
 	return exp(exponent*log(base));
 }
-
-double math_add(double first, double sec)
-{
-	return first + sec;
-}
-
-double math_sub(double first, double sec)
-{
-	return first - sec;
-}
-
-double math_mult(double first, double sec)
-{
-	return first*sec;
-}
-
-double math_div(double first, double sec)
-{
-	return first/sec;
-}
--- a/src/prog/operations.c	Thu Aug 18 16:54:59 2011 -0400
+++ b/src/prog/operations.c	Wed Aug 31 16:11:06 2011 -0400
@@ -19,6 +19,26 @@
 	sPrint("ERROR: STACK TOO SMALL\n");
 }
 
+static double add(double first, double sec)
+{
+	return first + sec;
+}
+
+static double sub(double first, double sec)
+{
+	return first - sec;
+}
+
+static double mult(double first, double sec)
+{
+	return first*sec;
+}
+
+static double div(double first, double sec)
+{
+	return first/sec;
+}
+
 void op_math1(Stack *stack, eltType (*mathop)(eltType))
 {
 	if(stack->size >= 1) {
@@ -49,22 +69,22 @@
 
 void op_add(Stack *stack)
 {
-	op_math2(stack, math_add);
+	op_math2(stack, add);
 }
 
 void op_sub(Stack *stack)
 {
-	op_math2(stack, math_sub);
+	op_math2(stack, sub);
 }
 
 void op_mult(Stack *stack)
 {
-	op_math2(stack, math_mult);
+	op_math2(stack, mult);
 }
 
 void op_div(Stack *stack)
 {
-	op_math2(stack, math_div);
+	op_math2(stack, div);
 }
 
 void op_pow(Stack *stack)