Ruby: include/ruby/internal/core/rbignum.h File Reference

Ruby 3.4.4p34 (2025-05-14 revision a38531fd3f617bf734ef7d6c595325f69985ea1d)

Macros | Functions
rbignum.h File Reference

Routines to manipulate struct RBignum. More...

`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/value.h"`
`#include "ruby/internal/value_type.h"`
`#include "ruby/internal/stdbool.h"`

Go to the source code of this file.

## Macros
#define | RBIGNUM_SIGN rb_big_sign
| Just another name of rb_big_sign.

## Functions
int | rb_big_sign (VALUE num)
| The "sign" of a bignum.
static bool | RBIGNUM_POSITIVE_P (VALUE b)
| Checks if the bignum is positive.
static bool | RBIGNUM_NEGATIVE_P (VALUE b)
| Checks if the bignum is negative.

## Detailed Description

Routines to manipulate struct RBignum.

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.
  The struct RBignum itself is opaque.

Definition in file rbignum.h.

## Macro Definition Documentation

## ◆ RBIGNUM_SIGN

#define RBIGNUM_SIGN rb_big_sign

Just another name of rb_big_sign.

Definition at line 29 of file rbignum.h.

Referenced by RBIGNUM_POSITIVE_P().

## Function Documentation

## ◆ rb_big_sign()

int rb_big_sign | ( | VALUE | num | ) |

The "sign" of a bignum.

Parameters

  [in] | num | An object of RBignum.

Return values

  1 | It is greater than or equal to zero.
  0 | It is less than zero.

Definition at line 6808 of file bignum.c.

## ◆ RBIGNUM_NEGATIVE_P()

static bool RBIGNUM_NEGATIVE_P | ( | VALUE | b | ) |
| inlinestatic

Checks if the bignum is negative.

Parameters

  [in] | b | An object of RBignum.

Return values

  true | `b` is less than zero.
  false | Otherwise.

Definition at line 74 of file rbignum.h.

## ◆ RBIGNUM_POSITIVE_P()

static bool RBIGNUM_POSITIVE_P | ( | VALUE | b | ) |
| inlinestatic

Checks if the bignum is positive.

Parameters

  [in] | b | An object of RBignum.

Return values

  false | `b` is less than zero.
  true | Otherwise.

Definition at line 61 of file rbignum.h.

Referenced by RBIGNUM_NEGATIVE_P(), and RBIGNUM_POSITIVE_P().