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

Ruby 3.4.8p72 (2025-12-17 revision 995b59f66677d44767ce9faac6957e5543617ff9)

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:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
rb_complex_polar
VALUE rb_complex_polar(VALUE x, VALUE y)
Old name of rb_complex_new_polar.
Definition complex.c:1767
rb_complex_uminus
VALUE rb_complex_uminus(VALUE z)
Performs negation of the passed object.
Definition complex.c:811
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:1755
rb_complex_plus
VALUE rb_complex_plus(VALUE x, VALUE y)
Performs addition of the passed two objects.
Definition complex.c:832
rb_complex_new_polar
VALUE rb_complex_new_polar(VALUE abs, VALUE arg)
Constructs a Complex using polar representations.
Definition complex.c:1761
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:1749
rb_Complex
VALUE rb_Complex(VALUE real, VALUE imag)
Converts various values into a Complex.
Definition complex.c:1773
rb_complex_minus
VALUE rb_complex_minus(VALUE x, VALUE y)
Performs subtraction of the passed two objects.
Definition complex.c:867
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