Ruby  2.5.0dev(2017-10-22revision60238)
Macros | Functions | Variables
numeric.c File Reference
#include "internal.h"
#include "ruby/util.h"
#include "id.h"
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define FLT_RADIX   2
 
#define FLT_ROUNDS   1
 
#define DBL_MIN   2.2250738585072014e-308
 
#define DBL_MAX   1.7976931348623157e+308
 
#define DBL_MIN_EXP   (-1021)
 
#define DBL_MAX_EXP   1024
 
#define DBL_MIN_10_EXP   (-307)
 
#define DBL_MAX_10_EXP   308
 
#define DBL_DIG   15
 
#define DBL_MANT_DIG   53
 
#define DBL_EPSILON   2.2204460492503131e-16
 
#define id_to_i   idTo_i
 
#define id_eq   idEq
 
#define id_cmp   idCmp
 
#define NUMERR_TYPE   1
 
#define NUMERR_NEGATIVE   2
 
#define NUMERR_TOOLARGE   3
 
#define method_basic_p(klass)   rb_method_basic_definition_p(klass, mid)
 
#define num_clone   rb_immutable_obj_clone
 
#define num_dup   num_uplus
 
#define flo_eq   rb_float_equal
 
#define flo_eql   rb_float_eql
 
#define FLOAT_OUT_OF_RANGE(val, type)
 
#define LONG_MIN_MINUS_ONE   ((double)LONG_MIN-1)
 
#define LONG_MAX_PLUS_ONE   (2*(double)(LONG_MAX/2+1))
 
#define ULONG_MAX_PLUS_ONE   (2*(double)(ULONG_MAX/2+1))
 
#define LONG_MIN_MINUS_ONE_IS_LESS_THAN(n)
 
#define int_succ   rb_int_succ
 
#define int_pred   rb_int_pred
 
#define SQRT_LONG_MAX   ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))
 
#define FIT_SQRT_LONG(n)   (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX))
 
#define DEFINE_INT_SQRT(rettype, prefix, argtype)
 
#define RB_ULONG_IN_DOUBLE_P(n)   1
 
#define RB_ULONG_TO_DOUBLE(n)   (double)(n)
 
#define RB_ULONG   unsigned long
 
#define domain_error(msg)   rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)
 
#define rb_intern(str)   rb_intern_const(str)
 

Functions

double round (double x)
 
VALUE rb_int_floor (VALUE num, int ndigits)
 
VALUE rb_int_ceil (VALUE num, int ndigits)
 
void rb_num_zerodiv (void)
 
enum ruby_num_rounding_mode rb_num_get_rounding_option (VALUE opts)
 
int rb_num_to_uint (VALUE val, unsigned int *ret)
 
int rb_num_negative_p (VALUE num)
 
 NORETURN (static void coerce_failed(VALUE x, VALUE y))
 
VALUE rb_num_coerce_bin (VALUE x, VALUE y, ID func)
 
VALUE rb_num_coerce_cmp (VALUE x, VALUE y, ID func)
 
VALUE rb_num_coerce_relop (VALUE x, VALUE y, ID func)
 
VALUE rb_float_new_in_heap (double d)
 
VALUE rb_float_uminus (VALUE flt)
 
double ruby_float_mod (double x, double y)
 
VALUE rb_float_pow (VALUE x, VALUE y)
 
VALUE rb_float_equal (VALUE x, VALUE y)
 
VALUE rb_dbl_hash (double d)
 
VALUE rb_dbl_cmp (double a, double b)
 
int rb_float_cmp (VALUE x, VALUE y)
 
VALUE rb_float_gt (VALUE x, VALUE y)
 
VALUE rb_float_eql (VALUE x, VALUE y)
 
VALUE rb_float_abs (VALUE flt)
 
VALUE rb_flo_is_infinite_p (VALUE num)
 
VALUE rb_flo_is_finite_p (VALUE num)
 
VALUE rb_int_round (VALUE num, int ndigits, enum ruby_num_rounding_mode mode)
 
VALUE rb_int_truncate (VALUE num, int ndigits)
 
int ruby_float_step (VALUE from, VALUE to, VALUE step, int excl)
 
VALUE ruby_num_interval_step_size (VALUE from, VALUE to, VALUE step, int excl)
 
long rb_num2long (VALUE val)
 
unsigned long rb_num2ulong (VALUE val)
 
long rb_num2int (VALUE val)
 
long rb_fix2int (VALUE val)
 
 NORETURN (static void rb_out_of_short(SIGNED_VALUE num))
 
short rb_num2short (VALUE val)
 
short rb_fix2short (VALUE val)
 
unsigned short rb_num2ushort (VALUE val)
 
unsigned short rb_fix2ushort (VALUE val)
 
VALUE rb_num2fix (VALUE val)
 
VALUE rb_int_succ (VALUE num)
 
VALUE rb_int_pred (VALUE num)
 
VALUE rb_enc_uint_chr (unsigned int code, rb_encoding *enc)
 
VALUE rb_int_uminus (VALUE num)
 
VALUE rb_fix2str (VALUE x, int base)
 
VALUE rb_int2str (VALUE x, int base)
 
VALUE rb_fix_plus (VALUE x, VALUE y)
 
VALUE rb_int_plus (VALUE x, VALUE y)
 
VALUE rb_int_minus (VALUE x, VALUE y)
 
VALUE rb_int_mul (VALUE x, VALUE y)
 
double rb_int_fdiv_double (VALUE x, VALUE y)
 
VALUE rb_int_fdiv (VALUE x, VALUE y)
 
VALUE rb_int_div (VALUE x, VALUE y)
 
VALUE rb_int_idiv (VALUE x, VALUE y)
 
VALUE rb_int_modulo (VALUE x, VALUE y)
 
VALUE int_remainder (VALUE x, VALUE y)
 
VALUE rb_int_divmod (VALUE x, VALUE y)
 
VALUE rb_int_positive_pow (long x, unsigned long y)
 
VALUE rb_int_pow (VALUE x, VALUE y)
 
VALUE rb_int_equal (VALUE x, VALUE y)
 
VALUE rb_int_cmp (VALUE x, VALUE y)
 
VALUE rb_int_gt (VALUE x, VALUE y)
 
VALUE rb_int_ge (VALUE x, VALUE y)
 
VALUE rb_num_coerce_bit (VALUE x, VALUE y, ID func)
 
VALUE rb_int_and (VALUE x, VALUE y)
 
VALUE rb_int_lshift (VALUE x, VALUE y)
 
VALUE rb_int_abs (VALUE num)
 
VALUE rb_big_isqrt (VALUE)
 
void Init_Numeric (void)
 
double rb_float_value (VALUE v)
 
VALUE rb_float_new (double d)
 

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
 

Macro Definition Documentation

◆ DBL_DIG

#define DBL_DIG   15

Definition at line 54 of file numeric.c.

Referenced by rb_cstr_to_dbl(), and ruby_strtod().

◆ DBL_EPSILON

#define DBL_EPSILON   2.2204460492503131e-16

Definition at line 60 of file numeric.c.

Referenced by nextafter().

◆ DBL_MANT_DIG

#define DBL_MANT_DIG   53

Definition at line 57 of file numeric.c.

◆ DBL_MAX

#define DBL_MAX   1.7976931348623157e+308

Definition at line 39 of file numeric.c.

Referenced by nextafter().

◆ DBL_MAX_10_EXP

#define DBL_MAX_10_EXP   308

Definition at line 51 of file numeric.c.

◆ DBL_MAX_EXP

#define DBL_MAX_EXP   1024

Definition at line 45 of file numeric.c.

Referenced by ruby_hdtoa().

◆ DBL_MIN

#define DBL_MIN   2.2250738585072014e-308

Definition at line 36 of file numeric.c.

Referenced by nextafter().

◆ DBL_MIN_10_EXP

#define DBL_MIN_10_EXP   (-307)

Definition at line 48 of file numeric.c.

◆ DBL_MIN_EXP

#define DBL_MIN_EXP   (-1021)

Definition at line 42 of file numeric.c.

Referenced by nextafter().

◆ DEFINE_INT_SQRT

#define DEFINE_INT_SQRT (   rettype,
  prefix,
  argtype 
)
Value:
rettype \
prefix##_isqrt(argtype n) \
{ \
if (!argtype##_IN_DOUBLE_P(n)) { \
unsigned int b = bit_length(n); \
argtype t; \
rettype x = (rettype)(n >> (b/2+1)); \
x |= ((rettype)1LU << (b-1)/2); \
while ((t = n/x) < (argtype)x) x = (rettype)((x + t) >> 1); \
return x; \
} \
return (rettype)sqrt(argtype##_TO_DOUBLE(n)); \
}
#define bit_length(x)
Definition: internal.h:518

Definition at line 5140 of file numeric.c.

◆ domain_error

#define domain_error (   msg)    rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)

Definition at line 5178 of file numeric.c.

◆ FIT_SQRT_LONG

#define FIT_SQRT_LONG (   n)    (((n)<SQRT_LONG_MAX)&&((n)>=-SQRT_LONG_MAX))

Definition at line 3572 of file numeric.c.

◆ flo_eq

#define flo_eq   rb_float_equal

Definition at line 1401 of file numeric.c.

◆ flo_eql

#define flo_eql   rb_float_eql

Definition at line 1662 of file numeric.c.

◆ FLOAT_OUT_OF_RANGE

#define FLOAT_OUT_OF_RANGE (   val,
  type 
)
Value:
do { \
char buf[24]; \
rb_raise(rb_eRangeError, "float %s out of range of "type, \
out_of_range_float(&buf, (val))); \
} while (0)
VALUE rb_eRangeError
Definition: error.c:805
#define val
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4309

Definition at line 2784 of file numeric.c.

Referenced by rb_num2fix(), and rb_num2long().

◆ FLT_RADIX

#define FLT_RADIX   2

Definition at line 30 of file numeric.c.

◆ FLT_ROUNDS

#define FLT_ROUNDS   1

Definition at line 33 of file numeric.c.

◆ id_cmp

#define id_cmp   idCmp

Definition at line 177 of file numeric.c.

◆ id_eq

#define id_eq   idEq

Definition at line 176 of file numeric.c.

◆ id_to_i

#define id_to_i   idTo_i

Definition at line 175 of file numeric.c.

Referenced by fun1().

◆ int_pred

#define int_pred   rb_int_pred

Definition at line 3267 of file numeric.c.

◆ int_succ

#define int_succ   rb_int_succ

Definition at line 3241 of file numeric.c.

◆ LONG_MAX_PLUS_ONE

#define LONG_MAX_PLUS_ONE   (2*(double)(LONG_MAX/2+1))

Definition at line 2791 of file numeric.c.

Referenced by rb_num2long().

◆ LONG_MIN_MINUS_ONE

#define LONG_MIN_MINUS_ONE   ((double)LONG_MIN-1)

Definition at line 2790 of file numeric.c.

◆ LONG_MIN_MINUS_ONE_IS_LESS_THAN

#define LONG_MIN_MINUS_ONE_IS_LESS_THAN (   n)
Value:
LONG_MIN <= (n): \
LONG_MIN_MINUS_ONE < (n))
#define LONG_MIN
Definition: ruby.h:193
#define LONG_MIN_MINUS_ONE
Definition: numeric.c:2790

Definition at line 2793 of file numeric.c.

Referenced by rb_num2long().

◆ method_basic_p

#define method_basic_p (   klass)    rb_method_basic_definition_p(klass, mid)

Definition at line 272 of file numeric.c.

◆ num_clone

#define num_clone   rb_immutable_obj_clone

Definition at line 535 of file numeric.c.

◆ num_dup

#define num_dup   num_uplus

Definition at line 551 of file numeric.c.

◆ NUMERR_NEGATIVE

#define NUMERR_NEGATIVE   2

Referenced by rb_num_to_uint().

◆ NUMERR_TOOLARGE

#define NUMERR_TOOLARGE   3

Referenced by rb_num_to_uint().

◆ NUMERR_TYPE

#define NUMERR_TYPE   1

Referenced by rb_num_to_uint().

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

◆ RB_ULONG

#define RB_ULONG   unsigned long

Definition at line 5161 of file numeric.c.

◆ RB_ULONG_IN_DOUBLE_P

#define RB_ULONG_IN_DOUBLE_P (   n)    1

Definition at line 5158 of file numeric.c.

◆ RB_ULONG_TO_DOUBLE

#define RB_ULONG_TO_DOUBLE (   n)    (double)(n)

Definition at line 5160 of file numeric.c.

◆ SQRT_LONG_MAX

#define SQRT_LONG_MAX   ((SIGNED_VALUE)1<<((SIZEOF_LONG*CHAR_BIT-1)/2))

Definition at line 3570 of file numeric.c.

◆ ULONG_MAX_PLUS_ONE

#define ULONG_MAX_PLUS_ONE   (2*(double)(ULONG_MAX/2+1))

Definition at line 2792 of file numeric.c.

Function Documentation

◆ Init_Numeric()

void Init_Numeric ( void  )

Definition at line 5336 of file numeric.c.

◆ int_remainder()

VALUE int_remainder ( VALUE  x,
VALUE  y 
)

Definition at line 3825 of file numeric.c.

References FIXNUM_P.

◆ NORETURN() [1/2]

NORETURN ( static void   coerce_failedVALUE x, VALUE y)

Referenced by rb_fix2int().

◆ NORETURN() [2/2]

NORETURN ( static void   rb_out_of_shortSIGNED_VALUE num)

◆ rb_big_isqrt()

VALUE rb_big_isqrt ( VALUE  )

Definition at line 6840 of file bignum.c.

References BDIGIT, BDIGITS, BIGNUM_LEN, and rb_bdigit_dbl_isqrt.

◆ rb_dbl_cmp()

VALUE rb_dbl_cmp ( double  a,
double  b 
)

Definition at line 1425 of file numeric.c.

References INT2FIX, isnan, and Qnil.

◆ rb_dbl_hash()

VALUE rb_dbl_hash ( double  d)

Definition at line 1419 of file numeric.c.

References LONG2FIX, and rb_dbl_long_hash().

◆ rb_enc_uint_chr()

VALUE rb_enc_uint_chr ( unsigned int  code,
rb_encoding enc 
)

◆ rb_fix2int()

long rb_fix2int ( VALUE  val)

Definition at line 2953 of file numeric.c.

References FIX2INT, and NORETURN().

◆ rb_fix2short()

short rb_fix2short ( VALUE  val)

Definition at line 3000 of file numeric.c.

References FIX2LONG, FIXNUM_P, and rb_num2long().

◆ rb_fix2str()

VALUE rb_fix2str ( VALUE  x,
int  base 
)

◆ rb_fix2ushort()

unsigned short rb_fix2ushort ( VALUE  val)

Definition at line 3019 of file numeric.c.

References FIX2ULONG, FIXNUM_P, and rb_num2ushort().

◆ rb_fix_plus()

VALUE rb_fix_plus ( VALUE  x,
VALUE  y 
)

Definition at line 3513 of file numeric.c.

◆ rb_flo_is_finite_p()

VALUE rb_flo_is_finite_p ( VALUE  num)

Definition at line 1767 of file numeric.c.

References isfinite, isinf(), isnan, Qfalse, Qtrue, and RFLOAT_VALUE.

◆ rb_flo_is_infinite_p()

VALUE rb_flo_is_infinite_p ( VALUE  num)

Definition at line 1747 of file numeric.c.

References INT2FIX, isinf(), Qnil, and RFLOAT_VALUE.

◆ rb_float_abs()

VALUE rb_float_abs ( VALUE  flt)

Definition at line 1692 of file numeric.c.

References DBL2NUM, RFLOAT_VALUE, and val.

◆ rb_float_cmp()

int rb_float_cmp ( VALUE  x,
VALUE  y 
)

Definition at line 1481 of file numeric.c.

References NUM2INT.

◆ rb_float_eql()

VALUE rb_float_eql ( VALUE  x,
VALUE  y 
)

Definition at line 1648 of file numeric.c.

References isnan, Qfalse, Qtrue, RB_TYPE_P, RFLOAT_VALUE, and T_FLOAT.

◆ rb_float_equal()

VALUE rb_float_equal ( VALUE  x,
VALUE  y 
)

Definition at line 1378 of file numeric.c.

References isnan, Qfalse, rb_integer_float_eq(), RB_TYPE_P, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, and T_FLOAT.

◆ rb_float_gt()

VALUE rb_float_gt ( VALUE  x,
VALUE  y 
)

◆ rb_float_new()

VALUE rb_float_new ( double  d)

Definition at line 5614 of file numeric.c.

◆ rb_float_new_in_heap()

VALUE rb_float_new_in_heap ( double  d)

Definition at line 922 of file numeric.c.

References FL_WB_PROTECTED, NEWOBJ_OF, OBJ_FREEZE, rb_cFloat, RGENGC_WB_PROTECTED_FLOAT, and T_FLOAT.

◆ rb_float_pow()

VALUE rb_float_pow ( VALUE  x,
VALUE  y 
)

Definition at line 1293 of file numeric.c.

References FIX2LONG, rb_big2dbl(), RB_TYPE_P, RFLOAT_VALUE, round(), T_BIGNUM, T_FIXNUM, and T_FLOAT.

◆ rb_float_uminus()

VALUE rb_float_uminus ( VALUE  flt)

Definition at line 1038 of file numeric.c.

References DBL2NUM, and RFLOAT_VALUE.

◆ rb_float_value()

double rb_float_value ( VALUE  v)

Definition at line 5607 of file numeric.c.

◆ rb_int2str()

VALUE rb_int2str ( VALUE  x,
int  base 
)

Definition at line 3471 of file numeric.c.

References FIXNUM_P, rb_any_to_s(), rb_big2str(), rb_fix2str(), RB_TYPE_P, and T_BIGNUM.

◆ rb_int_abs()

VALUE rb_int_abs ( VALUE  num)

Definition at line 4635 of file numeric.c.

References FIXNUM_P.

Referenced by rb_rational_abs().

◆ rb_int_and()

VALUE rb_int_and ( VALUE  x,
VALUE  y 
)

Definition at line 4350 of file numeric.c.

References FIXNUM_P.

◆ rb_int_ceil()

VALUE rb_int_ceil ( VALUE  num,
int  ndigits 
)

Definition at line 2150 of file numeric.c.

References f.

◆ rb_int_cmp()

VALUE rb_int_cmp ( VALUE  x,
VALUE  y 
)

Definition at line 4095 of file numeric.c.

References FIXNUM_P.

Referenced by rb_rational_cmp().

◆ rb_int_div()

VALUE rb_int_div ( VALUE  x,
VALUE  y 
)

Definition at line 3726 of file numeric.c.

References FIXNUM_P.

◆ rb_int_divmod()

VALUE rb_int_divmod ( VALUE  x,
VALUE  y 
)

Definition at line 3873 of file numeric.c.

References FIXNUM_P.

◆ rb_int_equal()

VALUE rb_int_equal ( VALUE  x,
VALUE  y 
)

Definition at line 4045 of file numeric.c.

References FIXNUM_P.

◆ rb_int_fdiv()

VALUE rb_int_fdiv ( VALUE  x,
VALUE  y 
)

Definition at line 3668 of file numeric.c.

References DBL2NUM, Qnil, rb_int_fdiv_double(), and RB_INTEGER_TYPE_P.

◆ rb_int_fdiv_double()

double rb_int_fdiv_double ( VALUE  x,
VALUE  y 
)

Definition at line 3637 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().

◆ rb_int_floor()

VALUE rb_int_floor ( VALUE  num,
int  ndigits 
)

Definition at line 2127 of file numeric.c.

References f.

◆ rb_int_ge()

VALUE rb_int_ge ( VALUE  x,
VALUE  y 
)

Definition at line 4175 of file numeric.c.

References FIXNUM_P.

◆ rb_int_gt()

VALUE rb_int_gt ( VALUE  x,
VALUE  y 
)

Definition at line 4135 of file numeric.c.

References FIXNUM_P.

◆ rb_int_idiv()

VALUE rb_int_idiv ( VALUE  x,
VALUE  y 
)

Definition at line 3753 of file numeric.c.

References FIXNUM_P.

Referenced by rb_int_fdiv_double().

◆ rb_int_lshift()

VALUE rb_int_lshift ( VALUE  x,
VALUE  y 
)

Definition at line 4466 of file numeric.c.

References FIXNUM_P.

◆ rb_int_minus()

VALUE rb_int_minus ( VALUE  x,
VALUE  y 
)

Definition at line 3558 of file numeric.c.

References FIXNUM_P.

◆ rb_int_modulo()

VALUE rb_int_modulo ( VALUE  x,
VALUE  y 
)

Definition at line 3796 of file numeric.c.

References FIXNUM_P.

◆ rb_int_mul()

VALUE rb_int_mul ( VALUE  x,
VALUE  y 
)

Definition at line 3608 of file numeric.c.

References FIXNUM_P.

◆ rb_int_plus()

VALUE rb_int_plus ( VALUE  x,
VALUE  y 
)

Definition at line 3519 of file numeric.c.

References FIXNUM_P.

◆ rb_int_positive_pow()

VALUE rb_int_positive_pow ( long  x,
unsigned long  y 
)

Definition at line 3942 of file numeric.c.

◆ rb_int_pow()

VALUE rb_int_pow ( VALUE  x,
VALUE  y 
)

Definition at line 4004 of file numeric.c.

References FIXNUM_P.

◆ rb_int_pred()

VALUE rb_int_pred ( VALUE  num)

Definition at line 3255 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2NUM, rb_big_minus(), RB_TYPE_P, and T_BIGNUM.

◆ rb_int_round()

VALUE rb_int_round ( VALUE  num,
int  ndigits,
enum ruby_num_rounding_mode  mode 
)

Definition at line 2094 of file numeric.c.

References f.

◆ rb_int_succ()

VALUE rb_int_succ ( VALUE  num)

Definition at line 3229 of file numeric.c.

References FIX2LONG, FIXNUM_P, INT2FIX, LONG2NUM, rb_big_plus(), RB_TYPE_P, and T_BIGNUM.

◆ rb_int_truncate()

VALUE rb_int_truncate ( VALUE  num,
int  ndigits 
)

Definition at line 2174 of file numeric.c.

References f.

◆ rb_int_uminus()

VALUE rb_int_uminus ( VALUE  num)

Definition at line 3388 of file numeric.c.

References FIXNUM_P.

◆ rb_num2fix()

VALUE rb_num2fix ( VALUE  val)

◆ rb_num2int()

long rb_num2int ( VALUE  val)

Definition at line 2947 of file numeric.c.

References rb_num2long().

◆ rb_num2long()

long rb_num2long ( VALUE  val)

◆ rb_num2short()

short rb_num2short ( VALUE  val)

Definition at line 2991 of file numeric.c.

References rb_num2long().

◆ rb_num2ulong()

unsigned long rb_num2ulong ( VALUE  val)

Definition at line 2868 of file numeric.c.

◆ rb_num2ushort()

unsigned short rb_num2ushort ( VALUE  val)

Definition at line 3009 of file numeric.c.

Referenced by rb_fix2ushort().

◆ rb_num_coerce_bin()

VALUE rb_num_coerce_bin ( VALUE  x,
VALUE  y,
ID  func 
)

Definition at line 473 of file numeric.c.

Referenced by rb_big_divmod(), rb_big_modulo(), rb_big_mul(), and rb_big_remainder().

◆ rb_num_coerce_bit()

VALUE rb_num_coerce_bit ( VALUE  x,
VALUE  y,
ID  func 
)

Definition at line 4309 of file numeric.c.

Referenced by rb_big_and(), rb_big_or(), and rb_big_xor().

◆ rb_num_coerce_cmp()

VALUE rb_num_coerce_cmp ( VALUE  x,
VALUE  y,
ID  func 
)

Definition at line 480 of file numeric.c.

◆ rb_num_coerce_relop()

VALUE rb_num_coerce_relop ( VALUE  x,
VALUE  y,
ID  func 
)

Definition at line 488 of file numeric.c.

Referenced by rb_float_gt().

◆ rb_num_get_rounding_option()

enum ruby_num_rounding_mode rb_num_get_rounding_option ( VALUE  opts)

◆ rb_num_negative_p()

int rb_num_negative_p ( VALUE  num)

Definition at line 342 of file numeric.c.

◆ rb_num_to_uint()

int rb_num_to_uint ( VALUE  val,
unsigned int *  ret 
)

◆ rb_num_zerodiv()

void rb_num_zerodiv ( void  )

Definition at line 192 of file numeric.c.

References rb_eZeroDivError, and rb_raise().

Referenced by rb_big_divrem_normal().

◆ round()

double round ( double  x)

Definition at line 79 of file numeric.c.

References f.

Referenced by rb_big_pow(), and rb_float_pow().

◆ ruby_float_mod()

double ruby_float_mod ( double  x,
double  y 
)

Definition at line 1202 of file numeric.c.

References mod.

◆ ruby_float_step()

int ruby_float_step ( VALUE  from,
VALUE  to,
VALUE  step,
int  excl 
)

Definition at line 2513 of file numeric.c.

References NUM2DBL, RB_TYPE_P, and T_FLOAT.

◆ ruby_num_interval_step_size()

VALUE ruby_num_interval_step_size ( VALUE  from,
VALUE  to,
VALUE  step,
int  excl 
)

Definition at line 2544 of file numeric.c.

References FIXNUM_P.

Variable Documentation

◆ rb_cFloat

VALUE rb_cFloat

Definition at line 180 of file numeric.c.

Referenced by rb_float_new_in_heap().

◆ rb_cInteger

VALUE rb_cInteger

Definition at line 181 of file numeric.c.

◆ rb_cNumeric

VALUE rb_cNumeric

Definition at line 179 of file numeric.c.

◆ rb_eFloatDomainError

VALUE rb_eFloatDomainError

Definition at line 187 of file numeric.c.

◆ rb_eZeroDivError

VALUE rb_eZeroDivError

Definition at line 186 of file numeric.c.

Referenced by rb_num_zerodiv().

◆ rb_infinity

const union bytesequence4_or_float rb_infinity = {{0x00, 0x00, 0x80, 0x7f}}

Definition at line 65 of file numeric.c.

◆ rb_nan

const union bytesequence4_or_float rb_nan = {{0x00, 0x00, 0xc0, 0x7f}}

Definition at line 72 of file numeric.c.