1 /*
2 test file for derive
3
4 Copyright (C) 2017 Andreas Enge
5
6 This file is part of the MPFRCX Library.
7
8 The MPFRCX 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 3 of the License, or (at your
11 option) any later version.
12
13 The MPFRCX 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 MPFRCX library; see the file COPYING.LESSER. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA.
22 */
23
24 #include "mpfrcx.h"
25
main(void)26 int main (void)
27 {
28 mpcx_t f;
29 int ok;
30
31 mpcx_init (f, 3, 30);
32 mpcx_set_deg (f, 2);
33 mpc_set_ui (mpcx_get_coeff (f, 2), 1, MPC_RNDNN);
34 mpc_set_ui (mpcx_get_coeff (f, 1), 17, MPC_RNDNN);
35 mpc_set_ui (mpcx_get_coeff (f, 0), 42, MPC_RNDNN);
36
37 mpcx_derive (f, f);
38
39 ok = mpcx_get_deg (f) == 1
40 && !mpc_cmp_si (mpcx_get_coeff (f, 1), 2)
41 && !mpc_cmp_si (mpcx_get_coeff (f, 0), 17);
42
43 mpcx_clear (f);
44
45 return (!ok);
46 }
47
48