Import Upstream version 0.8.2
[platform/upstream/mpc.git] / src / set_x_x.c
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 Philippe Th\'eveny, Paul Zimmermann, Andreas Enge
5
6 This file is part of the MPC Library.
7
8 The MPC Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or (at your
11 option) any later version.
12
13 The MPC Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
16 License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with the MPC Library; see the file COPYING.LIB.  If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA. */
22
23 #include "config.h"
24
25 #if HAVE_INTTYPES_H
26 # include <inttypes.h> /* for intmax_t */
27 #else
28 # if HAVE_STDINT_H
29 #  include <stdint.h>
30 # endif
31 #endif
32
33 #include "mpc-impl.h"
34
35 #define MPC_SET_X_X(type, z, real_value, imag_value, rnd)       \
36   MPC_SET_X_Y (type, type, z, real_value, imag_value, rnd)
37
38 int
39 mpc_set_d_d (mpc_ptr z, double a, double b, mpc_rnd_t rnd)
40   MPC_SET_X_X (d, z, a, b, rnd)
41
42 int
43 mpc_set_f_f (mpc_ptr z, mpf_srcptr a, mpf_srcptr b, mpc_rnd_t rnd)
44   MPC_SET_X_X (f, z, a, b, rnd)
45
46 int
47 mpc_set_fr_fr (mpc_ptr z, mpfr_srcptr a, mpfr_srcptr b, mpc_rnd_t rnd)
48   MPC_SET_X_X (fr, z, a, b, rnd)
49
50 int
51 mpc_set_ld_ld (mpc_ptr z, long double a, long double b, mpc_rnd_t rnd)
52   MPC_SET_X_X (ld, z, a, b, rnd)
53
54 int
55 mpc_set_q_q (mpc_ptr z, mpq_srcptr a, mpq_srcptr b, mpc_rnd_t rnd)
56   MPC_SET_X_X (q, z, a, b, rnd)
57
58 int
59 mpc_set_si_si (mpc_ptr z, long int a, long int b, mpc_rnd_t rnd)
60   MPC_SET_X_X (si, z, a, b, rnd)
61
62 int
63 mpc_set_ui_ui (mpc_ptr z, unsigned long int a, unsigned long int b,
64                mpc_rnd_t rnd)
65   MPC_SET_X_X (ui, z, a, b, rnd)
66
67 int
68 mpc_set_z_z (mpc_ptr z, mpz_srcptr a, mpz_srcptr b, mpc_rnd_t rnd)
69   MPC_SET_X_X (z, z, a, b, rnd)
70
71 #ifdef _MPC_H_HAVE_INTMAX_T
72 int
73 mpc_set_uj_uj (mpc_ptr z, uintmax_t a, uintmax_t b, mpc_rnd_t rnd)
74   MPC_SET_X_X (uj, z, a, b, rnd)
75
76 int
77 mpc_set_sj_sj (mpc_ptr z, intmax_t a, intmax_t b, mpc_rnd_t rnd)
78   MPC_SET_X_X (sj, z, a, b, rnd)
79 #endif