BigDecimal

Definitions

def abs(x: BigDecimal): BigDecimal Source

Returns the absolute value of x.

def ceil(x: BigDecimal): BigDecimal Source

Returns x rounded up to a BigDecimal representing the nearest larger integer value.

def compare(x: BigDecimal, y: BigDecimal): Int32 Source

Returns 1 if x > y, -1 if x < y, and 0 if x = y.

def dist(x: BigDecimal, y: BigDecimal): BigDecimal Source

Returns the distance between x and y.

def floor(x: BigDecimal): BigDecimal Source

Returns x rounded down to a BigDecimal representing the nearest smaller integer value.

def fromString(s: String): Option[BigDecimal] Source

Parse the string s as an BigDecimal, leading or trailing whitespace is trimmed. A successful parse is wrapped with Some(x), a parse failure is indicated by None.

def max(x: BigDecimal, y: BigDecimal): BigDecimal Source

Returns the larger of x and y.

def min(x: BigDecimal, y: BigDecimal): BigDecimal Source

Returns the smaller of x and y.

def numericEquals(x: BigDecimal, y: BigDecimal): Bool Source

Compare x and y for equality normalizing any difference in scale.

def pow(x: BigDecimal, n: Int32): BigDecimal Source

Returns x raised to the power of n.

def precision(x: BigDecimal): Int32 Source

Returns the precision of x.

def round(x: BigDecimal): BigDecimal Source

Returns x rounded to a BigDecimal representing the nearest integer value.

The rounding may be upwards or downwards. If the rounding up and rounding down are equally close, x will be rounded to an even value (i.e. round(0.5ff64) == 0.0ff64).

def scale(x: BigDecimal): Int32 Source

Returns the scale of x.

def signum(x: BigDecimal): Int32 Source

Returns 1 if x > 0, -1 if x < 0, and 0 if x = 0.

def toBigInt(x: BigDecimal): BigInt Source

Convert x to a BigInt.

def toPlainString(x: BigDecimal): String Source

Returns x as a "plain string" without an exponent field.

def tryToFloat32(x: BigDecimal): Option[Float32] Source

Convert x to an Option[Float32].

Returns Some(x as Float32) if the numeric value of x is within the range of Float32, loss of precision may occur.

Returns None if the numeric value of x is outside the range of Float32 (i.e. 1.4E-45 to 3.4028235E38).

def tryToFloat64(x: BigDecimal): Option[Float64] Source

Convert x to an Option[Float64].

Returns Some(x as Float64) if the numeric value of x is within the range of Float64, loss of precision may occur.

Returns None if the numeric value of x is outside the range of Float64 (i.e 4.9E-324 to 1.7976931348623157E308).

def tryToInt16(x: BigDecimal): Option[Int16] Source

Convert x to an Option[Int16].

Returns Some(x as Int16) if the numeric value of x is within the range of Int16, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int16 (i.e. -32768 to 32767).

def tryToInt32(x: BigDecimal): Option[Int32] Source

Convert x to an Option[Int32].

Returns Some(x as Int32) if the numeric value of x is within the range of Int32, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int32 (i.e. -2147483648 to 2147483647).

def tryToInt64(x: BigDecimal): Option[Int64] Source

Convert x to an Option[Int64].

Returns Some(x as Int64) if the numeric value of x is within the range of Int64, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int64 (i.e. -9223372036854775808 to 9223372036854775807).

def tryToInt8(x: BigDecimal): Option[Int8] Source

Convert x to an Option[Int8].

Returns Some(x as Int8) if the numeric value of x is within the range of Int8, rounding x towards 0`.

Returns None if the numeric value of x is outside the range of Int8 (i.e. -128 to 127).