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

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

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
23#include "ruby/internal/attr/cold.h"
24#include "ruby/internal/attr/noreturn.h"
25#include "ruby/internal/dllexport.h"
26#include "ruby/internal/value.h"
27
35#define RB_NUM_COERCE_FUNCS_NEED_OPID 1
36
37 RBIMPL_SYMBOL_EXPORT_BEGIN()
38
39/* numeric.c */
40
41 RBIMPL_ATTR_NORETURN()
42 RBIMPL_ATTR_COLD()
48void 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
174 RBIMPL_ATTR_CONST()
185 VALUE rb_dbl_cmp(double lhs, double rhs);
186
204 RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y);
205
206 RBIMPL_SYMBOL_EXPORT_END()
207
208#endif /* RBIMPL_INTERN_NUMERIC_H */
cold.h
Defines RBIMPL_ATTR_COLD.
RBIMPL_ATTR_COLD
#define RBIMPL_ATTR_COLD()
Wraps (or simulates) __attribute__((cold))
Definition cold.h:34
RBIMPL_ATTR_CONST
#define RBIMPL_ATTR_CONST()
Wraps (or simulates) __attribute__((const))
Definition const.h:36
dllexport.h
Tweaking visibility of C variables/functions.
RUBY_EXTERN
#define RUBY_EXTERN
Declaration of externally visible global variables.
Definition dllexport.h:47
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_num_zerodiv
void rb_num_zerodiv(void)
Just always raises an exception.
Definition numeric.c:200
rb_num2fix
VALUE rb_num2fix(VALUE val)
Converts a numeric value into a Fixnum.
Definition numeric.c:3382
rb_fix2str
VALUE rb_fix2str(VALUE val, int base)
Generates a place-value representation of the given Fixnum, with given radix.
Definition numeric.c:3853
rb_int_positive_pow
VALUE rb_int_positive_pow(long x, unsigned long y)
Raises the passed x to the power of y.
Definition numeric.c:4492
rb_dbl_cmp
VALUE rb_dbl_cmp(double lhs, double rhs)
Compares two doubles.
Definition numeric.c:1661
rb_num_coerce_bit
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:4923
rb_num_coerce_relop
VALUE rb_num_coerce_relop(VALUE lhs, VALUE rhs, ID op)
Identical to rb_num_coerce_cmp(), except for return values.
Definition numeric.c:493
rb_num_coerce_cmp
VALUE rb_num_coerce_cmp(VALUE lhs, VALUE rhs, ID op)
Identical to rb_num_coerce_bin(), except for return values.
Definition numeric.c:478
rb_num_coerce_bin
VALUE rb_num_coerce_bin(VALUE lhs, VALUE rhs, ID op)
Coerced binary operation.
Definition numeric.c:471
noreturn.h
Defines RBIMPL_ATTR_NORETURN.
RBIMPL_ATTR_NORETURN
#define RBIMPL_ATTR_NORETURN()
Wraps (or simulates) [[noreturn]]
Definition noreturn.h:38
value.h
Defines VALUE and ID.
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40