Number

Common
JVM
JS
Native
1.0
abstract class Number
(Common source) (Native source)

Superclass for all platform classes representing numeric values.

Constructors

Common
JVM
JS
Native
1.0

<init>

Superclass for all platform classes representing numeric values.

<init>()

Functions

Common
JVM
JS
Native
1.0

toByte

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

abstract fun toByte(): Byte
Common
JVM
JS
Native
1.0

toChar

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

open fun toChar(): Char
Common
JVM
JS
Native
1.0

toDouble

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

abstract fun toDouble(): Double
Common
JVM
JS
Native
1.0

toFloat

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

abstract fun toFloat(): Float
Common
JVM
JS
Native
1.0

toInt

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

abstract fun toInt(): Int
Common
JVM
JS
Native
1.0

toLong

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

abstract fun toLong(): Long
Common
JVM
JS
Native
1.0

toShort

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

abstract fun toShort(): Short

Extension Functions

Native
1.3

narrow

fun <R : Number> Number.narrow(): R
Native
1.3

signExtend

fun <R : Number> Number.signExtend(): R

Inheritors

Common
JVM
JS
Native
1.0

Byte

Represents a 8-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type byte.

class Byte : Number, Comparable<Byte>
Common
JVM
JS
Native
1.0

Double

Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type double.

class Double : Number, Comparable<Double>
Common
JVM
JS
Native
1.0

Float

Represents a single-precision 32-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type float.

class Float : Number, Comparable<Float>
Common
JVM
JS
Native
1.0

Int

Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type int.

class Int : Number, Comparable<Int>
Common
JVM
JS
Native
1.0

Long

Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type long.

class Long : Number, Comparable<Long>
Common
JVM
JS
Native
1.0

Short

Represents a 16-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type short.

class Short : Number, Comparable<Short>