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.

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.

Represents a single-precision 32-bit IEEE 754 floating point number.

Types

Link copied to clipboard
object Companion
object Companion
object Companion

Functions

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

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

operator fun compareTo(other: Byte): Int
operator fun compareTo(other: Double): Int
open operator override fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

operator fun compareTo(other: Byte): Int
operator fun compareTo(other: Double): Int
open operator override fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

Link copied to clipboard
operator fun dec(): Float

Decrements this value.

operator fun dec(): Float

Decrements this value.

operator external fun dec(): Float

Decrements this value.

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

Divides this value by the other value.

operator fun div(other: Byte): Float
operator fun div(other: Double): Double
operator fun div(other: Float): Float
operator fun div(other: Int): Float
operator fun div(other: Long): Float
operator fun div(other: Short): Float

Divides this value by the other value.

inline operator fun div(other: Byte): Float
inline operator fun div(other: Double): Double
operator external fun div(other: Float): Float
inline operator fun div(other: Int): Float
inline operator fun div(other: Long): Float
inline operator fun div(other: Short): Float

Divides this value by the other value.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
fun equals(other: Float): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun inc(): Float

Increments this value.

operator fun inc(): Float

Increments this value.

operator external fun inc(): Float

Increments this value.

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

Subtracts the other value from this value.

operator fun minus(other: Byte): Float
operator fun minus(other: Double): Double
operator fun minus(other: Float): Float
operator fun minus(other: Int): Float
operator fun minus(other: Long): Float
operator fun minus(other: Short): Float

Subtracts the other value from this value.

inline operator fun minus(other: Byte): Float
inline operator fun minus(other: Double): Double
operator external fun minus(other: Float): Float
inline operator fun minus(other: Int): Float
inline operator fun minus(other: Long): Float
inline operator fun minus(other: Short): Float

Subtracts the other value from this value.

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

Adds the other value to this value.

operator fun plus(other: Byte): Float
operator fun plus(other: Double): Double
operator fun plus(other: Float): Float
operator fun plus(other: Int): Float
operator fun plus(other: Long): Float
operator fun plus(other: Short): Float

Adds the other value to this value.

inline operator fun plus(other: Byte): Float
inline operator fun plus(other: Double): Double
operator external fun plus(other: Float): Float
inline operator fun plus(other: Int): Float
inline operator fun plus(other: Long): Float
inline operator fun plus(other: Short): Float

Adds the other value to this value.

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

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
operator fun rem(other: Byte): Float
operator fun rem(other: Double): Double
operator fun rem(other: Float): Float
operator fun rem(other: Int): Float
operator fun rem(other: Long): Float
operator fun rem(other: Short): Float

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin 1.1
inline operator fun rem(other: Byte): Float
inline operator fun rem(other: Double): Double
operator external fun rem(other: Float): Float
inline operator fun rem(other: Int): Float
inline operator fun rem(other: Long): Float
inline operator fun rem(other: Short): Float

Calculates the remainder of truncating division of this value by the other value.

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

Multiplies this value by the other value.

operator fun times(other: Byte): Float
operator fun times(other: Double): Double
operator fun times(other: Float): Float
operator fun times(other: Int): Float
operator fun times(other: Long): Float
operator fun times(other: Short): Float

Multiplies this value by the other value.

inline operator fun times(other: Byte): Float
inline operator fun times(other: Double): Double
operator external fun times(other: Float): Float
inline operator fun times(other: Int): Float
inline operator fun times(other: Long): Float
inline operator fun times(other: Short): Float

Multiplies this value by the other value.

Link copied to clipboard
open override fun toByte(): Byte

Converts this Float value to Byte.

open override fun toByte(): Byte

Converts this Float value to Byte.

open override fun toByte(): Byte

Converts this Float value to Byte.

Link copied to clipboard
open override fun toChar(): Char

Converts this Float value to Char.

open override fun toChar(): Char

Converts this Float value to Char.

open override fun toChar(): Char

Converts this Float value to Char.

Link copied to clipboard
open override fun toDouble(): Double

Converts this Float value to Double.

open override fun toDouble(): Double

Converts this Float value to Double.

open external override fun toDouble(): Double

Converts this Float value to Double.

Link copied to clipboard
open override fun toFloat(): Float

Returns this value.

open override fun toFloat(): Float

Returns this value.

open inline override fun toFloat(): Float

Returns this value.

Link copied to clipboard
open override fun toInt(): Int

Converts this Float value to Int.

open override fun toInt(): Int

Converts this Float value to Int.

open external override fun toInt(): Int

Converts this Float value to Int.

Link copied to clipboard
open override fun toLong(): Long

Converts this Float value to Long.

open override fun toLong(): Long

Converts this Float value to Long.

open external override fun toLong(): Long

Converts this Float value to Long.

Link copied to clipboard
open override fun toShort(): Short

Converts this Float value to Short.

open override fun toShort(): Short

Converts this Float value to Short.

open override fun toShort(): Short

Converts this Float value to Short.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
operator fun unaryMinus(): Float

Returns the negative of this value.

operator fun unaryMinus(): Float

Returns the negative of this value.

operator external fun unaryMinus(): Float

Returns the negative of this value.

Link copied to clipboard
operator fun unaryPlus(): Float

Returns this value.

operator fun unaryPlus(): Float

Returns this value.

operator external fun unaryPlus(): Float

Returns this value.

Extensions

Link copied to clipboard

Returns the absolute value of this value.

Returns the absolute value of this value.

Returns the absolute value of this value.

Returns the absolute value of this value.

Link copied to clipboard
fun Float.coerceAtLeast(minimumValue: Float): Float
fun Float.coerceAtLeast(minimumValue: Float): Float
fun Float.coerceAtLeast(minimumValue: Float): Float

Ensures that this value is not less than the specified minimumValue.

Link copied to clipboard
fun Float.coerceAtMost(maximumValue: Float): Float
fun Float.coerceAtMost(maximumValue: Float): Float
fun Float.coerceAtMost(maximumValue: Float): Float

Ensures that this value is not greater than the specified maximumValue.

Link copied to clipboard
fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float
fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float
fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float

Ensures that this value lies in the specified range minimumValue..maximumValue.

Link copied to clipboard
inline fun Float.IEEErem(divisor: Float): Float
inline fun Float.IEEErem(divisor: Float): Float
inline fun Float.IEEErem(divisor: Float): Float

Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard.

external fun Float.IEEErem(divisor: Float): Float
external fun Float.IEEErem(divisor: Float): Float
external fun Float.IEEErem(divisor: Float): Float

Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard.

Link copied to clipboard
expect fun Float.isFinite(): Boolean
expect fun Float.isFinite(): Boolean
expect fun Float.isFinite(): Boolean
actual inline fun Float.isFinite(): Boolean
actual inline fun Float.isFinite(): Boolean
actual inline fun Float.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

actual fun Float.isFinite(): Boolean
actual fun Float.isFinite(): Boolean
actual fun Float.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

actual external fun Float.isFinite(): Boolean
actual external fun Float.isFinite(): Boolean
actual external fun Float.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

Link copied to clipboard
expect fun Float.isInfinite(): Boolean
expect fun Float.isInfinite(): Boolean
expect fun Float.isInfinite(): Boolean
actual inline fun Float.isInfinite(): Boolean
actual inline fun Float.isInfinite(): Boolean
actual inline fun Float.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

actual fun Float.isInfinite(): Boolean
actual fun Float.isInfinite(): Boolean
actual fun Float.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

actual external fun Float.isInfinite(): Boolean
actual external fun Float.isInfinite(): Boolean
actual external fun Float.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

Link copied to clipboard
expect fun Float.isNaN(): Boolean
expect fun Float.isNaN(): Boolean
expect fun Float.isNaN(): Boolean
actual inline fun Float.isNaN(): Boolean
actual inline fun Float.isNaN(): Boolean
actual inline fun Float.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

actual fun Float.isNaN(): Boolean
actual fun Float.isNaN(): Boolean
actual fun Float.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

actual external fun Float.isNaN(): Boolean
actual external fun Float.isNaN(): Boolean
actual external fun Float.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Link copied to clipboard
inline fun Float.mod(other: Float): Float
inline fun Float.mod(other: Double): Double
inline fun Float.mod(other: Float): Float
inline fun Float.mod(other: Double): Double
inline fun Float.mod(other: Float): Float
inline fun Float.mod(other: Double): Double

Calculates the remainder of flooring division of this value by the other value.

Link copied to clipboard
inline external fun <R : Number> Number.narrow(): R
inline external fun <R : Number> Number.narrow(): R
inline external fun <R : Number> Number.narrow(): R
Link copied to clipboard
inline fun Float.nextDown(): Float
inline fun Float.nextDown(): Float
inline fun Float.nextDown(): Float

Returns the Float value nearest to this value in direction of negative infinity.

external fun Float.nextDown(): Float
external fun Float.nextDown(): Float
external fun Float.nextDown(): Float

Returns the Float value nearest to this value in direction of negative infinity.

Link copied to clipboard
inline fun Float.nextTowards(to: Float): Float
inline fun Float.nextTowards(to: Float): Float
inline fun Float.nextTowards(to: Float): Float

Returns the Float value nearest to this value in direction from this value towards the value to.

external fun Float.nextTowards(to: Float): Float
external fun Float.nextTowards(to: Float): Float
external fun Float.nextTowards(to: Float): Float

Returns the Float value nearest to this value in direction from this value towards the value to.

Link copied to clipboard
inline fun Float.nextUp(): Float
inline fun Float.nextUp(): Float
inline fun Float.nextUp(): Float

Returns the Float value nearest to this value in direction of positive infinity.

external fun Float.nextUp(): Float
external fun Float.nextUp(): Float
external fun Float.nextUp(): Float

Returns the Float value nearest to this value in direction of positive infinity.

Link copied to clipboard
expect fun Float.pow(x: Float): Float
expect fun Float.pow(x: Float): Float
expect fun Float.pow(x: Float): Float

Raises this value to the power x.

expect fun Float.pow(n: Int): Float
expect fun Float.pow(n: Int): Float
expect fun Float.pow(n: Int): Float

Raises this value to the integer power n.

actual inline fun Float.pow(x: Float): Float
actual inline fun Float.pow(x: Float): Float
actual inline fun Float.pow(x: Float): Float

Raises this value to the power x.

actual inline fun Float.pow(n: Int): Float
actual inline fun Float.pow(n: Int): Float
actual inline fun Float.pow(n: Int): Float

Raises this value to the integer power n.

actual inline fun Float.pow(x: Float): Float
actual inline fun Float.pow(x: Float): Float
actual inline fun Float.pow(x: Float): Float

Raises this value to the power x.

actual inline fun Float.pow(n: Int): Float
actual inline fun Float.pow(n: Int): Float
actual inline fun Float.pow(n: Int): Float

Raises this value to the integer power n.

actual external fun Float.pow(x: Float): Float
actual external fun Float.pow(x: Float): Float
actual external fun Float.pow(x: Float): Float

Raises this value to the power x.

actual fun Float.pow(n: Int): Float
actual fun Float.pow(n: Int): Float
actual fun Float.pow(n: Int): Float

Raises this value to the integer power n.

Link copied to clipboard

Creates a range from this Float value to the specified that value.

Link copied to clipboard
expect fun Float.roundToInt(): Int
expect fun Float.roundToInt(): Int
expect fun Float.roundToInt(): Int

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual fun Float.roundToInt(): Int
actual fun Float.roundToInt(): Int
actual fun Float.roundToInt(): Int

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual inline fun Float.roundToInt(): Int
actual inline fun Float.roundToInt(): Int
actual inline fun Float.roundToInt(): Int

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual fun Float.roundToInt(): Int
actual fun Float.roundToInt(): Int
actual fun Float.roundToInt(): Int

Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

Link copied to clipboard
expect fun Float.roundToLong(): Long
expect fun Float.roundToLong(): Long
expect fun Float.roundToLong(): Long

Rounds this Float value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual fun Float.roundToLong(): Long
actual fun Float.roundToLong(): Long
actual fun Float.roundToLong(): Long

Rounds this Float value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual inline fun Float.roundToLong(): Long
actual inline fun Float.roundToLong(): Long
actual inline fun Float.roundToLong(): Long

Rounds this Float value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual fun Float.roundToLong(): Long
actual fun Float.roundToLong(): Long
actual fun Float.roundToLong(): Long

Rounds this Float value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

Link copied to clipboard
expect val Float.sign: Float
expect val Float.sign: Float
expect val Float.sign: Float

Returns the sign of this value:

actual val Float.sign: Float
actual val Float.sign: Float
actual val Float.sign: Float

Returns the sign of this value:

actual val Float.sign: Float
actual val Float.sign: Float
actual val Float.sign: Float

Returns the sign of this value:

actual val Float.sign: Float
actual val Float.sign: Float
actual val Float.sign: Float

Returns the sign of this value:

Link copied to clipboard
inline external fun <R : Number> Number.signExtend(): R
inline external fun <R : Number> Number.signExtend(): R
inline external fun <R : Number> Number.signExtend(): R
Link copied to clipboard
inline fun Float.toBigDecimal(mathContext: MathContext): BigDecimal
inline fun Float.toBigDecimal(mathContext: MathContext): BigDecimal
inline fun Float.toBigDecimal(mathContext: MathContext): BigDecimal

Returns the value of this Float number as a BigDecimal.

Link copied to clipboard
expect fun Float.toBits(): Int
expect fun Float.toBits(): Int
expect fun Float.toBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout.

actual inline fun Float.toBits(): Int
actual inline fun Float.toBits(): Int
actual inline fun Float.toBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout.

actual fun Float.toBits(): Int
actual fun Float.toBits(): Int
actual fun Float.toBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout.

actual inline fun Float.toBits(): Int
actual inline fun Float.toBits(): Int
actual inline fun Float.toBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout.

Link copied to clipboard
expect fun Float.toRawBits(): Int
expect fun Float.toRawBits(): Int
expect fun Float.toRawBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout, preserving NaN values exact layout.

actual inline fun Float.toRawBits(): Int
actual inline fun Float.toRawBits(): Int
actual inline fun Float.toRawBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout, preserving NaN values exact layout.

actual fun Float.toRawBits(): Int
actual fun Float.toRawBits(): Int
actual fun Float.toRawBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout, preserving NaN values exact layout.

actual inline fun Float.toRawBits(): Int
actual inline fun Float.toRawBits(): Int
actual inline fun Float.toRawBits(): Int

Returns a bit representation of the specified floating-point value as Int according to the IEEE 754 floating-point "single format" bit layout, preserving NaN values exact layout.

Link copied to clipboard
inline fun Float.toUInt(): UInt
inline fun Float.toUInt(): UInt
inline fun Float.toUInt(): UInt

Converts this Float value to UInt.

Link copied to clipboard
inline fun Float.toULong(): ULong
inline fun Float.toULong(): ULong
inline fun Float.toULong(): ULong

Converts this Float value to ULong.

Link copied to clipboard

Returns the ulp of this value.

Link copied to clipboard
expect fun Float.withSign(sign: Float): Float
expect fun Float.withSign(sign: Int): Float
expect fun Float.withSign(sign: Float): Float
expect fun Float.withSign(sign: Int): Float
expect fun Float.withSign(sign: Float): Float
expect fun Float.withSign(sign: Int): Float

Returns this value with the sign bit same as of the sign value.

actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float
actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float
actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float

Returns this value with the sign bit same as of the sign value.

actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float
actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float
actual inline fun Float.withSign(sign: Float): Float
actual inline fun Float.withSign(sign: Int): Float

Returns this value with the sign bit same as of the sign value.

actual external fun Float.withSign(sign: Float): Float
actual fun Float.withSign(sign: Int): Float
actual external fun Float.withSign(sign: Float): Float
actual fun Float.withSign(sign: Int): Float
actual external fun Float.withSign(sign: Float): Float
actual fun Float.withSign(sign: Int): Float

Returns this value with the sign bit same as of the sign value.