BigDecimal

expect class BigDecimal(value: String) : Number, Comparable<BigDecimal>

A floating point decimal number with arbitrary precision.

Parameters

value

the String representation of this decimal number

actual class BigDecimal(value: String) : Number, Comparable<BigDecimal>
actual class BigDecimal(value: String) : Number, Comparable<BigDecimal>

Constructors

Link copied to clipboard
expect constructor(mantissa: BigInteger, exponent: Int)

Create an instance of BigDecimal from a mantissa and exponent.

expect constructor(value: String)
actual constructor(mantissa: BigInteger, exponent: Int)
actual constructor(value: String)
actual constructor(mantissa: BigInteger, exponent: Int)
actual constructor(value: String)

Properties

Link copied to clipboard
expect val exponent: Int

The exponent of this decimal number. If zero or positive, this represents the number of digits to the right of the decimal point. If negative, the mantissa is multiplied by ten to the power of the negation of the scale.

actual val exponent: Int
actual val exponent: Int
Link copied to clipboard
expect val mantissa: BigInteger

The significant digits of this decimal value

actual val mantissa: BigInteger
actual val mantissa: BigInteger
Link copied to clipboard

Functions

Link copied to clipboard
expect open operator override fun compareTo(other: BigDecimal): Int

Compare this value to the given value for in/equality

actual open operator override fun compareTo(other: BigDecimal): Int
actual open operator override fun compareTo(other: BigDecimal): Int
Link copied to clipboard
expect open operator override fun equals(other: Any?): Boolean

Checks if this value is equal to the given object

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

Returns a hash code for this value

actual open override fun hashCode(): Int
actual open override fun hashCode(): Int
Link copied to clipboard
expect operator fun minus(other: BigDecimal): BigDecimal

Returns the difference of this value and the given value

actual operator fun minus(other: BigDecimal): BigDecimal
actual operator fun minus(other: BigDecimal): BigDecimal
Link copied to clipboard
expect operator fun plus(other: BigDecimal): BigDecimal

Returns the sum of this value and the given value

actual operator fun plus(other: BigDecimal): BigDecimal
actual operator fun plus(other: BigDecimal): BigDecimal
Link copied to clipboard
expect open override fun toByte(): Byte

Converts this value to a Byte, which may involve rounding or truncation

actual open override fun toByte(): Byte
actual open override fun toByte(): Byte
Link copied to clipboard
expect open override fun toDouble(): Double

Converts this value to a Double, which may involve rounding or truncation

actual open override fun toDouble(): Double
actual open override fun toDouble(): Double
Link copied to clipboard
expect open override fun toFloat(): Float

Converts this value to a Float, which may involve rounding or truncation

actual open override fun toFloat(): Float
actual open override fun toFloat(): Float
Link copied to clipboard
expect open override fun toInt(): Int

Converts this value to an Int, which may involve rounding or truncation

actual open override fun toInt(): Int
actual open override fun toInt(): Int
Link copied to clipboard
expect open override fun toLong(): Long

Converts this value to a Long, which may involve rounding or truncation

actual open override fun toLong(): Long
actual open override fun toLong(): Long
Link copied to clipboard
expect fun toPlainString(): String

Returns the decimal (i.e., radix-10) string representation of this value in long-form (i.e., not scientific) notation

actual fun toPlainString(): String
actual fun toPlainString(): String
Link copied to clipboard
expect open override fun toShort(): Short

Converts this value to a Short, which may involve rounding or truncation

actual open override fun toShort(): Short
actual open override fun toShort(): Short
Link copied to clipboard
expect open override fun toString(): String

Returns the decimal (i.e., radix-10) string representation of this value using scientific notation if an exponent is needed

actual open override fun toString(): String
actual open override fun toString(): String

Inherited functions

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