18446744073709551615_u64 0_u64 Returns a number for given digits and base.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other.
Returns true if self is not equal to other or if self and other are unordered.
Returns true if self is not equal to other or if self and other are unordered.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of multiplying self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of adding self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns the result of subtracting self and other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is less than or equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is equal to other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns true if self is greater than or equal to other.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the absolute value of this number.
Returns the absolute value of self as an unsigned value of the same size.
Reverses the bits of self; the least significant bit becomes the most significant, and vice-versa.
Swaps the bytes of self; a little-endian value becomes a big-endian value, and vice-versa.
Returns the number of leading 0-bits.
Returns the negative of self as a signed value of the same size.
Counts 1-bits in the binary representation of this integer.
Returns the bitwise rotation of self n times in the most significant bit's direction.
Returns the bitwise rotation of self n times in the least significant bit's direction.
Returns self converted to Float64.
Returns self converted to Float64.
Returns self converted to Float32.
Returns self converted to Float32.
Returns self converted to Float64.
Returns self converted to Float64.
Returns self converted to Int32.
Returns self converted to Int32.
Returns self converted to Int128.
Returns self converted to Int128.
Returns self converted to Int16.
Returns self converted to Int16.
Returns self converted to Int32.
Returns self converted to Int32.
Returns self converted to Int64.
Returns self converted to Int64.
Returns self converted to Int8.
Returns self converted to Int8.
Returns self converted to a signed value of the same size.
Returns self converted to a signed value of the same size, wrapping in case of overflow.
Returns self converted to UInt32.
Returns self converted to UInt32.
Returns self converted to UInt128.
Returns self converted to UInt128.
Returns self converted to UInt16.
Returns self converted to UInt16.
Returns self converted to UInt32.
Returns self converted to UInt32.
Returns self converted to UInt64.
Returns self converted to UInt64.
Returns self converted to UInt8.
Returns self converted to UInt8.
Returns self converted to an unsigned value of the same size.
Returns self converted to an unsigned value of the same size, wrapping in case of overflow.
Returns the number of trailing 0-bits.
Returns a Char that has the unicode codepoint of self, without checking if this integer is in the range valid for chars (0..0xd7ff and 0xe000..0x10ffff).
Int
Int
Comparable(BigDecimal)
Comparable(BigRational)
Comparable(BigInt)
Number
Number
Number
Number
Comparable(BigFloat)
Steppable
Comparable(Number)
Value
Object
Object
Object
Returns a number for given digits and base. The digits are expected as an Enumerable with the least significant digit as the first element.
Base must not be less than 2.
All digits must be within 0...base.
UInt64.from_digits([5, 4, 3, 2, 1]) # => 12345 UInt64.from_digits([4, 6, 6, 0, 5], base: 7) # => 12345 UInt64.from_digits([45, 23, 1], base: 100) # => 12345 UInt64.from_digits([1], base: -2) # raises ArgumentError UInt64.from_digits([-1]) # raises ArgumentError UInt64.from_digits([3], base: 2) # raises ArgumentError
Returns an UInt64 by invoking #to_u64 on value. See String#to_i for more details.
UInt64.new "20" # => 20 UInt64.new " 20 ", whitespace: false # raises ArgumentError: Invalid UInt64: " 20 "
Returns true if self is not equal to other or if self and other are unordered.
Returns true if self is not equal to other or if self and other are unordered.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of performing a bitwise AND of self's and other's bits.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of adding self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of subtracting self and other. In case of overflow a wrapping is performed.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of multiplying self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of adding self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of subtracting self and other. Raises OverflowError in case of overflow.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise XOR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the result of performing a bitwise OR of self's and other's bits.
Returns the absolute value of this number.
123.abs # => 123 -123.abs # => 123
Returns the absolute value of self as an unsigned value of the same size.
Returns self if self is already an Int::Unsigned. This method never overflows.
1_u32.abs_unsigned # => 1_u32 2_i32.abs_unsigned # => 2_u32 -3_i8.abs_unsigned # => 3_u8 Int16::MIN.abs_unsigned # => 32768_u16
Reverses the bits of self; the least significant bit becomes the most significant, and vice-versa.
0b01001011_u8.bit_reverse # => 0b11010010 0b1100100001100111_u16.bit_reverse # => 0b1110011000010011
Swaps the bytes of self; a little-endian value becomes a big-endian value, and vice-versa. The bit order within each byte is unchanged.
Has no effect on 8-bit integers.
0x123456789ABCDEF0_u64.byte_swap # => 0xF0DEBC9A78563412
Returns the number of leading 0-bits.
Returns the negative of self as a signed value of the same size.
Returns -self if self is already an Int::Signed. Raises OverflowError in case of overflow.
1_i32.neg_signed # => -1_i32 2_u16.neg_signed # => -2_i16 128_u8.neg_signed # => -128_i8 Int16::MIN.neg_signed # raises OverflowError
Counts 1-bits in the binary representation of this integer.
5.popcount # => 2 -15.popcount # => 29
Returns the bitwise rotation of self n times in the most significant bit's direction. Negative shifts are equivalent to #rotate_right(-n).
0b01001101_u8.rotate_left(3) # => 0b01101010 0b01001101_u8.rotate_left(8) # => 0b01001101 0b01001101_u8.rotate_left(11) # => 0b01101010 0b01001101_u8.rotate_left(-1) # => 0b10100110
Returns the bitwise rotation of self n times in the least significant bit's direction. Negative shifts are equivalent to #rotate_left(-n).
0b01001101_u8.rotate_right(3) # => 0b10101001 0b01001101_u8.rotate_right(8) # => 0b01001101 0b01001101_u8.rotate_right(11) # => 0b10101001 0b01001101_u8.rotate_right(-1) # => 0b10011010
Returns self converted to Float64. Raises OverflowError in case of overflow.
Returns self converted to Float64. In case of overflow a wrapping is performed.
Returns self converted to Float32. Raises OverflowError in case of overflow.
Returns self converted to Float32. In case of overflow a wrapping is performed.
Returns self converted to Float64. Raises OverflowError in case of overflow.
Returns self converted to Float64. In case of overflow a wrapping is performed.
Returns self converted to Int32. Raises OverflowError in case of overflow.
Returns self converted to Int32. In case of overflow a wrapping is performed.
Returns self converted to Int128. Raises OverflowError in case of overflow.
Returns self converted to Int128. In case of overflow a wrapping is performed.
Returns self converted to Int16. Raises OverflowError in case of overflow.
Returns self converted to Int16. In case of overflow a wrapping is performed.
Returns self converted to Int32. Raises OverflowError in case of overflow.
Returns self converted to Int32. In case of overflow a wrapping is performed.
Returns self converted to Int64. Raises OverflowError in case of overflow.
Returns self converted to Int64. In case of overflow a wrapping is performed.
Returns self converted to Int8. Raises OverflowError in case of overflow.
Returns self converted to Int8. In case of overflow a wrapping is performed.
Returns self converted to a signed value of the same size.
Simply returns self unmodified if self is already an Int::Signed. Raises OverflowError in case of overflow.
1_u32.to_signed # => 1_i32 2_u16.to_signed # => 2_i16 3_i64.to_signed # => 3_i64
Returns self converted to a signed value of the same size, wrapping in case of overflow.
Simply returns self unmodified if self is already an Int::Signed.
1_u32.to_signed! # => 1_i32 65530_u16.to_signed! # => -6_i16 3_i64.to_signed! # => 3_i64
Returns self converted to UInt32. Raises OverflowError in case of overflow.
Returns self converted to UInt32. In case of overflow a wrapping is performed.
Returns self converted to UInt128. Raises OverflowError in case of overflow.
Returns self converted to UInt128. In case of overflow a wrapping is performed.
Returns self converted to UInt16. Raises OverflowError in case of overflow.
Returns self converted to UInt16. In case of overflow a wrapping is performed.
Returns self converted to UInt32. Raises OverflowError in case of overflow.
Returns self converted to UInt32. In case of overflow a wrapping is performed.
Returns self converted to UInt64. Raises OverflowError in case of overflow.
Returns self converted to UInt64. In case of overflow a wrapping is performed.
Returns self converted to UInt8. Raises OverflowError in case of overflow.
Returns self converted to UInt8. In case of overflow a wrapping is performed.
Returns self converted to an unsigned value of the same size.
Simply returns self unmodified if self is already an Int::Unsigned. Raises OverflowError in case of overflow.
1_i32.to_unsigned # => 1_u32 2_i16.to_unsigned # => 2_u16 3_u64.to_unsigned # => 3_u64
Returns self converted to an unsigned value of the same size, wrapping in case of overflow.
Simply returns self unmodified if self is already an Int::Unsigned.
1_i32.to_unsigned! # => 1_u32 (-6_i16).to_unsigned! # => 65530_u16 3_u64.to_unsigned! # => 3_u64
Returns the number of trailing 0-bits.
Returns a Char that has the unicode codepoint of self, without checking if this integer is in the range valid for chars (0..0xd7ff and 0xe000..0x10ffff). In case of overflow a wrapping is performed.
You should never use this method unless chr turns out to be a bottleneck.
97.unsafe_chr # => 'a'
© 2012–2026 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/1.19.0/UInt64.html