gnu_mpc 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING.md +13 -0
- data/Gemfile +17 -0
- data/Guardfile +18 -0
- data/Makefile +12 -0
- data/README.md +47 -0
- data/Rakefile +54 -0
- data/ext/extconf.rb +46 -0
- data/ext/mpc.c +1010 -0
- data/ext/mpcrnd.c +194 -0
- data/ext/ruby_gmp.h +343 -0
- data/ext/ruby_mpc.h +63 -0
- data/lib/mpc.rb +30 -0
- data/manual.md +933 -0
- data/manual.pdf +0 -0
- data/manual_template.latex +177 -0
- data/spec/acos_spec.rb +66 -0
- data/spec/add_args_spec.rb +51 -0
- data/spec/add_fr_spec.rb +54 -0
- data/spec/add_spec.rb +32 -0
- data/spec/asin_spec.rb +66 -0
- data/spec/atan_spec.rb +109 -0
- data/spec/conj_spec.rb +56 -0
- data/spec/cos_spec.rb +54 -0
- data/spec/cosh_spec.rb +26 -0
- data/spec/exp_spec.rb +62 -0
- data/spec/hash_arguments_spec.rb +17 -0
- data/spec/log_spec.rb +37 -0
- data/spec/mpc_single_function_args_spec.rb +41 -0
- data/spec/neg_spec.rb +30 -0
- data/spec/new_spec.rb +97 -0
- data/spec/proj_spec.rb +20 -0
- data/spec/real_spec.rb +23 -0
- data/spec/rounding_spec.rb +199 -0
- data/spec/sin_spec.rb +66 -0
- data/spec/sinh_spec.rb +65 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/sqr_spec.rb +96 -0
- data/spec/sqrt_spec.rb +72 -0
- data/spec/sub_spec.rb +50 -0
- data/spec/tan_spec.rb +55 -0
- data/spec/tanh_spec.rb +53 -0
- data/spec/to_s_spec.rb +77 -0
- data/spec/version_spec.rb +7 -0
- metadata +91 -0
data/ext/ruby_mpc.h
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#ifndef _RUBY_MPC_H_
|
2
|
+
#define _RUBY_MPC_H_
|
3
|
+
|
4
|
+
#include <stdio.h>
|
5
|
+
#include <ruby.h>
|
6
|
+
#ifndef _GNU_SOURCE
|
7
|
+
#define _GNU_SOURCE
|
8
|
+
#endif
|
9
|
+
#include <ruby_gmp.h>
|
10
|
+
#include <mpc.h>
|
11
|
+
|
12
|
+
#include <stdlib.h>
|
13
|
+
|
14
|
+
/*
|
15
|
+
* (a comment borrowed from the Ruby GMP bindings:)
|
16
|
+
* MP_???* is used because they don't have side-effects of single-element arrays mpc_t
|
17
|
+
*/
|
18
|
+
typedef __mpc_struct MP_COMPLEX;
|
19
|
+
|
20
|
+
#define mpc_get_struct(ruby_var,c_var) { Data_Get_Struct(ruby_var, MP_COMPLEX, c_var); }
|
21
|
+
#define mpc_make_struct(ruby_var,c_var) { ruby_var = Data_Make_Struct(cMPC, MP_COMPLEX, 0, r_mpc_free, c_var); }
|
22
|
+
#define mpc_make_struct_init(ruby_var,c_var) { mpc_make_struct(ruby_var,c_var); mpc_init (c_var); }
|
23
|
+
#define mpc_make_struct_init3(ruby_var,c_var,real_prec,imag_prec) { mpc_make_struct(ruby_var,c_var); mpc_init3 (c_var, real_prec, imag_prec); }
|
24
|
+
#define MPC_P(value) (rb_obj_is_instance_of(value,cMPC) == Qtrue)
|
25
|
+
#define mpc_set_bignum(var_mpc,var_bignum) { \
|
26
|
+
VALUE tmp = rb_funcall ( \
|
27
|
+
rb_funcall (var_bignum, rb_intern ("to_s"), 1, INT2FIX(32)), \
|
28
|
+
rb_intern("upcase"), \
|
29
|
+
0); \
|
30
|
+
mpc_set_str (var_mpc, StringValuePtr (tmp), 32); \
|
31
|
+
}
|
32
|
+
|
33
|
+
#define mpc_temp_alloc(var) { var=malloc(sizeof(MP_COMPLEX)); }
|
34
|
+
#define mpc_temp_init(var,prec) { mpc_temp_alloc(var); mpc_init2(var,prec); }
|
35
|
+
#define mpc_temp_free(var) { mpc_clear(var); free(var); }
|
36
|
+
|
37
|
+
#define r_mpc_set_z(var1, var2) (mpc_set_z (var1, var2, __gmp_default_rounding_mode))
|
38
|
+
#define r_mpc_set_d(var1, var2) (mpc_set_d (var1, var2, __gmp_default_rounding_mode))
|
39
|
+
|
40
|
+
/* EXPECTED_Cxxx macros */
|
41
|
+
#define EXPECTED_FXC "Expected GMP::F, Fixnum, or MPC"
|
42
|
+
|
43
|
+
// MPC Rounding Modes
|
44
|
+
#define mpcrnd_get_struct(ruby_var,c_var) { Data_Get_Struct(ruby_var, int, c_var); }
|
45
|
+
#define mpcrnd_make_struct(ruby_var,c_var) { ruby_var = Data_Make_Struct(cMPC_Rnd, int, 0, 0, c_var); }
|
46
|
+
#define MPCRND_P(value) (rb_obj_is_instance_of(value, cMPC_Rnd) == Qtrue)
|
47
|
+
#define r_mpc_default_rounding_mode MPC_RNDNN
|
48
|
+
|
49
|
+
extern VALUE cMPC;
|
50
|
+
extern VALUE cMPC_Rnd;
|
51
|
+
|
52
|
+
extern void mpc_set_value(MP_COMPLEX *target, VALUE source, mpc_rnd_t rnd);
|
53
|
+
extern VALUE r_mpc_eq(VALUE self, VALUE arg);
|
54
|
+
extern VALUE r_mpc_cmp(VALUE self, VALUE arg);
|
55
|
+
extern int mpc_cmp_value(MP_COMPLEX *OP, VALUE arg);
|
56
|
+
|
57
|
+
extern void r_mpc_free(void *ptr);
|
58
|
+
extern mpc_rnd_t r_get_mpc_rounding_mode(VALUE rnd);
|
59
|
+
extern mpc_rnd_t r_get_default_mpc_rounding_mode();
|
60
|
+
extern mpc_rnd_t r_mpc_get_rounding_mode(VALUE rnd);
|
61
|
+
extern void init_mpcrnd();
|
62
|
+
|
63
|
+
#endif /* _RUBY_MPC_H_ */
|
data/lib/mpc.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Thank you, Nokogiri
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'gmp'
|
7
|
+
|
8
|
+
ENV['PATH'] = [File.expand_path(
|
9
|
+
File.join(File.dirname(__FILE__), "..", "ext")
|
10
|
+
), ENV['PATH']].compact.join(';') if RbConfig::CONFIG['host_os'] =~ /(mswin|mingw|mingw32)/i
|
11
|
+
|
12
|
+
require File.dirname(__FILE__) + '/../ext/mpc'
|
13
|
+
|
14
|
+
class MPC
|
15
|
+
def self.sprintf(format, *args)
|
16
|
+
first_pct = format.index '%'
|
17
|
+
result = format[0...first_pct]
|
18
|
+
format.gsub(/(?<!%)%[0#+ ']*[0-9]*.?[0-9]*[a-zA-Z][^%]*/) do |fragment|
|
19
|
+
arg = args.shift
|
20
|
+
if fragment =~ /%[0#+ ']*[0-9]*.?[0-9]*[ZQF]/
|
21
|
+
result << sprintf2(fragment, arg)
|
22
|
+
elsif fragment =~ /%[0#+ ']*[0-9]*.?[0-9]*[PR]/ && GMP.const_defined?(:MPFR_VERSION)
|
23
|
+
result << GMP::F.sprintf2(fragment, arg)
|
24
|
+
else
|
25
|
+
result << (fragment % arg)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
result
|
29
|
+
end
|
30
|
+
end
|
data/manual.md
ADDED
@@ -0,0 +1,933 @@
|
|
1
|
+
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
2
|
+
<style>
|
3
|
+
body {
|
4
|
+
margin: 0 auto;
|
5
|
+
width: 800px;
|
6
|
+
}
|
7
|
+
|
8
|
+
table {
|
9
|
+
border-collapse: collapse;
|
10
|
+
width:96%;
|
11
|
+
}
|
12
|
+
|
13
|
+
th {
|
14
|
+
font-weight: normal;
|
15
|
+
text-align: right;
|
16
|
+
white-space: nowrap;
|
17
|
+
}
|
18
|
+
|
19
|
+
tr.new-method th {
|
20
|
+
border-top: solid 2px black;
|
21
|
+
}
|
22
|
+
|
23
|
+
th:first-child {
|
24
|
+
text-align: left;
|
25
|
+
width: 0.8in;
|
26
|
+
}
|
27
|
+
|
28
|
+
tr.last-header th {
|
29
|
+
border-bottom: solid 1px black;
|
30
|
+
}
|
31
|
+
|
32
|
+
tr.last-header th:first-child {
|
33
|
+
border-bottom: 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
td:last-child {
|
37
|
+
padding-bottom: 1em;
|
38
|
+
}
|
39
|
+
|
40
|
+
pre {
|
41
|
+
background-color: #EEEEEE;
|
42
|
+
padding: 3px 2px;
|
43
|
+
</style>
|
44
|
+
|
45
|
+
# GNU MPC
|
46
|
+
|
47
|
+
Ruby bindings to the GNU MPC library
|
48
|
+
|
49
|
+
Edition 0.1.1
|
50
|
+
|
51
|
+
9 October 2012
|
52
|
+
|
53
|
+
\vfill
|
54
|
+
|
55
|
+
written by Sam Rawlins
|
56
|
+
|
57
|
+
with extensive quoting from the GNU MPC manual
|
58
|
+
|
59
|
+
\newpage
|
60
|
+
|
61
|
+
\vfill
|
62
|
+
|
63
|
+
This manual describes how to use the gnu\_mpc Ruby gem, which provides bindings
|
64
|
+
to GNU MPC, "a C library for the arithmetic of complex numbers with arbitrarily
|
65
|
+
high precision and correct rounding of the result."
|
66
|
+
|
67
|
+
Copyright 2012 Sam Rawlins
|
68
|
+
|
69
|
+
Apache 2.0 License [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
70
|
+
|
71
|
+
\newpage
|
72
|
+
|
73
|
+
\tableofcontents
|
74
|
+
|
75
|
+
\newpage
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
## Introduction to GNU MPC
|
85
|
+
|
86
|
+
GNU MPC is a C library for the arithmetic of complex numbers with arbitrarily
|
87
|
+
high precision and correct rounding of the result. It extends the principles of
|
88
|
+
the IEEE-754 standard for fixed precision real floating point numbers to
|
89
|
+
complex numbers, providing well-defined semantics for every operation. At the
|
90
|
+
same time, speed of operation at high precision is a major design goal.
|
91
|
+
|
92
|
+
The library is built upon and follows the same principles as Gnu Mpfr. It is
|
93
|
+
written by Andreas Enge, Mickaël Gastineau, Philippe Théveny and Paul
|
94
|
+
Zimmermann and is distributed under the Gnu Lesser General Public License,
|
95
|
+
either version 3 of the licence, or (at your option) any later version. The Gnu
|
96
|
+
Mpc library has been registered in France by the Agence pour la Protection des
|
97
|
+
Programmes on 2003-02-05 under the number IDDN FR 001 060029 000 R P 2003 000
|
98
|
+
10000.
|
99
|
+
|
100
|
+
\newpage
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
## Introduction to the gnu\_mpc gem
|
110
|
+
|
111
|
+
The gnu\_gmp Ruby gem is a Ruby library that provides bindings to GNU MPC. The
|
112
|
+
gem is incomplete, and will likely only include a subset of the GMP functions.
|
113
|
+
It is built as a C extension for Ruby, interacting with mpc.h. The gnu\_mpc gem
|
114
|
+
is not endorsed or supported by GNU or the MPC team. The gnu\_mpc gem also does
|
115
|
+
not ship with MPC; that must be compiled separately.
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
## Installing the gnu\_mpc gem
|
125
|
+
|
126
|
+
### Prerequisites
|
127
|
+
|
128
|
+
OK. First, we've got a few requirements. To install the gnu\_mpc gem, you need
|
129
|
+
one of the following versions of Ruby:
|
130
|
+
|
131
|
+
* (MRI) Ruby 1.8.7 - tested seriously.
|
132
|
+
* (MRI) Ruby 1.9.3 - tested seriously.
|
133
|
+
* (REE) Ruby 1.8.7 - tested lightly.
|
134
|
+
* (RBX) Rubinius 1.1 - tested lightly.
|
135
|
+
|
136
|
+
As you can see, only Matz's Ruby Interpreter (MRI) is seriously supported.
|
137
|
+
|
138
|
+
Next is the platform, the combination of the architecture (processor) and OS.
|
139
|
+
As far as I can tell, if you can compile MPC and Ruby on a given platform, you
|
140
|
+
can use the mpc gem there too. Please report problems with that hypothesis.
|
141
|
+
|
142
|
+
Lastly, MPC. MPC must be compiled and working. "And working" means
|
143
|
+
you ran `make check` after compiling MPC, and it 'check's out. The following
|
144
|
+
version of MPC have been tested:
|
145
|
+
|
146
|
+
* MPC 1.0.1
|
147
|
+
|
148
|
+
That's all. I don't intend to test any older versions.
|
149
|
+
|
150
|
+
### Installing
|
151
|
+
|
152
|
+
You may clone the mpc gem's git repository with:
|
153
|
+
|
154
|
+
git clone git://github.com/srawlins/gnu_mpc.git
|
155
|
+
|
156
|
+
Or you may install the gem from <http://rubygems.org>:
|
157
|
+
|
158
|
+
gem install gnu_mpc
|
159
|
+
|
160
|
+
At this time, the gem self-compiles. If required libraries cannot be found, you
|
161
|
+
may compile the C extensions manually with:
|
162
|
+
|
163
|
+
cd <gnu_mpc gem directory>/ext
|
164
|
+
ruby extconf.rb
|
165
|
+
make
|
166
|
+
|
167
|
+
There shouldn't be any errors, or warnings.
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
## Testing the gnu\_mpc gem
|
177
|
+
|
178
|
+
Testing the gnu\_mpc gem is quite simple. The testing framework uses RSpec.
|
179
|
+
|
180
|
+
bundle && rspec
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
## MPC and mpc gem basics
|
190
|
+
|
191
|
+
### Classes
|
192
|
+
|
193
|
+
The gnu\_mpc gem includes the class `MPC`. There are also some constants within
|
194
|
+
`MPC`:
|
195
|
+
|
196
|
+
`MPC::MPC_VERSION` - The version of MPC linked into the mpc gem
|
197
|
+
|
198
|
+
`MPC::MPC_RNDxy` - Rounding mode where $x$ is the rounding mode for the real
|
199
|
+
part and $y$ is the rounding mode for the imaginary part.
|
200
|
+
|
201
|
+
<!--\newpage-->
|
202
|
+
|
203
|
+
### Standard Options Hash Keys
|
204
|
+
|
205
|
+
Unless otherwise noted, each `MPC` instance method will accept an options hash
|
206
|
+
for optional arguments, after any required arguments. For example, since
|
207
|
+
`MPC#pow` requires one argument but `MPC#sin` requires none, options hashes can
|
208
|
+
be supplied like so:
|
209
|
+
|
210
|
+
MPC.new([1,1]).pow(2, {})
|
211
|
+
MPC.new([0.5, 0.5]).sin({})
|
212
|
+
|
213
|
+
Here are the keys typically accepted by an `MPC` instance method.
|
214
|
+
|
215
|
+
`:rnd`, `:round`, `:rounding`, `:rounding_mode`
|
216
|
+
: Rounding mode for the operation
|
217
|
+
`:prec`, `:precision`
|
218
|
+
: Precision used when initializing the return value; This precision will be
|
219
|
+
used for both the real and imaginary parts of the returned complex value.
|
220
|
+
`:real_prec`, `:real_precision`
|
221
|
+
: Precision used for the real part of the return value
|
222
|
+
`:imag_prec`, `:imag_precision`
|
223
|
+
: Precision used for the imaginary part of the return value
|
224
|
+
|
225
|
+
### Precision of Returned Values
|
226
|
+
|
227
|
+
Unless otherwise noted, the precision of a value returned by an `MPC` instance
|
228
|
+
method follows certain standards. By default, a method will create and return
|
229
|
+
an object with the MPFR default precision (which can be changed with
|
230
|
+
`GMP::F.default_prec=`). The user can also pass in a preferred precision in one
|
231
|
+
of three ways:
|
232
|
+
|
233
|
+
* Most methods will accept a `precision` parameter in their ordered argument
|
234
|
+
list, which will be used for both the real and imaginary parts of the return
|
235
|
+
object.
|
236
|
+
* Most methods accept an options hash as well. The user can pass in a perferred
|
237
|
+
precision using the `:prec` or `:precision` keys, like so:
|
238
|
+
|
239
|
+
MPC.new(5).sin(:prec => 64)
|
240
|
+
MPC.new([7,11]).exp(:precision => 128)
|
241
|
+
|
242
|
+
* The user can also specify the precision of the real part, and the imaginary
|
243
|
+
part, individually, using the options hash as well. The `:real_prec`,
|
244
|
+
`:real_precision`, `:imag_prec`, and `:imag_precision` keys can be used:
|
245
|
+
|
246
|
+
MPC.new(72).sin(:real_prec => 17, :imag_prec => 53)
|
247
|
+
The broad `:prec` and `:precision` values are parsed before the real- and
|
248
|
+
imaginary-specific values, so that
|
249
|
+
|
250
|
+
my_usual_options = {:rounding => MPC::MPC_RNDZZ, :prec => 64}
|
251
|
+
MPC.new(42).tan(my_usual_options.merge(:prec_real => 128))
|
252
|
+
will return the tangent of 42 with a precision of 64 on the real part and a
|
253
|
+
precision of 128 on the imaginary part.
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
## Complex Functions
|
263
|
+
|
264
|
+
### Initializing, Assigning Complex Numbers
|
265
|
+
|
266
|
+
\begin{tabular}{p{\methwidth} l r}
|
267
|
+
\toprule
|
268
|
+
\textbf{new} & & MPC.new $\rightarrow$ \textit{integer} \\
|
269
|
+
& & MPC.new(\textit{numeric = 0}) $\rightarrow$ \textit{integer} \\
|
270
|
+
& & MPC.new(\textit{str}, \textit{base = 0}) $\rightarrow$ \textit{integer} \\
|
271
|
+
\cmidrule(r){2-3}
|
272
|
+
& \multicolumn{2}{p{\defnwidth}}{
|
273
|
+
This method creates a new \texttt{MPC} integer. It typically takes one optional argument for
|
274
|
+
the value of the integer. This argument can be one of several classes. If the first
|
275
|
+
argument is a String, then a second argument, the base, may be optionally supplied.
|
276
|
+
Here are some examples:\newline
|
277
|
+
|
278
|
+
\texttt{MPC.new \qqqquad\qqqquad \#=> 0 (default) \newline
|
279
|
+
MPC.new(1) \qqqquad\qquad\ \#=> 1 (Ruby Fixnum) \newline
|
280
|
+
MPC.new("127") \qqqquad\ \#=> 127 (Ruby String)\newline
|
281
|
+
MPC.new("FF", 16) \qquad\ \ \#=> 255 (Ruby String with base)\newline
|
282
|
+
MPC.new("1Z", 36) \qquad\ \ \#=> 71 (Ruby String with base)\newline
|
283
|
+
MPC.new(4294967296) \qquad \#=> 4294967296 (Ruby Bignum)\newline
|
284
|
+
MPC.new(GMP::Z.new(31)) \#=> 31 (GMP Integer)}
|
285
|
+
}
|
286
|
+
\end{tabular}
|
287
|
+
|
288
|
+
\ifdef{HTML}
|
289
|
+
<table>
|
290
|
+
<tr class='new-method'>
|
291
|
+
<th>new</th><th>`MPC.new` $\rightarrow$ _integer_</th>
|
292
|
+
</tr>
|
293
|
+
<tr>
|
294
|
+
<th></th> <th><code>MPC.new(<em>numeric=0</em>)</code> $\rightarrow$ _integer_</th>
|
295
|
+
</tr>
|
296
|
+
<tr class='last-header'>
|
297
|
+
<th></th> <th><code>MPC.new(<em>string</em>)</code> $\rightarrow$ _integer_</th>
|
298
|
+
</tr>
|
299
|
+
<tr>
|
300
|
+
<td></td>
|
301
|
+
<td>
|
302
|
+
This method creates a new `MPC.new` integer. It typically takes one optional
|
303
|
+
argument for the value of the integer. This argument can be one of several
|
304
|
+
classes. If the first argument is a String, then a second argument, the base,
|
305
|
+
may be optionally supplied. Here are some examples:
|
306
|
+
|
307
|
+
<pre><code>MPC.new #=> 0 (default)
|
308
|
+
MPC.new(1) #=> 1 (Ruby Fixnum)
|
309
|
+
MPC.new("127") #=> 127 (Ruby String)
|
310
|
+
MPC.new("FF", 16) #=> 255 (Ruby String with base)
|
311
|
+
MPC.new("1Z", 36) #=> 71 (Ruby String with base)
|
312
|
+
MPC.new(4294967296) #=> 4294967296 (Ruby Bignum)
|
313
|
+
MPC.new(GMP::Z.new(31)) #=> 31 (GMP Integer)
|
314
|
+
</code></pre>
|
315
|
+
</td>
|
316
|
+
</tr>
|
317
|
+
</table>
|
318
|
+
\endif
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
### Converting Complex Numbers
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
### String and Stream Input and Output
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
### Complex Comparison
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
### Projection and Decomposing
|
355
|
+
|
356
|
+
\begin{tabular}{p{\methwidth} l r p{\returnwidth}}
|
357
|
+
\toprule
|
358
|
+
\textbf{real} & & MPC\#real() & $\rightarrow$ \textit{GMP::F} \\
|
359
|
+
& & MPC\#real(\textit{rounding\_mode} = MPC::MPC\_RNDNN) & $\rightarrow$ \textit{GMP::F} \\
|
360
|
+
\cmidrule(r){2-4}
|
361
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
362
|
+
Return the real part of the receiver, rounded according to
|
363
|
+
$rounding\_mode$.
|
364
|
+
} \\
|
365
|
+
|
366
|
+
\toprule
|
367
|
+
\textbf{imag} & & MPC\#imag() & $\rightarrow$ \textit{GMP::F} \\
|
368
|
+
& & MPC\#imag(\textit{rounding\_mode} = MPC::MPC\_RNDNN) & $\rightarrow$ \textit{GMP::F} \\
|
369
|
+
\cmidrule(r){2-4}
|
370
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
371
|
+
Return the imaginary part of the receiver, rounded according to
|
372
|
+
$rounding\_mode$.
|
373
|
+
} \\
|
374
|
+
|
375
|
+
\toprule
|
376
|
+
\textbf{proj} & & MPC\#proj() & $\rightarrow$ \textit{GMP::F} \\
|
377
|
+
& & MPC\#proj(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
378
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{GMP::F} \\
|
379
|
+
\cmidrule(r){2-4}
|
380
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
381
|
+
Return the projection of the receiver onto the Riemann sphere, rounded according to
|
382
|
+
$rounding\_mode$.
|
383
|
+
} \\
|
384
|
+
\end{tabular}
|
385
|
+
|
386
|
+
\ifdef{HTML}
|
387
|
+
<table>
|
388
|
+
<tr class="new-method">
|
389
|
+
<th>real</th><th>`MPC#real()` $\rightarrow$ _GMP::F_
|
390
|
+
</tr>
|
391
|
+
<tr class="last-header">
|
392
|
+
<th></th> <th><code>MPC#real(_rounding_mode_ = MPC::MPC_RNDNN)</code> $\rightarrow$ _GMP::F_
|
393
|
+
</th>
|
394
|
+
</tr>
|
395
|
+
<tr>
|
396
|
+
<td></td>
|
397
|
+
<td>
|
398
|
+
Return the real part of the receiver, rounded according to $rounding\_mode$.
|
399
|
+
</td>
|
400
|
+
</tr>
|
401
|
+
|
402
|
+
<tr class="new-method">
|
403
|
+
<th>imag</th><th>`MPC#imag()` $\rightarrow$ _GMP::F_
|
404
|
+
</tr>
|
405
|
+
<tr class="last-header">
|
406
|
+
<th></th> <th><code>MPC#imag(_rounding_mode_ = MPC::MPC_RNDNN)</code> $\rightarrow$ _GMP::F_
|
407
|
+
</th>
|
408
|
+
</tr>
|
409
|
+
<tr>
|
410
|
+
<td></td>
|
411
|
+
<td>
|
412
|
+
Return the imaginary part of the receiver, rounded according to $rounding\_mode$.
|
413
|
+
</td>
|
414
|
+
</tr>
|
415
|
+
|
416
|
+
<tr class="new-method">
|
417
|
+
<th>proj</th><th>`MPC#proj()` $\rightarrow$ _GMP::F_
|
418
|
+
</tr>
|
419
|
+
<tr>
|
420
|
+
<th></th> <th><code>MPC#proj(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _GMP::F_
|
421
|
+
</th>
|
422
|
+
</tr>
|
423
|
+
<tr class="last-header">
|
424
|
+
<th></th> <th>`MPC#proj(options_hash)` $\rightarrow$ _complex_</th>
|
425
|
+
</tr>
|
426
|
+
<tr>
|
427
|
+
<td></td>
|
428
|
+
<td>
|
429
|
+
Return the projection of the receiver onto the Riemann sphere, rounded
|
430
|
+
according to $rounding\_mode$.
|
431
|
+
</td>
|
432
|
+
</tr>
|
433
|
+
</table>
|
434
|
+
\endif
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
### Basic Arithmetic
|
444
|
+
|
445
|
+
\begin{tabular}{p{\methwidth} l r p{\returnwidth}}
|
446
|
+
\toprule
|
447
|
+
\textbf{add, +} & & MPC\#add($op2$) & $\rightarrow complex$ \\
|
448
|
+
& & MPC\#add($op2$, $rounding\_mode$ = MPC::MPC\_RNDNN) & $\rightarrow complex$ \\
|
449
|
+
& & $op1 + op2$ & $\rightarrow complex$ \\
|
450
|
+
\cmidrule(r){2-4}
|
451
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
452
|
+
Return the sum of the receiver ($op1$) and $op2$, rounded according to
|
453
|
+
$rounding\_mode$. $op2$ may be a \texttt{Fixnum}, \texttt{GMP::Z}, \texttt{Bignum}, or \texttt{GMP::F}.\newline
|
454
|
+
|
455
|
+
\texttt{a = MPC.new(GMP::F("3.1416", 12)) \#=> (3.1416 +0) \newline
|
456
|
+
a + 0 \qqqquad\qqqquad\qquad\qqqquad \#=> (3.1416 +0) \newline
|
457
|
+
a + 1 \qqqquad\qqqquad\qqqquad\qquad \#=> (4.1406 +0) \newline
|
458
|
+
a + GMP::Z(1024) \qqqquad\qqqquad\ \#=> (1.0270e+3 +0) \newline
|
459
|
+
a + 2**66 \qqqquad\qqqquad\qqqquad \#=> (7.3787e+19 +0) \newline
|
460
|
+
a + GMP::F("3.1416", 12) \qqqquad\ \#=> (6.2832 +0) \newline}
|
461
|
+
} \\
|
462
|
+
|
463
|
+
\toprule
|
464
|
+
\textbf{sub, -} & & MPC\#sub($op2$) & $\rightarrow complex$ \\
|
465
|
+
& & MPC\#sub($op2$, $rounding\_mode$ = MPC::MPC\_RNDNN) & $\rightarrow complex$ \\
|
466
|
+
& & $op1 - op2$ & $\rightarrow complex$ \\
|
467
|
+
\cmidrule(r){2-4}
|
468
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
469
|
+
Return the difference between the receiver ($op1$) and $op2$, rounded according to
|
470
|
+
$rounding\_mode$. $op2$ may be a \texttt{Fixnum}, \texttt{GMP::Z}, \texttt{Bignum}, or \texttt{GMP::F}.\newline
|
471
|
+
|
472
|
+
\texttt{a = MPC.new(GMP::F("3.1416", 12)) \#=> (3.1416 +0) \newline
|
473
|
+
a - 0 \qqqquad\qqqquad\qquad\qqqquad \#=> (3.1416 +0) \newline
|
474
|
+
a - 1 \qqqquad\qqqquad\qqqquad\qquad \#=> (2.1416 +0) \newline
|
475
|
+
a - GMP::Z(1024) \qqqquad\qqqquad\ \#=> (-1.0208e+3 +0) \newline
|
476
|
+
a - 2**66 \qqqquad\qqqquad\qqqquad \#=> (-7.3787e+19 +0) \newline
|
477
|
+
a - GMP::F("3.1416", 12) \qqqquad\ \#=> (+0 +0) \newline}
|
478
|
+
} \\
|
479
|
+
|
480
|
+
\toprule
|
481
|
+
\textbf{mul, *} & & MPC\#mul($op2$) & $\rightarrow complex$ \\
|
482
|
+
& & MPC\#mul($op2$, $rounding\_mode$ = MPC::MPC\_RNDNN) & $\rightarrow complex$ \\
|
483
|
+
& & $op1 * op2$ & $\rightarrow complex$ \\
|
484
|
+
\cmidrule(r){2-4}
|
485
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
486
|
+
Return the product of the receiver ($op1$) and $op2$, rounded according to
|
487
|
+
$rounding\_mode$. $op2$ may be a \texttt{Fixnum}, \texttt{GMP::Z}, \texttt{Bignum}, or \texttt{GMP::F}.\newline
|
488
|
+
|
489
|
+
\texttt{a = MPC.new(GMP::F("3.1416", 12)) \#=> (3.1416 +0) \newline
|
490
|
+
a * 0 \qqqquad\qqqquad\qquad\qqqquad \#=> (+0 +0) \newline
|
491
|
+
a * 1 \qqqquad\qqqquad\qqqquad\qquad \#=> (3.1416 +0) \newline
|
492
|
+
a * GMP::Z(1024) \qqqquad\qqqquad\ \#=> (3.2170e+3 +0) \newline
|
493
|
+
a * 2**66 \qqqquad\qqqquad\qqqquad \#=> (2.3181e+20 +0) \newline
|
494
|
+
a * GMP::F("3.1416", 12) \qqqquad\ \#=> (9.8711 +0) \newline}
|
495
|
+
}
|
496
|
+
\end{tabular}
|
497
|
+
|
498
|
+
\ifdef{HTML}
|
499
|
+
<table>
|
500
|
+
<tr class="new-method">
|
501
|
+
<th>add, +</th><th>`MPC#add(op2)` $\rightarrow$ _complex_
|
502
|
+
</tr>
|
503
|
+
<tr>
|
504
|
+
<th></th> <th><code>MPC#add(_op2_, _rounding_mode_ = MPC::MPC_RNDNN)</code> $\rightarrow$ _complex_
|
505
|
+
</th>
|
506
|
+
</tr>
|
507
|
+
<tr class="last-header">
|
508
|
+
<th></th> <th>`op1 + op2` $\rightarrow$ _complex_
|
509
|
+
</tr>
|
510
|
+
<tr>
|
511
|
+
<td></td>
|
512
|
+
<td>
|
513
|
+
Return the sum of the receiver ($op1$) and $op2$, rounded according to
|
514
|
+
$rounding\_mode$.
|
515
|
+
|
516
|
+
<pre><code>a = MPC.new(GMP::F("3.1416", 12)) #=> (3.1416 +0)
|
517
|
+
a + 0 #=> (3.1416 +0)
|
518
|
+
a + 1 #=> (4.1406 +0)
|
519
|
+
a + GMP::Z(1024) #=> (1.0270e+3 +0)
|
520
|
+
a + 2**66 #=> (7.3787e+19 +0)
|
521
|
+
a + GMP::F("3.1416", 12) #=> (6.2832 +0)
|
522
|
+
</code></pre>
|
523
|
+
</td>
|
524
|
+
</tr>
|
525
|
+
|
526
|
+
<tr class="new-method">
|
527
|
+
<th>sub, -</th><th>`MPC#sub(op2)` $\rightarrow$ _complex_
|
528
|
+
</tr>
|
529
|
+
<tr>
|
530
|
+
<th></th> <th><code>MPC#sub(_op2_, _rounding_mode_ = MPC::MPC_RNDNN)</code> $\rightarrow$ _complex_
|
531
|
+
</th>
|
532
|
+
</tr>
|
533
|
+
<tr class="last-header">
|
534
|
+
<th></th> <th>`op1 - op2` $\rightarrow$ _complex_
|
535
|
+
</tr>
|
536
|
+
<tr>
|
537
|
+
<td></td>
|
538
|
+
<td>
|
539
|
+
Return the difference between the receiver ($op1$) and $op2$, rounded according to
|
540
|
+
$rounding\_mode$.
|
541
|
+
|
542
|
+
<pre><code>a = MPC.new(GMP::F("3.1416", 12)) #=> (3.1416 +0)
|
543
|
+
a - 0 #=> (3.1416 +0)
|
544
|
+
a - 1 #=> (2.1416 +0)
|
545
|
+
a - GMP::Z(1024) #=> (-1.0208e+3 +0)
|
546
|
+
a - 2**66 #=> (-7.3787e+19 +0)
|
547
|
+
a - GMP::F("3.1416", 12) #=> (+0 +0)
|
548
|
+
</code></pre>
|
549
|
+
</td>
|
550
|
+
</tr>
|
551
|
+
|
552
|
+
<tr class="new-method">
|
553
|
+
<th>mul, *</th><th>`MPC#mul(op2)` $\rightarrow$ _complex_
|
554
|
+
</tr>
|
555
|
+
<tr>
|
556
|
+
<th></th> <th><code>MPC#mul(_op2_, _rounding_mode_ = MPC::MPC_RNDNN)</code> $\rightarrow$ _complex_
|
557
|
+
</th>
|
558
|
+
</tr>
|
559
|
+
<tr class="last-header">
|
560
|
+
<th></th> <th>`op1 * op2` $\rightarrow$ _complex_
|
561
|
+
</tr>
|
562
|
+
<tr>
|
563
|
+
<td></td>
|
564
|
+
<td>
|
565
|
+
Return the product of the receiver ($op1$) and $op2$, rounded according to
|
566
|
+
$rounding\_mode$.
|
567
|
+
|
568
|
+
<pre><code>a = MPC.new(GMP::F("3.1416", 12)) #=> (3.1416 +0)
|
569
|
+
a * 0 #=> (+0 +0)
|
570
|
+
a * 1 #=> (3.1416 +0)
|
571
|
+
a * GMP::Z(1024) #=> (3.2170e+3 +0)
|
572
|
+
a * 2**66 #=> (2.3181e+20 +0)
|
573
|
+
a * GMP::F("3.1416", 12) #=> (9.8711 +0)
|
574
|
+
</code></pre>
|
575
|
+
</td>
|
576
|
+
</tr>
|
577
|
+
</table>
|
578
|
+
\endif
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
### Power Functions and Logarithm
|
588
|
+
|
589
|
+
\begin{tabular}{p{\methwidth} l r p{\returnwidth}}
|
590
|
+
\toprule
|
591
|
+
\textbf{sqrt} & & MPC\#sqrt() & $\rightarrow$ \textit{complex} \\
|
592
|
+
& & MPC\#sqrt(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
593
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
594
|
+
& & MPC\#sqrt(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
595
|
+
\cmidrule(r){2-4}
|
596
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
597
|
+
Return the square root of the receiver, rounded according to
|
598
|
+
$rounding\_mode$. The returned value has a non-negative real part, and if its
|
599
|
+
real part is zero, a non-negative imaginary part.
|
600
|
+
} \\
|
601
|
+
|
602
|
+
\toprule
|
603
|
+
\textbf{pow} & & MPC\#pow() & $\rightarrow$ \textit{complex} \\
|
604
|
+
& \multicolumn{3}{p{\defnwidth}}{\textit{Not implemented yet.}} \\
|
605
|
+
|
606
|
+
\toprule
|
607
|
+
\textbf{exp} & & MPC\#exp() & $\rightarrow$ \textit{complex} \\
|
608
|
+
& & MPC\#exp(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
609
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
610
|
+
& & MPC\#exp(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
611
|
+
\cmidrule(r){2-4}
|
612
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
613
|
+
Return the exponential of the receiver, rounded according to
|
614
|
+
$rounding\_mode$.
|
615
|
+
} \\
|
616
|
+
|
617
|
+
\toprule
|
618
|
+
\textbf{log} & & MPC\#log() & $\rightarrow$ \textit{complex} \\
|
619
|
+
& & MPC\#log(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
620
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
621
|
+
& & MPC\#log(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
622
|
+
\cmidrule(r){2-4}
|
623
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
624
|
+
Return the natural logarithm of the receiver, rounded according to
|
625
|
+
$rounding\_mode$. The principal branch is chosen, with the branch cut on the
|
626
|
+
negative real axis, so that the imaginary part of the result lies in
|
627
|
+
$[-\pi, \pi]$ and $[-\pi/log(10), \pi/log(10)]$ respectively.
|
628
|
+
} \\
|
629
|
+
|
630
|
+
\toprule
|
631
|
+
\textbf{log10} & & MPC\#log10() & $\rightarrow$ \textit{complex} \\
|
632
|
+
& \multicolumn{3}{p{\defnwidth}}{\textit{Not implemented yet.}}
|
633
|
+
\end{tabular}
|
634
|
+
|
635
|
+
\ifdef{HTML}
|
636
|
+
<table>
|
637
|
+
<tr class="new-method">
|
638
|
+
<th>sqrt</th><th>`MPC#sqrt()` $\rightarrow$ _complex_
|
639
|
+
</tr>
|
640
|
+
<tr>
|
641
|
+
<th></th> <th><code>MPC#sqrt(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_
|
642
|
+
</th>
|
643
|
+
</tr>
|
644
|
+
<tr class="last-header">
|
645
|
+
<th></th> <th>`MPC#sqrt(options_hash)` $\rightarrow$ _complex_</th>
|
646
|
+
</tr>
|
647
|
+
<tr>
|
648
|
+
<td></td>
|
649
|
+
<td>
|
650
|
+
Return the square root of the receiver, rounded according to $rounding\_mode$.
|
651
|
+
The returned value has a non-negative real part, and if its real part is
|
652
|
+
zero, a non-negative imaginary part.
|
653
|
+
</td>
|
654
|
+
</tr>
|
655
|
+
|
656
|
+
<tr class="new-method last-header">
|
657
|
+
<th>pow</th><th>`MPC#pow()` $\rightarrow$ _complex_
|
658
|
+
</tr>
|
659
|
+
<tr>
|
660
|
+
<td></td>
|
661
|
+
<td>
|
662
|
+
_Not implemented yet._
|
663
|
+
</td>
|
664
|
+
</tr>
|
665
|
+
|
666
|
+
<tr class="new-method">
|
667
|
+
<th>exp</th><th>`MPC#exp()` $\rightarrow$ _complex_
|
668
|
+
</tr>
|
669
|
+
<tr>
|
670
|
+
<th></th> <th><code>MPC#exp(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_
|
671
|
+
</th>
|
672
|
+
</tr>
|
673
|
+
<tr class="last-header">
|
674
|
+
<th></th> <th>`MPC#exp(options_hash)` $\rightarrow$ _complex_</th>
|
675
|
+
</tr>
|
676
|
+
<tr>
|
677
|
+
<td></td>
|
678
|
+
<td>
|
679
|
+
Return the exponential of the receiver, rounded according to $rounding\_mode$.
|
680
|
+
</td>
|
681
|
+
</tr>
|
682
|
+
|
683
|
+
<tr class="new-method">
|
684
|
+
<th>log</th><th>`MPC#log()` $\rightarrow$ _complex_
|
685
|
+
</tr>
|
686
|
+
<tr>
|
687
|
+
<th></th> <th><code>MPC#log(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_
|
688
|
+
</th>
|
689
|
+
</tr>
|
690
|
+
<tr class="last-header">
|
691
|
+
<th></th> <th>`MPC#log(options_hash)` $\rightarrow$ _complex_</th>
|
692
|
+
</tr>
|
693
|
+
<tr>
|
694
|
+
<td></td>
|
695
|
+
<td>
|
696
|
+
Return the natural logarithm of the receiver, rounded according to
|
697
|
+
$rounding\_mode$. The principal branch is chosen, with the branch cut on the
|
698
|
+
negative real axis, so that the imaginary part of the result lies in
|
699
|
+
$[-\pi, \pi]$ and $[-\pi/log(10), \pi/log(10)]$ respectively.
|
700
|
+
</td>
|
701
|
+
</tr>
|
702
|
+
|
703
|
+
|
704
|
+
<tr class="new-method last-header">
|
705
|
+
<th>log10</th><th>`MPC#log10()` $\rightarrow$ _complex_
|
706
|
+
</tr>
|
707
|
+
<tr>
|
708
|
+
<td></td>
|
709
|
+
<td>
|
710
|
+
_Not implemented yet._
|
711
|
+
</td>
|
712
|
+
</tr>
|
713
|
+
</table>
|
714
|
+
\endif
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
### Trigonometric Functions
|
724
|
+
|
725
|
+
\begin{tabular}{p{\methwidth} l r p{\returnwidth}}
|
726
|
+
\toprule
|
727
|
+
\textbf{sin} & & MPC\#sin() & $\rightarrow$ \textit{complex} \\
|
728
|
+
& & MPC\#sin(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
729
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
730
|
+
& & MPC\#sin(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
731
|
+
\cmidrule(r){2-4}
|
732
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
733
|
+
Return the sine of the receiver, rounded according to
|
734
|
+
$rounding\_mode$.
|
735
|
+
} \\
|
736
|
+
|
737
|
+
\toprule
|
738
|
+
\textbf{cos} & & MPC\#cos() & $\rightarrow$ \textit{complex} \\
|
739
|
+
& & MPC\#cos(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
740
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
741
|
+
& & MPC\#cos(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
742
|
+
\cmidrule(r){2-4}
|
743
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
744
|
+
Return the cosine of the receiver, rounded according to
|
745
|
+
$rounding\_mode$.
|
746
|
+
} \\
|
747
|
+
|
748
|
+
\toprule
|
749
|
+
\textbf{sin\_cos} & & MPC\#sin\_cos() & $\rightarrow$ \textit{complex} \\
|
750
|
+
& \multicolumn{3}{p{\defnwidth}}{\textit{Not implemented yet.}} \\
|
751
|
+
|
752
|
+
\toprule
|
753
|
+
\textbf{tan} & & MPC\#tan() & $\rightarrow$ \textit{complex} \\
|
754
|
+
& & MPC\#tan(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
755
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
756
|
+
& & MPC\#tan(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
757
|
+
\cmidrule(r){2-4}
|
758
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
759
|
+
Return the tangent of the receiver, rounded according to
|
760
|
+
$rounding\_mode$.
|
761
|
+
} \\
|
762
|
+
|
763
|
+
\toprule
|
764
|
+
\textbf{sinh} & & MPC\#sinh() & $\rightarrow$ \textit{complex} \\
|
765
|
+
& & MPC\#sinh(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
766
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
767
|
+
& & MPC\#sinh(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
768
|
+
\cmidrule(r){2-4}
|
769
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
770
|
+
Return the hyperbolic sine of the receiver, rounded according to
|
771
|
+
$rounding\_mode$.
|
772
|
+
} \\
|
773
|
+
|
774
|
+
\toprule
|
775
|
+
\textbf{cosh} & & MPC\#cosh() & $\rightarrow$ \textit{complex} \\
|
776
|
+
& & MPC\#cosh(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
777
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
778
|
+
& & MPC\#cosh(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
779
|
+
\cmidrule(r){2-4}
|
780
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
781
|
+
Return the hyperbolic cosine of the receiver, rounded according to
|
782
|
+
$rounding\_mode$.
|
783
|
+
} \\
|
784
|
+
|
785
|
+
\toprule
|
786
|
+
\textbf{tanh} & & MPC\#tanh() & $\rightarrow$ \textit{complex} \\
|
787
|
+
& & MPC\#tanh(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
788
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow$ \textit{complex} \\
|
789
|
+
& & MPC\#tanh(\textit{options\_hash}) & $\rightarrow$ \textit{complex} \\
|
790
|
+
\cmidrule(r){2-4}
|
791
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
792
|
+
Return the hyperbolic tangent of the receiver, rounded according to
|
793
|
+
$rounding\_mode$.
|
794
|
+
}
|
795
|
+
\end{tabular}
|
796
|
+
|
797
|
+
\begin{tabular}{p{\methwidth} l r p{\returnwidth}}
|
798
|
+
\toprule
|
799
|
+
\textbf{asin} & & MPC\#asin() & $\rightarrow complex$ \\
|
800
|
+
& & MPC\#asin(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
801
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow complex$ \\
|
802
|
+
& & MPC\#asin(\textit{options\_hash}) & $\rightarrow complex$ \\
|
803
|
+
\cmidrule(r){2-4}
|
804
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
805
|
+
Return the inverse sine of the receiver, rounded according to
|
806
|
+
$rounding\_mode$.
|
807
|
+
} \\
|
808
|
+
|
809
|
+
\toprule
|
810
|
+
\textbf{acos} & & MPC\#acos() & $\rightarrow complex$ \\
|
811
|
+
& & MPC\#acos(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
812
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow complex$ \\
|
813
|
+
& & MPC\#acos(\textit{options\_hash}) & $\rightarrow complex$ \\
|
814
|
+
\cmidrule(r){2-4}
|
815
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
816
|
+
Return the inverse cosine of the receiver, rounded according to
|
817
|
+
$rounding\_mode$.
|
818
|
+
} \\
|
819
|
+
|
820
|
+
\toprule
|
821
|
+
\textbf{atan} & & MPC\#atan() & $\rightarrow complex$ \\
|
822
|
+
& & MPC\#atan(\textit{rounding\_mode} = MPC::MPC\_RNDNN, & \\
|
823
|
+
& & \textit{precision} = \textit{mpfr\_default\_precision}) & $\rightarrow complex$ \\
|
824
|
+
& & MPC\#atan(\textit{options\_hash}) & $\rightarrow complex$ \\
|
825
|
+
\cmidrule(r){2-4}
|
826
|
+
& \multicolumn{3}{p{\defnwidth}}{
|
827
|
+
Return the inverse tangent of the receiver, rounded according to
|
828
|
+
$rounding\_mode$.
|
829
|
+
}
|
830
|
+
\end{tabular}
|
831
|
+
|
832
|
+
\ifdef{HTML}
|
833
|
+
<table>
|
834
|
+
<tr class="new-method"><th>sin</th><th>`MPC#sin()` $\rightarrow$ _complex_</tr>
|
835
|
+
<tr><th></th> <th><code>MPC#sin(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
836
|
+
<tr class="last-header"><th></th> <th>`MPC#sin(options_hash)` $\rightarrow$ _complex_</th></tr>
|
837
|
+
<tr>
|
838
|
+
<td></td><td>
|
839
|
+
Return the sine of the receiver, rounded according to $rounding\_mode$.
|
840
|
+
</td>
|
841
|
+
</tr>
|
842
|
+
|
843
|
+
<tr class="new-method"><th>cos</th><th>`MPC#cos()` $\rightarrow$ _complex_</tr>
|
844
|
+
<tr><th></th> <th><code>MPC#cos(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
845
|
+
<tr class="last-header"><th></th> <th>`MPC#cos(options_hash)` $\rightarrow$ _complex_</th></tr>
|
846
|
+
<tr>
|
847
|
+
<td></td><td>
|
848
|
+
Return the cosine of the receiver, rounded according to $rounding\_mode$.
|
849
|
+
</td>
|
850
|
+
</tr>
|
851
|
+
|
852
|
+
<tr class="new-method last-header">
|
853
|
+
<th>sin_cos</th><th>`MPC#sin_cos()` $\rightarrow$ _complex_
|
854
|
+
</tr>
|
855
|
+
<tr>
|
856
|
+
<td></td>
|
857
|
+
<td>
|
858
|
+
_Not implemented yet._
|
859
|
+
</td>
|
860
|
+
</tr>
|
861
|
+
|
862
|
+
<tr class="new-method"><th>tan</th><th>`MPC#tan()` $\rightarrow$ _complex_</tr>
|
863
|
+
<tr><th></th> <th><code>MPC#tan(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
864
|
+
<tr class="last-header"><th></th> <th>`MPC#tan(options_hash)` $\rightarrow$ _complex_</th></tr>
|
865
|
+
<tr>
|
866
|
+
<td></td><td>
|
867
|
+
Return the tangent of the receiver, rounded according to $rounding\_mode$.
|
868
|
+
</td>
|
869
|
+
</tr>
|
870
|
+
|
871
|
+
<tr class="new-method"><th>sinh</th><th>`MPC#sinh()` $\rightarrow$ _complex_</tr>
|
872
|
+
<tr><th></th> <th><code>MPC#sinh(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
873
|
+
<tr class="last-header"><th></th> <th>`MPC#sinh(options_hash)` $\rightarrow$ _complex_</th></tr>
|
874
|
+
<tr>
|
875
|
+
<td></td><td>
|
876
|
+
Return the hyperbolic sine of the receiver, rounded according to
|
877
|
+
$rounding\_mode$.
|
878
|
+
</td>
|
879
|
+
</tr>
|
880
|
+
|
881
|
+
<tr class="new-method"><th>cosh</th><th>`MPC#cosh()` $\rightarrow$ _complex_</tr>
|
882
|
+
<tr><th></th> <th><code>MPC#cosh(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
883
|
+
<tr class="last-header"><th></th> <th>`MPC#cosh(options_hash)` $\rightarrow$ _complex_</th></tr>
|
884
|
+
<tr>
|
885
|
+
<td></td><td>
|
886
|
+
Return the hyperbolic cosine of the receiver, rounded according to $rounding\_mode$.
|
887
|
+
</td>
|
888
|
+
</tr>
|
889
|
+
|
890
|
+
<tr class="new-method"><th>tanh</th><th>`MPC#tanh()` $\rightarrow$ _complex_</tr>
|
891
|
+
<tr><th></th> <th><code>MPC#tanh(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
892
|
+
<tr class="last-header"><th></th> <th>`MPC#tanh(options_hash)` $\rightarrow$ _complex_</th></tr>
|
893
|
+
<tr>
|
894
|
+
<td></td><td>
|
895
|
+
Return the hyperbolic tangent of the receiver, rounded according to $rounding\_mode$.
|
896
|
+
</td>
|
897
|
+
</tr>
|
898
|
+
|
899
|
+
<tr class="new-method"><th>asin</th><th>`MPC#asin()` $\rightarrow$ _complex_</tr>
|
900
|
+
<tr><th></th> <th><code>MPC#asin(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
901
|
+
<tr class="last-header"><th></th> <th>`MPC#asin(options_hash)` $\rightarrow$ _complex_</th></tr>
|
902
|
+
<tr>
|
903
|
+
<td></td><td>
|
904
|
+
Return the inverse sine of the receiver, rounded according to
|
905
|
+
$rounding\_mode$.
|
906
|
+
</td>
|
907
|
+
</tr>
|
908
|
+
|
909
|
+
<tr class="new-method"><th>acos</th><th>`MPC#cosh()` $\rightarrow$ _complex_</tr>
|
910
|
+
<tr><th></th> <th><code>MPC#acos(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
911
|
+
<tr class="last-header"><th></th> <th>`MPC#acos(options_hash)` $\rightarrow$ _complex_</th></tr>
|
912
|
+
<tr>
|
913
|
+
<td></td><td>
|
914
|
+
Return the inverse cosine of the receiver, rounded according to $rounding\_mode$.
|
915
|
+
</td>
|
916
|
+
</tr>
|
917
|
+
|
918
|
+
<tr class="new-method"><th>atan</th><th>`MPC#atan()` $\rightarrow$ _complex_</tr>
|
919
|
+
<tr><th></th> <th><code>MPC#atan(_rounding_mode_ = MPC::MPC_RNDNN, _precision_ = _mpfr_default_)</code> $\rightarrow$ _complex_</th></tr>
|
920
|
+
<tr class="last-header"><th></th> <th>`MPC#atan(options_hash)` $\rightarrow$ _complex_</th></tr>
|
921
|
+
<tr>
|
922
|
+
<td></td><td>
|
923
|
+
Return the inverse tangent of the receiver, rounded according to $rounding\_mode$.
|
924
|
+
</td>
|
925
|
+
</tr>
|
926
|
+
</table>
|
927
|
+
\endif
|
928
|
+
|
929
|
+
### Miscellaneous Complex Functions
|
930
|
+
|
931
|
+
### Advanced Functions
|
932
|
+
|
933
|
+
### Internals
|