aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/math-lib/secant.c
diff options
context:
space:
mode:
authorDuncan Wilkie <antigravityd@gmail.com>2023-11-18 06:11:09 -0600
committerDuncan Wilkie <antigravityd@gmail.com>2023-11-18 06:11:09 -0600
commit11da511c784eca003deb90c23570f0873954e0de (patch)
treee14fdd3d5d6345956d67e79ae771d0633d28362b /ic-reals-6.3/math-lib/secant.c
Initial commit.
Diffstat (limited to 'ic-reals-6.3/math-lib/secant.c')
-rw-r--r--ic-reals-6.3/math-lib/secant.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/ic-reals-6.3/math-lib/secant.c b/ic-reals-6.3/math-lib/secant.c
new file mode 100644
index 0000000..7261546
--- /dev/null
+++ b/ic-reals-6.3/math-lib/secant.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2000, Imperial College
+ *
+ * This file is part of the Imperial College Exact Real Arithmetic Library.
+ * See the copyright notice included in the distribution for conditions
+ * of use.
+ */
+
+#include <stdio.h>
+#include "real.h"
+
+/*
+ * These functions should probably be broken into separate files.
+ */
+
+/*
+ * sec x = 1 / (cos x)
+ */
+Real
+sec_R(Real x)
+{
+ return div_Int_R(1, cos_R(x));
+}
+
+Real
+sec_QInt(int a, int b)
+{
+ return div_Int_R(1, cos_QInt(a, b));
+}
+
+Real
+sec_QZ(mpz_t a, mpz_t b)
+{
+ return div_Int_R(1, cos_QZ(a, b));
+}
+
+/*
+ * asec x = acos (1/x)
+ */
+Real
+asec_R(Real x)
+{
+ return acos_R(div_Int_R(1, x));
+}
+
+Real
+asec_QInt(int a, int b)
+{
+ return acos_QInt(b, a);
+}
+
+Real
+asec_QZ(mpz_t a, mpz_t b)
+{
+ return acos_QZ(b, a);
+}
+
+/*
+ * sech x = 1 / (cosh x)
+ */
+Real
+sech_R(Real x)
+{
+ return div_Int_R(1, cosh_R(x));
+}
+
+Real
+sech_QInt(int a, int b)
+{
+ return div_Int_R(1, cosh_QInt(a, b));
+}
+
+Real
+sech_QZ(mpz_t a, mpz_t b)
+{
+ return div_Int_R(1, cosh_QZ(a, b));
+}
+
+/*
+ * asech x = acosh (1/x)
+ */
+Real
+asech_R(Real x)
+{
+ return acosh_R(div_Int_R(1, x));
+}
+
+Real
+asech_QInt(int a, int b)
+{
+ return acosh_QInt(b, a);
+}
+
+Real
+asech_QZ(mpz_t a, mpz_t b)
+{
+ return acosh_QZ(b, a);
+}