Decimal

data class Decimal(val min: BigInteger, val max: BigInteger, val scale: Int, val rounding: Type.Decimal.Rounding = Rounding.TOWARDS_ZERO, val overflow: Type.Decimal.Overflow = Overflow.ERROR) : Type

A decimal type. min and max are inclusive unscaled big integers, allowing for easier comparison with the unscaled value of a decimal.

Decimal types with scale of 0 are referred to as Integers.

Constructors

Link copied to clipboard
constructor(min: BigInteger, max: BigInteger, scale: Int, rounding: Type.Decimal.Rounding = Rounding.TOWARDS_ZERO, overflow: Type.Decimal.Overflow = Overflow.ERROR)

Types

Link copied to clipboard

Decimal's overflow modes.

Link copied to clipboard

Decimal's rounding modes, inspired by com.ionspin.kotlin.bignum.decimal.RoundingMode.

Properties

Link copied to clipboard
open override val kind: String
Link copied to clipboard
val max: BigInteger
Link copied to clipboard
val min: BigInteger
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val scale: Int

Functions

Link copied to clipboard
infix fun Type.accepts(v: Value): Boolean

Convenience method to check a value against a type with no named declarations, ignoring the specifications of mismatches.

fun Type.accepts(v: Value, schema: Schema): Boolean

Convenience method to check a value against a type, ignoring the specifications of mismatches.

Link copied to clipboard
infix fun Type.check(v: Value): List<Mismatch>

Check a value against a type with no named declarations to resolve against.

fun Type.check(v: Value, schema: Schema): List<Mismatch>

Check a value against a type, resolving any Type.Ref through schema.

Link copied to clipboard

Coerce a decimal value into this type: rescale it to scale with rounding, then apply overflow if the result falls outside min..max.

Link copied to clipboard