Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
mpfr_mul_d.c
Go to the documentation of this file.
1#include "mpfr_mul_d.h"
2
3static mpfr_t y;
4static int initialized = 0;
5
6int mpfr_mul_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
7{
8 if (!initialized) {
9 mpfr_init2(y, 53);
10 initialized = 1;
11 }
12 mpfr_set_d(y, a, GMP_RNDN);
13 return mpfr_mul(z, x, y, r);
14}
15
16int mpfr_div_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
17{
18 if (!initialized) {
19 mpfr_init2(y, 53);
20 initialized = 1;
21 }
22 mpfr_set_d(y, a, GMP_RNDN);
23 return mpfr_div(z, x, y, r);
24}
25
26int mpfr_d_div(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
27{
28 if (!initialized) {
29 mpfr_init2(y, 53);
30 initialized = 1;
31 }
32 mpfr_set_d(y, a, GMP_RNDN);
33 return mpfr_div(z, y, x, r);
34}
35
36int mpfr_add_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
37{
38 if (!initialized) {
39 mpfr_init2(y, 53);
40 initialized = 1;
41 }
42 mpfr_set_d(y, a, GMP_RNDN);
43 return mpfr_add(z, x, y, r);
44}
45
46int mpfr_sub_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
47{
48 if (!initialized) {
49 mpfr_init2(y, 53);
50 initialized = 1;
51 }
52 mpfr_set_d(y, a, GMP_RNDN);
53 return mpfr_sub(z, x, y, r);
54}
55
56int mpfr_d_sub(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
57{
58 if (!initialized) {
59 mpfr_init2(y, 53);
60 initialized = 1;
61 }
62 mpfr_set_d(y, a, GMP_RNDN);
63 return mpfr_sub(z, y, x, r);
64}
65
67{
68 if (initialized) {
69 initialized = 0;
70 mpfr_clear(y);
71 }
72}
int mpfr_d_sub(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
Definition mpfr_mul_d.c:56
int mpfr_mul_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
Definition mpfr_mul_d.c:6
int mpfr_div_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
Definition mpfr_mul_d.c:16
void mpfr_mul_d_clear()
Definition mpfr_mul_d.c:66
int mpfr_add_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
Definition mpfr_mul_d.c:36
int mpfr_d_div(mpfr_ptr z, double a, mpfr_srcptr x, mpfr_rnd_t r)
Definition mpfr_mul_d.c:26
static int initialized
Definition mpfr_mul_d.c:4
static mpfr_t y
Definition mpfr_mul_d.c:3
int mpfr_sub_d(mpfr_ptr z, mpfr_srcptr x, double a, mpfr_rnd_t r)
Definition mpfr_mul_d.c:46