summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--TODO6
-rw-r--r--doc/mpfr.texi10
-rw-r--r--src/cosu.c9
-rw-r--r--src/mpfr.h4
-rw-r--r--src/sinu.c9
-rw-r--r--src/tanu.c9
7 files changed, 41 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 8cd0d629a..03ac425b4 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
Changes from versions 4.1.* to version 4.2.0:
- The "" release.
- New functions mpfr_cosu, mpfr_sinu and mpfr_tanu (experimental).
+- New functions mpfr_cospi, mpfr_sinpi and mpfr_tanpi (experimental).
- Bug fixes.
In particular, for the formatted output functions (mpfr_printf, etc.),
the case where the precision consists only of a period has been fixed
diff --git a/TODO b/TODO
index 5b9e6b09e..1f047cb28 100644
--- a/TODO
+++ b/TODO
@@ -169,10 +169,8 @@ Table of contents:
+ axis_rad (5.3.9.1) if useful in MPFR;
+ cycle (5.3.10.1): rad(2 pi x / u) u / (2 pi) = remr(x, u);
+ axis_cycle (5.3.10.1) if useful in MPFR;
- + sinu, cosu, tanu, cotu, secu, cscu, cossinu, arcsinu, arccosu,
- arctanu, arccotu, arcsecu, arccscu (5.3.10.{2..14}):
- sin(x 2 pi / u), etc.;
- [from which sinpi(x) = sin(Pi*x), ... are trivial to implement, with u=2.]
+ + cotu, secu, cscu, cossinu, arcsinu, arccosu,
+ arctanu, arccotu, arcsecu, arccscu (5.3.10.{5..14}):
+ arcu (5.3.10.15): arctan2(y,x) u / (2 pi);
+ rad_to_cycle, cycle_to_rad, cycle_to_cycle (5.3.11.{1..3}).
- From GSL, missing special functions (if useful in MPFR):
diff --git a/doc/mpfr.texi b/doc/mpfr.texi
index 0afd01568..5365f1aa7 100644
--- a/doc/mpfr.texi
+++ b/doc/mpfr.texi
@@ -2289,6 +2289,16 @@ Note: these functions are experimental and their interface might change in futur
versions.
@end deftypefun
+@deftypefun int mpfr_cosu (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long @var{u}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_sinu (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long @var{u}, mpfr_rnd_t @var{rnd})
+@deftypefunx int mpfr_tanu (mpfr_t @var{rop}, mpfr_t @var{op}, unsigned long @var{u}, mpfr_rnd_t @var{rnd})
+Set @var{rop} to the cosine (resp. sine and tangent) of @m{@var{op} \times \pi,@var{op} multiplied by @tie{}Pi}. See the description of @code{mpfr_sinu},
+@code{mpfr_cosu} and @code{mpfr_tanu} for special values.
+
+Note: these functions are experimental and their interface might change in future
+versions.
+@end deftypefun
+
@deftypefun int mpfr_sin_cos (mpfr_t @var{sop}, mpfr_t @var{cop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
Set simultaneously @var{sop} to the sine of @var{op} and @var{cop} to the
cosine of @var{op}, rounded in the direction @var{rnd} with the corresponding
diff --git a/src/cosu.c b/src/cosu.c
index c5b34e301..528652a8f 100644
--- a/src/cosu.c
+++ b/src/cosu.c
@@ -1,4 +1,5 @@
-/* mpfr_cosu -- cosu(x) = cos(2*pi*x/u)
+/* mpfr_cosu -- cosu(x) = cos(2*pi*x/u)
+ mpfr_cospi -- cospi(x) = cos(pi*x)
Copyright 2020 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
@@ -181,3 +182,9 @@ mpfr_cosu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_FREE (expo);
return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
}
+
+int
+mpfr_cospi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_cosu (y, x, 2, rnd_mode);
+}
diff --git a/src/mpfr.h b/src/mpfr.h
index ed63df92f..cdc23aef7 100644
--- a/src/mpfr.h
+++ b/src/mpfr.h
@@ -725,6 +725,10 @@ __MPFR_DECLSPEC int mpfr_sinu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t)
__MPFR_DECLSPEC int mpfr_cosu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_tanu (mpfr_ptr, mpfr_srcptr, unsigned long, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_sinpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_cospi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+__MPFR_DECLSPEC int mpfr_tanpi (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
+
__MPFR_DECLSPEC int mpfr_hypot (mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_erf (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
__MPFR_DECLSPEC int mpfr_erfc (mpfr_ptr, mpfr_srcptr, mpfr_rnd_t);
diff --git a/src/sinu.c b/src/sinu.c
index 277a92cf1..3fb2dc784 100644
--- a/src/sinu.c
+++ b/src/sinu.c
@@ -1,4 +1,5 @@
-/* mpfr_sinu -- sinu(x) = sin(2*pi*x/u)
+/* mpfr_sinu -- sinu(x) = sin(2*pi*x/u)
+ mpfr_sinpi -- sinpi(x) = sin(pi*x)
Copyright 2020 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
@@ -189,3 +190,9 @@ mpfr_sinu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_FREE (expo);
return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
}
+
+int
+mpfr_sinpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_sinu (y, x, 2, rnd_mode);
+}
diff --git a/src/tanu.c b/src/tanu.c
index 1d9710a8b..20f92882e 100644
--- a/src/tanu.c
+++ b/src/tanu.c
@@ -1,4 +1,5 @@
-/* mpfr_tanu -- tanu(x) = tan(2*pi*x/u)
+/* mpfr_tanu -- tanu(x) = tan(2*pi*x/u)
+ mpfr_tanpi -- tanpi(x) = tan(pi*x)
Copyright 2020 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
@@ -175,3 +176,9 @@ mpfr_tanu (mpfr_ptr y, mpfr_srcptr x, unsigned long u, mpfr_rnd_t rnd_mode)
MPFR_SAVE_EXPO_FREE (expo);
return underflow ? inexact : mpfr_check_range (y, inexact, rnd_mode);
}
+
+int
+mpfr_tanpi (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
+{
+ return mpfr_tanu (y, x, 2, rnd_mode);
+}