xref: /dragonfly/contrib/mpc/src/set_x_x.c (revision 0085a56d)
1 /* mpc_set_x_x -- Set complex number real and imaginary parts from parameters
2    whose type is known by mpfr.
3 
4 Copyright (C) 2009, 2011 INRIA
5 
6 This file is part of GNU MPC.
7 
8 GNU MPC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
16 more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with this program. If not, see http://www.gnu.org/licenses/ .
20 */
21 
22 #include "config.h"
23 
24 #ifdef HAVE_INTTYPES_H
25 # include <inttypes.h> /* for intmax_t */
26 #else
27 # ifdef HAVE_STDINT_H
28 #  include <stdint.h>
29 # endif
30 #endif
31 
32 #include "mpc-impl.h"
33 
34 #define MPC_SET_X_X(type, z, real_value, imag_value, rnd)       \
35   MPC_SET_X_Y (type, type, z, real_value, imag_value, rnd)
36 
37 int
38 mpc_set_d_d (mpc_ptr z, double a, double b, mpc_rnd_t rnd)
39   MPC_SET_X_X (d, z, a, b, rnd)
40 
41 int
42 mpc_set_f_f (mpc_ptr z, mpf_srcptr a, mpf_srcptr b, mpc_rnd_t rnd)
43   MPC_SET_X_X (f, z, a, b, rnd)
44 
45 int
46 mpc_set_fr_fr (mpc_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpc_rnd_t rnd)
47   MPC_SET_X_X (fr, z, a, b, rnd)
48 
49 int
50 mpc_set_ld_ld (mpc_ptr z, long double a, long double b, mpc_rnd_t rnd)
51   MPC_SET_X_X (ld, z, a, b, rnd)
52 
53 int
54 mpc_set_q_q (mpc_ptr z, mpq_srcptr a, mpq_srcptr b, mpc_rnd_t rnd)
55   MPC_SET_X_X (q, z, a, b, rnd)
56 
57 int
58 mpc_set_si_si (mpc_ptr z, long int a, long int b, mpc_rnd_t rnd)
59   MPC_SET_X_X (si, z, a, b, rnd)
60 
61 int
62 mpc_set_ui_ui (mpc_ptr z, unsigned long int a, unsigned long int b,
63                mpc_rnd_t rnd)
64   MPC_SET_X_X (ui, z, a, b, rnd)
65 
66 int
67 mpc_set_z_z (mpc_ptr z, mpz_srcptr a, mpz_srcptr b, mpc_rnd_t rnd)
68   MPC_SET_X_X (z, z, a, b, rnd)
69 
70 #ifdef _MPC_H_HAVE_INTMAX_T
71 int
72 mpc_set_uj_uj (mpc_ptr z, uintmax_t a, uintmax_t b, mpc_rnd_t rnd)
73   MPC_SET_X_X (uj, z, a, b, rnd)
74 
75 int
76 mpc_set_sj_sj (mpc_ptr z, intmax_t a, intmax_t b, mpc_rnd_t rnd)
77   MPC_SET_X_X (sj, z, a, b, rnd)
78 #endif
79