From 89ae8baf1bffef311c0f65fd1e195eb8fc7d4b4e Mon Sep 17 00:00:00 2001 From: David McMackins II Date: Sat, 3 Sep 2016 07:43:04 -0500 Subject: Improve speed of conversion to radians --- src/tibtype.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/tibtype.c b/src/tibtype.c index 45bbce0..1351dec 100644 --- a/src/tibtype.c +++ b/src/tibtype.c @@ -1103,25 +1103,12 @@ tib_factorial (const TIB *t) TIB * tib_toradians (const TIB *t) { - TIB *pi = tib_var_get (TIB_CHAR_PI); - if (!pi) - return NULL; - - TIB *factor = tib_new_complex (180, 0); + TIB *factor = tib_new_complex (3.141592653589793238462643383279502884 / 180, + 0); if (!factor) - { - tib_decref (pi); - return NULL; - } - - TIB *temp = tib_div (pi, factor); - tib_decref (pi); - tib_decref (factor); - if (!temp) return NULL; - factor = temp; - temp = tib_mul (t, factor); + TIB *temp = tib_mul (t, factor); tib_decref (factor); return temp; -- cgit v1.2.3