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

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
numeric.h File Reference

Public APIs related to rb_cNumeric. More...

`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/value.h"`
`#include "ruby/backward/2/attributes.h"`

Go to the source code of this file.

## Macros
#define | RB_NUM_COERCE_FUNCS_NEED_OPID 1

## Functions
void | rb_num_zerodiv (void)
VALUE | rb_num_coerce_bin (VALUE, VALUE, ID)
VALUE | rb_num_coerce_cmp (VALUE, VALUE, ID)
VALUE | rb_num_coerce_relop (VALUE, VALUE, ID)
VALUE | rb_num_coerce_bit (VALUE, VALUE, ID)
VALUE | rb_num2fix (VALUE)
VALUE | rb_fix2str (VALUE, int)
VALUE | rb_dbl_cmp (double, double)

## Detailed Description

Public APIs related to rb_cNumeric.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either `RBIMPL` or `rbimpl` are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance `__VA_ARGS__` is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file numeric.h.

## Macro Definition Documentation

## ◆ RB_NUM_COERCE_FUNCS_NEED_OPID

#define RB_NUM_COERCE_FUNCS_NEED_OPID 1

Definition at line 31 of file numeric.h.

## Function Documentation

## ◆ rb_dbl_cmp()

VALUE rb_dbl_cmp | ( | double | a,
|  | double | b
| ) |  |

Definition at line 1465 of file numeric.c.

References INT2FIX, isnan, and Qnil.

Referenced by rb_rational_cmp().

## ◆ rb_fix2str()

VALUE rb_fix2str | ( | VALUE | x,
|  | int | base
| ) |  |

Definition at line 3495 of file numeric.c.

References 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 ole_typedesc2val(), and rb_int2str().

## ◆ rb_num2fix()

VALUE rb_num2fix | ( | VALUE | val | ) |

Definition at line 3140 of file numeric.c.

References FIXABLE, FIXNUM_P, LONG2FIX, rb_eRangeError, rb_num2long(), and rb_raise().

## ◆ rb_num_coerce_bin()

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

Definition at line 452 of file numeric.c.

References rb_funcall(), and TRUE.

Referenced by rb_big_divmod(), rb_big_fdiv_double(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_plus(), rb_big_pow(), rb_big_remainder(), rb_complex_minus(), rb_complex_mul(), rb_complex_plus(), rb_complex_pow(), rb_float_div(), rb_float_minus(), rb_float_mul(), rb_float_plus(), rb_float_pow(), rb_int_minus(), rb_int_mul(), rb_int_plus(), rb_rational_div(), rb_rational_minus(), rb_rational_mul(), rb_rational_plus(), and rb_rational_pow().

## ◆ rb_num_coerce_bit()

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

Definition at line 4395 of file numeric.c.

References Qundef, rb_exec_recursive_paired(), and TRUE.

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 459 of file numeric.c.

References FALSE, Qnil, and rb_funcall().

Referenced by rb_big_cmp(), rb_rational_cmp(), and ruby_num_interval_step_size().

## ◆ rb_num_coerce_relop()

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

Definition at line 474 of file numeric.c.

References FALSE, Qnil, rb_cmperr(), rb_funcall(), and UNREACHABLE_RETURN.

Referenced by rb_float_gt().

## ◆ rb_num_zerodiv()

void rb_num_zerodiv | ( | void |  | ) |

Definition at line 199 of file numeric.c.

References rb_eZeroDivError, and rb_raise().

Referenced by rb_big_divrem_normal(), rb_int_powm(), rb_rational_div(), and rb_rational_pow().