Annotation of OpenXM_contrib/gmp/mpfr/gmp_op.c, Revision 1.1.1.1
1.1 ohara 1: /* mpfr_cos -- cosine of a floating-point number
2:
3: Copyright 2001 Free Software Foundation, Inc.
4:
5: This file is part of the MPFR Library.
6:
7: The MPFR Library is free software; you can redistribute it and/or modify
8: it under the terms of the GNU Lesser General Public License as published by
9: the Free Software Foundation; either version 2.1 of the License, or (at your
10: option) any later version.
11:
12: The MPFR Library is distributed in the hope that it will be useful, but
13: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15: License for more details.
16:
17: You should have received a copy of the GNU Lesser General Public License
18: along with the MPFR Library; see the file COPYING.LIB. If not, write to
19: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20: MA 02111-1307, USA. */
21:
22: #include <stdio.h>
23: #include "gmp.h"
24: #include "gmp-impl.h"
25: #include "mpfr.h"
26: #include "mpfr-impl.h"
27:
28: int
29: mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
30: {
31: mpfr_t t;
32: int res;
33: mpfr_init(t);
34: mpfr_set_z(t,z,rnd_mode);
35: res=mpfr_mul(y,x,t,rnd_mode);
36: mpfr_clear(t);
37: return(res);
38: }
39:
40: int
41: mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
42: {
43: mpfr_t t;
44: int res;
45: mpfr_init(t);
46: mpfr_set_z(t,z,rnd_mode);
47: res=mpfr_div(y,x,t,rnd_mode);
48: mpfr_clear(t);
49: return(res);
50: }
51:
52: int
53: mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
54: {
55: mpfr_t t;
56: int res;
57: mpfr_init(t);
58: mpfr_set_z(t,z,rnd_mode);
59: res=mpfr_add(y,x,t,rnd_mode);
60: mpfr_clear(t);
61: return(res);
62: }
63:
64: int
65: mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
66: {
67: mpfr_t t;
68: int res;
69: mpfr_init(t);
70: mpfr_set_z(t,z,rnd_mode);
71: res=mpfr_sub(y,x,t,rnd_mode);
72: mpfr_clear(t);
73: return(res);
74: }
75:
76: int
77: mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
78: {
79: mpfr_t t;
80: int res;
81: mpfr_init(t);
82: mpfr_set_q(t,z,rnd_mode);
83: res=mpfr_mul(y,x,t,rnd_mode);
84: mpfr_clear(t);
85: return(res);
86: }
87:
88: int
89: mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
90: {
91: mpfr_t t;
92: int res;
93: mpfr_init(t);
94: mpfr_set_q(t,z,rnd_mode);
95: res=mpfr_div(y,x,t,rnd_mode);
96: mpfr_clear(t);
97: return(res);
98: }
99:
100: int
101: mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
102: {
103: mpfr_t t;
104: int res;
105: mpfr_init(t);
106: mpfr_set_q(t,z,rnd_mode);
107: res=mpfr_add(y,x,t,rnd_mode);
108: mpfr_clear(t);
109: return(res);
110: }
111:
112: int
113: mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
114: {
115: mpfr_t t;
116: int res;
117: mpfr_init(t);
118: mpfr_set_q(t,z,rnd_mode);
119: res=mpfr_sub(y,x,t,rnd_mode);
120: mpfr_clear(t);
121: return(res);
122: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>