Ruby  3.4.0dev (2024-11-05 revision e440268d51fe02b303e3817a7a733a0dac1c5091)
rational.h
Go to the documentation of this file.
1 #ifndef RBIMPL_INTERN_RATIONAL_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_INTERN_RATIONAL_H
25 #include "ruby/internal/value.h"
26 #include "ruby/internal/arithmetic/long.h" /* INT2FIX is here. */
27 
29 
30 /* rational.c */
31 
32 
43 
51 #define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
52 
54 #define rb_rational_raw2(x,y) rb_rational_raw((x), (y))
55 
66 
74 #define rb_rational_new1(x) rb_rational_new((x), INT2FIX(1))
75 
77 #define rb_rational_new2(x,y) rb_rational_new((x), (y))
78 
106 VALUE rb_Rational(VALUE num, VALUE den);
107 
116 #define rb_Rational1(x) rb_Rational((x), INT2FIX(1))
117 
119 #define rb_Rational2(x,y) rb_Rational((x), (y))
120 
129 
139 
160 
169 
171 
172 #endif /* RBIMPL_INTERN_RATIONAL_H */
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:74
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:65
VALUE rb_rational_raw(VALUE num, VALUE den)
Identical to rb_rational_new(), except it skips argument validations.
Definition: rational.c:1961
VALUE rb_rational_new(VALUE num, VALUE den)
Constructs a Rational, with reduction.
Definition: rational.c:1975
VALUE rb_Rational(VALUE num, VALUE den)
Converts various values into a Rational.
Definition: rational.c:1981
VALUE rb_rational_num(VALUE rat)
Queries the numerator of the passed Rational.
Definition: rational.c:1990
VALUE rb_flt_rationalize(VALUE flt)
Identical to rb_flt_rationalize_with_prec(), except it auto-detects appropriate precision depending o...
Definition: rational.c:2243
VALUE rb_flt_rationalize_with_prec(VALUE flt, VALUE prec)
Simplified approximation of a float.
Definition: rational.c:2227
VALUE rb_rational_den(VALUE rat)
Queries the denominator of the passed Rational.
Definition: rational.c:1996
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.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40