Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
complex.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_COMPLEX_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_COMPLEX_H
26#include "ruby/internal/value.h"
27#include "ruby/internal/arithmetic/long.h" /* INT2FIX is here. */
28
30
31/* complex.c */
32
33
41VALUE rb_complex_raw(VALUE real, VALUE imag);
42
50#define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
51
53#define rb_complex_raw2(x,y) rb_complex_raw((x), (y))
54
65VALUE rb_complex_new(VALUE real, VALUE imag);
66
74#define rb_complex_new1(x) rb_complex_new((x), INT2FIX(0))
75
77#define rb_complex_new2(x,y) rb_complex_new((x), (y))
78
88VALUE rb_complex_new_polar(VALUE abs, VALUE arg);
89
90RBIMPL_ATTR_DEPRECATED(("by: rb_complex_new_polar"))
92VALUE rb_complex_polar(VALUE abs, VALUE arg);
93
101VALUE rb_complex_real(VALUE z);
102
110VALUE rb_complex_imag(VALUE z);
111
120VALUE rb_complex_plus(VALUE x, VALUE y);
121
130VALUE rb_complex_minus(VALUE x, VALUE y);
131
140VALUE rb_complex_mul(VALUE x, VALUE y);
141
150VALUE rb_complex_div(VALUE x, VALUE y);
151
158VALUE rb_complex_uminus(VALUE z);
159
166VALUE rb_complex_conjugate(VALUE z);
167
174VALUE rb_complex_abs(VALUE z);
175
182VALUE rb_complex_arg(VALUE z);
183
192VALUE rb_complex_pow(VALUE base, VALUE exp);
193
202VALUE rb_dbl_complex_new(double real, double imag);
203
205#define rb_complex_add rb_complex_plus
206
208#define rb_complex_sub rb_complex_minus
209
211#define rb_complex_nagate rb_complex_uminus
212
236VALUE rb_Complex(VALUE real, VALUE imag);
237
246#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
247
249#define rb_Complex2(x,y) rb_Complex((x), (y))
250
252
253#endif /* RBIMPL_INTERN_COMPLEX_H */
Defines RBIMPL_ATTR_DEPRECATED.
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition: deprecated.h:36
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:97
VALUE rb_complex_polar(VALUE abs, VALUE arg)
Old name of rb_complex_new_polar.
Definition: complex.c:1540
VALUE rb_complex_uminus(VALUE z)
Performs negation of the passed object.
Definition: complex.c:758
VALUE rb_complex_div(VALUE x, VALUE y)
Performs division of the passed two objects.
Definition: complex.c:948
VALUE rb_complex_new(VALUE real, VALUE imag)
Constructs a Complex, by first multiplying the imaginary part with 1i then adds it to the real part.
Definition: complex.c:1528
VALUE rb_complex_plus(VALUE x, VALUE y)
Performs addition of the passed two objects.
Definition: complex.c:778
VALUE rb_complex_new_polar(VALUE abs, VALUE arg)
Constructs a Complex using polar representations.
Definition: complex.c:1534
VALUE rb_complex_arg(VALUE z)
Queries the argument (or the angle) of the passed object.
Definition: complex.c:1208
VALUE rb_complex_raw(VALUE real, VALUE imag)
Identical to rb_complex_new(), except it assumes both arguments are not instances of rb_cComplex.
Definition: complex.c:1522
VALUE rb_dbl_complex_new(double real, double imag)
Identical to rb_complex_new(), except it takes the arguments as C's double instead of Ruby's object.
Definition: complex.c:1555
VALUE rb_complex_abs(VALUE z)
Queries the absolute (or the magnitude) of the passed object.
Definition: complex.c:1161
VALUE rb_complex_real(VALUE z)
Queries the real part of the passed Complex.
Definition: complex.c:726
VALUE rb_complex_mul(VALUE x, VALUE y)
Performs multiplication of the passed two objects.
Definition: complex.c:872
VALUE rb_complex_conjugate(VALUE z)
Performs complex conjugation of the passed object.
Definition: complex.c:1254
VALUE rb_Complex(VALUE real, VALUE imag)
Converts various values into a Complex.
Definition: complex.c:1546
VALUE rb_complex_minus(VALUE x, VALUE y)
Performs subtraction of the passed two objects.
Definition: complex.c:812
VALUE rb_complex_pow(VALUE base, VALUE exp)
Performs exponentiation of the passed two objects.
Definition: complex.c:985
VALUE rb_complex_imag(VALUE z)
Queries the imaginary part of the passed Complex.
Definition: complex.c:743
RBIMPL_ATTR_PURE() int rb_io_read_pending(rb_io_t *fptr)
Queries if the passed IO has any pending reads.
Arithmetic conversion between C's long and Ruby's.
Defines RBIMPL_ATTR_PURE.
Defines VALUE and ID.