Skip to content
Browse files

expose C trig functions to pub

  • Loading branch information...
1 parent 27eee8b commit 5fa78e0398f3587b0ebbc22cd32cf125c883a947 Matt Miller committed Sep 5, 2012
Showing with 114 additions and 0 deletions.
  1. +100 −0 librfn/math.C
  2. +7 −0 librfn/okrfn-int.h
  3. +7 −0 librfn/rfn3.C
View
100 librfn/math.C
@@ -111,6 +111,106 @@ namespace rfn3 {
//-----------------------------------------------------------------------
ptr<const expr_t>
+ cos_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (cos (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str cos_t::DOCUMENTATION =
+ "The C-library cos() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ tan_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (tan (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str tan_t::DOCUMENTATION =
+ "The C-library tan() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ asin_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (asin (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str asin_t::DOCUMENTATION =
+ "The C-library asin() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ acos_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (acos (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str acos_t::DOCUMENTATION =
+ "The C-library acos() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ sin_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (sin (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str sin_t::DOCUMENTATION =
+ "The C-library sin() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ atan_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double n = args[0]._f;
+ return expr_double_t::alloc (atan (n));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str atan_t::DOCUMENTATION =
+ "The C-library atan() function, input in radians.";
+
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
+ atan2_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
+ {
+ double y = args[0]._f;
+ double x = args[1]._f;
+ return expr_double_t::alloc (atan2 (y,x));
+ }
+
+ //-----------------------------------------------------------------------
+
+ const str atan2_t::DOCUMENTATION =
+ "The C-library atan2() function, input in radians.";
+
+ //-----------------------------------------------------------------------
+
+ ptr<const expr_t>
pow_t::v_eval_2 (eval_t *p, const vec<arg_t> &args) const
{
double b = args[0]._f;
View
7 librfn/okrfn-int.h
@@ -51,6 +51,13 @@ namespace rfn3 {
PUB3_COMPILED_FN_DOC(sqrt, "f");
PUB3_COMPILED_FN_DOC(exp, "f");
PUB3_COMPILED_FN_DOC(log, "f");
+ PUB3_COMPILED_FN_DOC(sin, "f");
+ PUB3_COMPILED_FN_DOC(cos, "f");
+ PUB3_COMPILED_FN_DOC(tan, "f");
+ PUB3_COMPILED_FN_DOC(asin, "f");
+ PUB3_COMPILED_FN_DOC(acos, "f");
+ PUB3_COMPILED_FN_DOC(atan, "f");
+ PUB3_COMPILED_FN_DOC(atan2, "f");
PUB3_COMPILED_FN_DOC(str, "O");
PUB3_COMPILED_FN(documentation, "O");
PUB3_COMPILED_FN_DOC(tag_escape, "s|r");
View
7 librfn/rfn3.C
@@ -107,6 +107,13 @@ namespace rfn3 {
F(index_of);
F(eval_location);
F(breadcrumb);
+ F(cos);
+ F(sin);
+ F(tan);
+ F(asin);
+ F(acos);
+ F(atan);
+ F(atan2);
#undef F

0 comments on commit 5fa78e0

Please sign in to comment.
Something went wrong with that request. Please try again.