Changeset: 9460a561d74e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9460a561d74e
Modified Files:
        MonetDB5/src/modules/kernel/batmmath.mx
        MonetDB5/src/modules/kernel/mmath.mx
Branch: default
Log Message:

Addition of radians/degrees
These mathematical functions are useful for science applications..


diffs (88 lines):

diff -r cc66f0cbc375 -r 9460a561d74e MonetDB5/src/modules/kernel/batmmath.mx
--- a/MonetDB5/src/modules/kernel/batmmath.mx   Sun Nov 14 00:41:03 2010 +0100
+++ b/MonetDB5/src/modules/kernel/batmmath.mx   Wed Nov 17 09:22:25 2010 +0100
@@ -53,6 +53,8 @@
        @:scienceFcn(cosh)@
        @:scienceFcn(sinh)@
        @:scienceFcn(tanh)@
+       @:scienceFcn(radians)@
+       @:scienceFcn(degrees)@
        @:scienceFcn(exp)@
        @:scienceFcn(log)@
        @:scienceFcn(log10)@
@@ -93,6 +95,8 @@
 #define batmmath_export extern
 #endif
 
+#define radians(x)       x * 3.14159265358979323846 /180.0
+#define degrees(x)       x * 180.0/3.14159265358979323846
 @-
 @= scienceFcnImpl
 batmmath_export str cmdscience_b...@2_@1(int *ret, int *bid);
@@ -186,6 +190,8 @@
 @:scienceImpl(cosh)@
 @:scienceImpl(sinh)@
 @:scienceImpl(tanh)@
+@:scienceImpl(radians)@
+@:scienceImpl(degrees)@
 @:scienceImpl(exp)@
 @:scienceImpl(log)@
 @:scienceImpl(log10)@
diff -r cc66f0cbc375 -r 9460a561d74e MonetDB5/src/modules/kernel/mmath.mx
--- a/MonetDB5/src/modules/kernel/mmath.mx      Sun Nov 14 00:41:03 2010 +0100
+++ b/MonetDB5/src/modules/kernel/mmath.mx      Wed Nov 17 09:22:25 2010 +0100
@@ -116,6 +116,17 @@
 comment "The tanh() function returns the hyperbolic tangent of x, which is 
        defined mathematically as sinh(x) / cosh(x).";
 
+command radians(x:flt)     :flt 
+address MATHunary_RADIANSflt;
+command radians(x:dbl)     :dbl 
+address MATHunary_RADIANSdbl
+comment "The radians() function converts degrees into radians"; 
+
+command degrees(x:flt)     :flt 
+address MATHunary_DEGREESflt;
+command degrees(x:dbl)     :dbl 
+address MATHunary_DEGREESdbl
+comment "The degrees() function converts radians into degrees"; 
 
 command exp(x:flt)       :flt 
 address MATHunary_EXPflt;
@@ -259,6 +270,8 @@
 @:unopM5_export(_COSH)@
 @:unopM5_export(_SINH)@
 @:unopM5_export(_TANH)@
+@:unopM5_export(_RADIANS)@
+@:unopM5_export(_DEGREES)@
 
 @:unopM5_export(_EXP)@
 @:unopM5_export(_LOG)@
@@ -341,6 +354,9 @@
 #define sinh_unary(x, z)       *z = sinh(*x)
 #define tanh_unary(x, z)       *z = tanh(*x)
 
+#define radians_unary(x, z)       *z = *x * 3.14159265358979323846 /180.0
+#define degrees_unary(x, z)       *z = *x * 180.0/3.14159265358979323846
+
 #define exp_unary(x, z)              *z = exp(*x)
 #define log_unary(x, z)              *z = log(*x)
 #define log10_unary(x, z)     *z = log10(*x)
@@ -365,6 +381,8 @@
 @:unop(_COSH,cosh)@
 @:unop(_SINH,sinh)@
 @:unop(_TANH,tanh)@
+@:unop(_RADIANS,radians)@
+@:unop(_DEGREES,degrees)@
 
 @:unop(_EXP,exp)@
 @:unop(_LOG,log)@
@@ -564,6 +582,8 @@
 @:unopM5(_SIN,sin)@
 @:unopM5(_TAN,tan)@
 @:unopM5(_COT,cot)@
+@:unopM5(_RADIANS,radians)@
+@:unopM5(_DEGREES,degrees)@
 
 @:unopM5(_COSH,cosh)@
 @:unopM5(_SINH,sinh)@
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to