Long

A signed 64-bit integer with values from -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807.

Integer addition, subtraction and multiplication wrap on overflow. Division truncates towards zero; integer division and remainder by zero throw ArithmeticException. Shift counts use only their lowest six bits. Floating arithmetic may lose integer precision.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
infix external fun and(other: Long): Long

Returns the bitwise AND of this value and other.

Link copied to clipboard
operator external fun compareTo(other: Byte): Int
operator external fun compareTo(other: Double): Int
operator external fun compareTo(other: Float): Int
operator external fun compareTo(other: Int): Int
open operator external override fun compareTo(other: Long): Int
operator external fun compareTo(other: Short): Int

Compares this value with other after numeric promotion.

Link copied to clipboard
operator external fun dec(): Long

Returns this value minus one.

Link copied to clipboard
operator external fun div(other: Byte): Long
operator external fun div(other: Double): Double
operator external fun div(other: Float): Float
operator external fun div(other: Int): Long
operator external fun div(other: Long): Long
operator external fun div(other: Short): Long

Divides this value by other.

Link copied to clipboard
infix fun Long.downTo(other: Byte): LongProgression
infix fun Long.downTo(other: Int): LongProgression
infix fun Long.downTo(other: Long): LongProgression
infix fun Long.downTo(other: Short): LongProgression

Creates a descending progression from this value down to other, inclusive.

Link copied to clipboard
operator external fun inc(): Long

Returns this value plus one.

Link copied to clipboard
external fun inv(): Long

Inverts all 64 bits of this value.

Link copied to clipboard
operator external fun minus(other: Byte): Long
operator external fun minus(other: Double): Double
operator external fun minus(other: Float): Float
operator external fun minus(other: Int): Long
operator external fun minus(other: Long): Long
operator external fun minus(other: Short): Long

Subtracts other from this value.

Link copied to clipboard
infix external fun or(other: Long): Long

Returns the bitwise OR of this value and other.

Link copied to clipboard
operator external fun plus(other: Byte): Long
operator external fun plus(other: Double): Double
operator external fun plus(other: Float): Float
operator external fun plus(other: Int): Long
operator external fun plus(other: Long): Long
operator external fun plus(other: Short): Long

Adds other to this value.

Link copied to clipboard
operator fun Long.rangeTo(other: Byte): LongRange
operator fun Long.rangeTo(other: Int): LongRange
operator fun Long.rangeTo(other: Long): LongRange
operator fun Long.rangeTo(other: Short): LongRange

Creates an ascending range from this value up to other, inclusive.

Link copied to clipboard
operator fun Long.rangeUntil(other: Byte): LongRange
operator fun Long.rangeUntil(other: Int): LongRange
operator fun Long.rangeUntil(other: Long): LongRange
operator fun Long.rangeUntil(other: Short): LongRange

Creates an ascending range from this value up to other, exclusive.

Link copied to clipboard
operator external fun rem(other: Byte): Long
operator external fun rem(other: Double): Double
operator external fun rem(other: Float): Float
operator external fun rem(other: Int): Long
operator external fun rem(other: Long): Long
operator external fun rem(other: Short): Long

Returns the remainder after dividing this value by other.

Link copied to clipboard
infix external fun shl(bitCount: Int): Long

Shifts this value left, discarding bits that leave the value and filling low bits with zeros.

Link copied to clipboard
infix external fun shr(bitCount: Int): Long

Shifts this value right, filling high bits with the sign bit.

Link copied to clipboard
operator external fun times(other: Byte): Long
operator external fun times(other: Double): Double
operator external fun times(other: Float): Float
operator external fun times(other: Int): Long
operator external fun times(other: Long): Long
operator external fun times(other: Short): Long

Multiplies this value by other.

Link copied to clipboard
external fun toByte(): Byte

Converts this value to Byte.

Link copied to clipboard
external fun toChar(): Char

Converts this value to a UTF-16 code unit using its lowest 16 integer bits.

Link copied to clipboard
external fun toDouble(): Double

Converts this value to Double.

Link copied to clipboard
external fun toFloat(): Float

Converts this value to Float.

Link copied to clipboard
external fun toInt(): Int

Converts this value to Int.

Link copied to clipboard
external fun toLong(): Long

Returns this value unchanged.

Link copied to clipboard
external fun toShort(): Short

Converts this value to Short.

Link copied to clipboard
external fun toUByte(): UByte

Converts this value to UByte.

Link copied to clipboard
external fun toUInt(): UInt

Converts this value to UInt.

Link copied to clipboard
external fun toULong(): ULong

Converts this value to ULong.

Link copied to clipboard
external fun toUShort(): UShort

Converts this value to UShort.

Link copied to clipboard
operator external fun unaryMinus(): Long

Returns the negation of this value.

Link copied to clipboard
operator external fun unaryPlus(): Long

Returns this value with the type shown in the signature.

Link copied to clipboard
infix fun Long.until(other: Byte): LongRange
infix fun Long.until(other: Int): LongRange
infix fun Long.until(other: Long): LongRange
infix fun Long.until(other: Short): LongRange

Creates an ascending range from this value up to other, exclusive.

Link copied to clipboard
infix external fun ushr(bitCount: Int): Long

Shifts this value right, filling high bits with zeros.

Link copied to clipboard
infix external fun xor(other: Long): Long

Returns the bitwise exclusive OR of this value and other.