Ruby  3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
numeric.h
Go to the documentation of this file.
1 #ifndef RBIMPL_INTERN_NUMERIC_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_INTERN_NUMERIC_H
26 #include "ruby/internal/value.h"
27 
35 #define RB_NUM_COERCE_FUNCS_NEED_OPID 1
36 
38 
39 /* numeric.c */
40 
48 void rb_num_zerodiv(void);
49 
107 VALUE rb_num_coerce_bin(VALUE lhs, VALUE rhs, ID op);
108 
119 VALUE rb_num_coerce_cmp(VALUE lhs, VALUE rhs, ID op);
120 
131 VALUE rb_num_coerce_relop(VALUE lhs, VALUE rhs, ID op);
132 
143 VALUE rb_num_coerce_bit(VALUE lhs, VALUE rhs, ID op);
144 
160 VALUE rb_num2fix(VALUE val);
161 
172 VALUE rb_fix2str(VALUE val, int base);
173 
185 VALUE rb_dbl_cmp(double lhs, double rhs);
186 
204 RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y);
205 
207 
208 #endif /* RBIMPL_INTERN_NUMERIC_H */
Defines RBIMPL_ATTR_COLD.
#define RBIMPL_ATTR_COLD()
Wraps (or simulates) __attribute__((cold))
Definition: cold.h:32
Tweaking visibility of C variables/functions.
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition: dllexport.h:45
#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
void rb_num_zerodiv(void)
Just always raises an exception.
Definition: numeric.c:206
VALUE rb_num2fix(VALUE val)
Converts a numeric value into a Fixnum.
Definition: numeric.c:3442
VALUE rb_fix2str(VALUE val, int base)
Generates a place-value representation of the given Fixnum, with given radix.
Definition: numeric.c:3909
VALUE rb_int_positive_pow(long x, unsigned long y)
Raises the passed x to the power of y.
Definition: numeric.c:4559
VALUE rb_dbl_cmp(double lhs, double rhs)
Compares two doubles.
Definition: numeric.c:1633
VALUE rb_num_coerce_bit(VALUE lhs, VALUE rhs, ID op)
This one is optimised for bitwise operations, but the API is identical to rb_num_coerce_bin().
Definition: numeric.c:4987
VALUE rb_num_coerce_relop(VALUE lhs, VALUE rhs, ID op)
Identical to rb_num_coerce_cmp(), except for return values.
Definition: numeric.c:499
VALUE rb_num_coerce_cmp(VALUE lhs, VALUE rhs, ID op)
Identical to rb_num_coerce_bin(), except for return values.
Definition: numeric.c:484
VALUE rb_num_coerce_bin(VALUE lhs, VALUE rhs, ID op)
Coerced binary operation.
Definition: numeric.c:477
RBIMPL_ATTR_CONST() int rb_io_oflags_fmode(int oflags)
Converts an oflags (that rb_io_modestr_oflags() returns) to a fmode (that rb_io_mode_flags() returns)...
RBIMPL_ATTR_NORETURN() void rb_eof_error(void)
Utility function to raise rb_eEOFError.
Defines RBIMPL_ATTR_NORETURN.
Defines VALUE and ID.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition: value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40