Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
|
#include "ruby/encoding.h"
#include "ruby/util.h"
#include "internal.h"
#include "id.h"
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
Go to the source code of this file.
Variables | |
const union bytesequence4_or_float | rb_infinity = {{0x00, 0x00, 0x80, 0x7f}} |
const union bytesequence4_or_float | rb_nan = {{0x00, 0x00, 0xc0, 0x7f}} |
VALUE | rb_cNumeric |
VALUE | rb_cFloat |
VALUE | rb_cInteger |
VALUE | rb_eZeroDivError |
VALUE | rb_eFloatDomainError |
#define DEFINE_INT_SQRT | ( | rettype, | |
prefix, | |||
argtype | |||
) |
#define domain_error | ( | msg | ) | rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg) |
#define FIT_SQRT_LONG | ( | n | ) | (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX)) |
#define flo_eq rb_float_equal |
#define flo_eql rb_float_eql |
#define FLOAT_OUT_OF_RANGE | ( | val, | |
type | |||
) |
#define int_succ rb_int_succ |
#define method_basic_p | ( | klass | ) | rb_method_basic_definition_p(klass, mid) |
#define num_clone rb_immutable_obj_clone |
#define NUMERR_NEGATIVE 2 |
#define NUMERR_TOOLARGE 3 |
#define NUMERR_TYPE 1 |
#define rb_intern | ( | str | ) | rb_intern_const(str) |
#define SQRT_LONG_MAX HALF_LONG_MSB |
NORETURN | ( | static void | coerce_failedVALUE x, VALUE y | ) |
NORETURN | ( | static void | num_funcall_op_1_recursionVALUE x, ID func, VALUE y | ) |
NORETURN | ( | static void | rb_out_of_shortSIGNED_VALUE num | ) |
Definition at line 6911 of file bignum.c.
References BDIGIT, BDIGITS, BIGNUM_LEN, len, n, and rb_bdigit_dbl_isqrt.
VALUE rb_enc_uint_chr | ( | unsigned int | code, |
rb_encoding * | enc | ||
) |
Definition at line 3380 of file numeric.c.
References n, ONIGERR_INVALID_CODE_POINT_VALUE, ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, rb_enc_codelen(), rb_enc_mbcput, rb_enc_name, rb_enc_precise_mbclen(), rb_enc_str_new(), rb_eRangeError, rb_raise(), RSTRING_END, RSTRING_PTR, and str.
Referenced by rb_io_ungetc().
Definition at line 3055 of file numeric.c.
References FIX2LONG, FIXNUM_P, and rb_num2long().
Definition at line 3513 of file numeric.c.
References buf, CHAR_BIT, FIX2LONG, int, long, neg, rb_bug(), rb_eArgError, rb_raise(), rb_usascii_str_new, rb_usascii_str_new2, ruby_digitmap, and SIZEOF_VALUE.
Referenced by rb_int2str().
Definition at line 3074 of file numeric.c.
References FIX2ULONG, FIXNUM_P, and rb_num2ushort().
MJIT_FUNC_EXPORTED VALUE rb_fix_aref | ( | VALUE | fix, |
VALUE | idx | ||
) |
Definition at line 4649 of file numeric.c.
References BIGNUM_SIGN, CHAR_BIT, FIX2LONG, FIXNUM_P, i, INT2FIX, rb_big_norm(), rb_to_int(), and SIZEOF_LONG.
MJIT_FUNC_EXPORTED VALUE rb_flo_div_flo | ( | VALUE | x, |
VALUE | y | ||
) |
Definition at line 1110 of file numeric.c.
References RFLOAT_VALUE.
Definition at line 1698 of file numeric.c.
References DBL2NUM, fabs(), and RFLOAT_VALUE.
MJIT_FUNC_EXPORTED int rb_float_cmp | ( | VALUE | x, |
VALUE | y | ||
) |
Definition at line 1126 of file numeric.c.
References FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Referenced by fun2().
MJIT_FUNC_EXPORTED VALUE rb_float_eql | ( | VALUE | x, |
VALUE | y | ||
) |
MJIT_FUNC_EXPORTED VALUE rb_float_equal | ( | VALUE | x, |
VALUE | y | ||
) |
Definition at line 1383 of file numeric.c.
References isnan, Qfalse, rb_integer_float_eq(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Definition at line 1503 of file numeric.c.
References FIX2LONG, FIXNUM_P, isnan, Qfalse, Qtrue, rb_integer_float_cmp(), rb_num_coerce_relop(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Definition at line 1048 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Definition at line 1072 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Definition at line 895 of file numeric.c.
References FL_WB_PROTECTED, NEWOBJ_OF, OBJ_FREEZE, rb_cFloat, RGENGC_WB_PROTECTED_FLOAT, and T_FLOAT.
Definition at line 1024 of file numeric.c.
References DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.
Definition at line 1298 of file numeric.c.
References DBL2NUM, double, FIX2LONG, idPow, pow(), rb_big2dbl(), rb_dbl_complex_new_polar_pi(), rb_num_coerce_bin(), RB_TYPE_P, RFLOAT_VALUE, round(), T_BIGNUM, T_FIXNUM, and T_FLOAT.
Referenced by rb_num_pow().
Definition at line 1011 of file numeric.c.
References DBL2NUM, and RFLOAT_VALUE.
Definition at line 3567 of file numeric.c.
References FIXNUM_P, rb_any_to_s(), rb_big2str(), rb_fix2str(), RB_TYPE_P, and T_BIGNUM.
Definition at line 3766 of file numeric.c.
References DBL2NUM, Qnil, rb_int_fdiv_double(), and RB_INTEGER_TYPE_P.
Definition at line 3733 of file numeric.c.
References FIXNUM_P, FIXNUM_ZERO_P, rb_gcd(), rb_int_idiv(), and RB_INTEGER_TYPE_P.
Referenced by rb_int_fdiv().
Definition at line 307 of file numeric.c.
Referenced by rb_int_powm().
Definition at line 3227 of file numeric.c.
References FIXNUM_P, INT2FIX, Qfalse, Qtrue, rb_big_odd_p(), rb_funcall, RB_TYPE_P, and T_BIGNUM.
Definition at line 4111 of file numeric.c.
References FIXNUM_P.
Referenced by rb_int_powm(), and rb_num_pow().
Definition at line 3088 of file numeric.c.
References FIXABLE, FIXNUM_P, LONG2FIX, rb_eRangeError, rb_num2long(), rb_raise(), and v.
Definition at line 3002 of file numeric.c.
References rb_num2long().
Definition at line 2854 of file numeric.c.
References FIX2LONG, FIXNUM_P, FLOAT_OUT_OF_RANGE, LONG_MAX_PLUS_ONE, LONG_MIN_MINUS_ONE_IS_LESS_THAN, NIL_P, rb_big2long(), rb_eTypeError, rb_raise(), rb_to_int(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, and T_FLOAT.
Referenced by rb_fix2short(), rb_num2fix(), rb_num2int(), and rb_num2short().
Definition at line 3046 of file numeric.c.
References rb_num2long().
Definition at line 3064 of file numeric.c.
Referenced by rb_fix2ushort().
Definition at line 446 of file numeric.c.
Referenced by rb_big_divmod(), rb_big_modulo(), rb_big_mul(), rb_big_remainder(), rb_float_div(), rb_float_minus(), rb_float_mul(), rb_float_plus(), and rb_float_pow().
Definition at line 4431 of file numeric.c.
Referenced by rb_big_and(), rb_big_or(), and rb_big_xor().
enum ruby_num_rounding_mode rb_num_get_rounding_option | ( | VALUE | opts | ) |
Definition at line 200 of file numeric.c.
References NIL_P, PRIsVALUE, rb_check_string_type(), rb_eArgError, rb_get_kwargs(), rb_intern_const, rb_memcicmp(), rb_raise(), rb_sym2str(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, RUBY_NUM_ROUND_DEFAULT, RUBY_NUM_ROUND_HALF_DOWN, RUBY_NUM_ROUND_HALF_EVEN, RUBY_NUM_ROUND_HALF_UP, str, strncasecmp(), SYMBOL_P, and T_STRING.
Definition at line 4123 of file numeric.c.
References BUILTIN_TYPE, NIL_P, Qnil, rb_complex_pow(), rb_float_pow(), RB_FLOAT_TYPE_P, rb_int_pow(), rb_rational_pow(), SPECIAL_CONST_P, T_COMPLEX, and T_RATIONAL.
Definition at line 244 of file numeric.c.
References BIGNUM_NEGATIVE_P, FIX2LONG, FIXNUM_P, int, NULL, NUMERR_NEGATIVE, NUMERR_TOOLARGE, NUMERR_TYPE, rb_absint_size(), rb_big2ulong(), RB_TYPE_P, T_BIGNUM, UINT_MAX, and v.
Referenced by rb_str_concat().
Definition at line 194 of file numeric.c.
References rb_eZeroDivError, and rb_raise().
Referenced by rb_big_divrem_normal(), and rb_int_powm().
MJIT_FUNC_EXPORTED double ruby_float_mod | ( | double | x, |
double | y | ||
) |
Definition at line 2500 of file numeric.c.
References DBL_EPSILON, err, fabs(), floor(), HUGE_VAL, isinf, and n.
Referenced by ruby_float_step().
const union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}} |
const union bytesequence4_or_float rb_nan = {{0x00, 0x00, 0xc0, 0x7f}} |