Ruby 3.5.0dev (2025-02-20 revision 34098b669c0cbc024cd08e686891f1dfe0a10aaf)
complex.h
1#ifndef INTERNAL_COMPLEX_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_COMPLEX_H
11#include "ruby/internal/value.h" /* for struct RBasic */
12
13struct RComplex {
14 struct RBasic basic;
15 VALUE real;
16 VALUE imag;
17};
18
19#define RCOMPLEX(obj) ((struct RComplex *)(obj))
20
21/* shortcut macro for internal only */
22#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->real, (r))
23#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &RCOMPLEX(cmp)->imag, (i))
24
25/* complex.c */
26VALUE rb_dbl_complex_new_polar_pi(double abs, double ang);
27st_index_t rb_complex_hash(VALUE comp);
28
29#endif /* INTERNAL_COMPLEX_H */
Ruby object's base components.
Definition rbasic.h:63
Internal header for Complex.
Definition complex.h:13
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40