Number

abstract class Number(source)

Superclass for all platform classes representing numeric values.

Since Kotlin

1.0

Inheritors

abstract class Number(source)

Superclass for all platform classes representing numeric values.

Since Kotlin

1.1

Inheritors

abstract class Number(source)

Superclass for all platform classes representing numeric values.

Since Kotlin

1.3

Inheritors

Constructors

Link copied to clipboard
constructor()
constructor()
constructor()

Functions

Link copied to clipboard
inline external fun <R : Number> Number.narrow(): R
Since Kotlin 1.3
Link copied to clipboard
inline external fun <R : Number> Number.signExtend(): R
Since Kotlin 1.3
Link copied to clipboard
abstract fun toByte(): Byte

Returns the value of this number as a Byte, which may involve rounding or truncation.

Since Kotlin 1.0
abstract fun toByte(): Byte

Returns the value of this number as a Byte, which may involve rounding or truncation.

Since Kotlin 1.1
abstract fun toByte(): Byte

Returns the value of this number as a Byte, which may involve rounding or truncation.

Since Kotlin 1.3
Link copied to clipboard
open fun toChar(): Char

Returns the Char with the numeric value equal to this number, truncated to 16 bits if appropriate.

Since Kotlin 1.0
open fun toChar(): Char

Returns the Char with the numeric value equal to this number, truncated to 16 bits if appropriate.

Since Kotlin 1.1
open fun toChar(): Char

Returns the Char with the numeric value equal to this number, truncated to 16 bits if appropriate.

Since Kotlin 1.3
Link copied to clipboard
abstract fun toDouble(): Double

Returns the value of this number as a Double, which may involve rounding.

Since Kotlin 1.0
abstract fun toDouble(): Double

Returns the value of this number as a Double, which may involve rounding.

Since Kotlin 1.1
abstract fun toDouble(): Double

Returns the value of this number as a Double, which may involve rounding.

Since Kotlin 1.3
Link copied to clipboard
abstract fun toFloat(): Float

Returns the value of this number as a Float, which may involve rounding.

Since Kotlin 1.0
abstract fun toFloat(): Float

Returns the value of this number as a Float, which may involve rounding.

Since Kotlin 1.1
abstract fun toFloat(): Float

Returns the value of this number as a Float, which may involve rounding.

Since Kotlin 1.3
Link copied to clipboard
abstract fun toInt(): Int

Returns the value of this number as an Int, which may involve rounding or truncation.

Since Kotlin 1.0
abstract fun toInt(): Int

Returns the value of this number as an Int, which may involve rounding or truncation.

Since Kotlin 1.1
abstract fun toInt(): Int

Returns the value of this number as an Int, which may involve rounding or truncation.

Since Kotlin 1.3
Link copied to clipboard
abstract fun toLong(): Long

Returns the value of this number as a Long, which may involve rounding or truncation.

Since Kotlin 1.0
abstract fun toLong(): Long

Returns the value of this number as a Long, which may involve rounding or truncation.

Since Kotlin 1.1
abstract fun toLong(): Long

Returns the value of this number as a Long, which may involve rounding or truncation.

Since Kotlin 1.3
Link copied to clipboard
abstract fun toShort(): Short

Returns the value of this number as a Short, which may involve rounding or truncation.

Since Kotlin 1.0
abstract fun toShort(): Short

Returns the value of this number as a Short, which may involve rounding or truncation.

Since Kotlin 1.1
abstract fun toShort(): Short

Returns the value of this number as a Short, which may involve rounding or truncation.

Since Kotlin 1.3