Ruby: include/ruby/internal/intern/complex.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

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
23#include "ruby/internal/attr/deprecated.h"
24#include "ruby/internal/attr/pure.h"
25#include "ruby/internal/dllexport.h"
26#include "ruby/internal/value.h"
27#include "ruby/internal/arithmetic/long.h" /* INT2FIX is here. */
28
29 RBIMPL_SYMBOL_EXPORT_BEGIN()
30
31/* complex.c */
32
33
41 VALUE 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
65 VALUE 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
88 VALUE rb_complex_new_polar(VALUE abs, VALUE arg);
89
90 RBIMPL_ATTR_DEPRECATED(("by: rb_complex_new_polar"))
92 VALUE rb_complex_polar(VALUE abs, VALUE arg);
93
94 RBIMPL_ATTR_PURE()
101 VALUE rb_complex_real(VALUE z);
102
103 RBIMPL_ATTR_PURE()
110 VALUE rb_complex_imag(VALUE z);
111
120 VALUE rb_complex_plus(VALUE x, VALUE y);
121
130 VALUE rb_complex_minus(VALUE x, VALUE y);
131
140 VALUE rb_complex_mul(VALUE x, VALUE y);
141
150 VALUE rb_complex_div(VALUE x, VALUE y);
151
158 VALUE rb_complex_uminus(VALUE z);
159
166 VALUE rb_complex_conjugate(VALUE z);
167
174 VALUE rb_complex_abs(VALUE z);
175
182 VALUE rb_complex_arg(VALUE z);
183
192 VALUE rb_complex_pow(VALUE base, VALUE exp);
193
202 VALUE 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
236 VALUE 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
251 RBIMPL_SYMBOL_EXPORT_END()
252
253#endif /* RBIMPL_INTERN_COMPLEX_H */
deprecated.h
Defines RBIMPL_ATTR_DEPRECATED.
RBIMPL_ATTR_DEPRECATED
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition deprecated.h:64
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
rb_complex_polar
VALUE rb_complex_polar(VALUE abs, VALUE arg)
Old name of rb_complex_new_polar.
Definition complex.c:1560
rb_complex_uminus
VALUE rb_complex_uminus(VALUE z)
Performs negation of the passed object.
Definition complex.c:767
rb_complex_div
VALUE rb_complex_div(VALUE x, VALUE y)
Performs division of the passed two objects.
Definition complex.c:957
rb_complex_new
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:1548
rb_complex_plus
VALUE rb_complex_plus(VALUE x, VALUE y)
Performs addition of the passed two objects.
Definition complex.c:787
rb_complex_new_polar
VALUE rb_complex_new_polar(VALUE abs, VALUE arg)
Constructs a Complex using polar representations.
Definition complex.c:1554
rb_complex_arg
VALUE rb_complex_arg(VALUE z)
Queries the argument (or the angle) of the passed object.
Definition complex.c:1228
rb_complex_raw
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:1542
rb_dbl_complex_new
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:1575
rb_complex_abs
VALUE rb_complex_abs(VALUE z)
Queries the absolute (or the magnitude) of the passed object.
Definition complex.c:1181
rb_complex_real
VALUE rb_complex_real(VALUE z)
Queries the real part of the passed Complex.
Definition complex.c:735
rb_complex_mul
VALUE rb_complex_mul(VALUE x, VALUE y)
Performs multiplication of the passed two objects.
Definition complex.c:881
rb_complex_conjugate
VALUE rb_complex_conjugate(VALUE z)
Performs complex conjugation of the passed object.
Definition complex.c:1274
rb_Complex
VALUE rb_Complex(VALUE real, VALUE imag)
Converts various values into a Complex.
Definition complex.c:1566
rb_complex_minus
VALUE rb_complex_minus(VALUE x, VALUE y)
Performs subtraction of the passed two objects.
Definition complex.c:821
rb_complex_pow
VALUE rb_complex_pow(VALUE base, VALUE exp)
Performs exponentiation of the passed two objects.
Definition complex.c:994
rb_complex_imag
VALUE rb_complex_imag(VALUE z)
Queries the imaginary part of the passed Complex.
Definition complex.c:752
long.h
Arithmetic conversion between C's long and Ruby's.
pure.h
Defines RBIMPL_ATTR_PURE.
RBIMPL_ATTR_PURE
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition pure.h:33
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40