Packages

final class Decimal extends Ordered[Decimal] with Serializable

A mutable implementation of BigDecimal that can hold a Long if values are small enough.

The semantics of the fields are as follows: - _precision and _scale represent the SQL precision and scale we are looking for - If decimalVal is set, it represents the whole decimal value - Otherwise, the decimal value is longVal / (10 ** _scale)

Note, for values between -1.0 and 1.0, precision digits are only counted after dot.

Annotations
@Unstable()
Source
Decimal.scala
Linear Supertypes
Serializable, Serializable, Ordered[Decimal], Comparable[Decimal], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Decimal
  2. Serializable
  3. Serializable
  4. Ordered
  5. Comparable
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Decimal()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def %(that: Decimal): Decimal
  4. def *(that: Decimal): Decimal
  5. def +(that: Decimal): Decimal
  6. def -(that: Decimal): Decimal
  7. def /(that: Decimal): Decimal
  8. def <(that: Decimal): Boolean
    Definition Classes
    Ordered
  9. def <=(that: Decimal): Boolean
    Definition Classes
    Ordered
  10. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def >(that: Decimal): Boolean
    Definition Classes
    Ordered
  12. def >=(that: Decimal): Boolean
    Definition Classes
    Ordered
  13. def abs: Decimal
  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. def ceil: Decimal
  16. def changePrecision(precision: Int, scale: Int): Boolean

    Update precision and scale while keeping our value the same, and return true if successful.

    Update precision and scale while keeping our value the same, and return true if successful.

    returns

    true if successful, false if overflow would occur

  17. def clone(): Decimal
    Definition Classes
    Decimal → AnyRef
  18. def compare(other: Decimal): Int
    Definition Classes
    Decimal → Ordered
  19. def compareTo(that: Decimal): Int
    Definition Classes
    Ordered → Comparable
  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(other: Any): Boolean
    Definition Classes
    Decimal → AnyRef → Any
  22. def floor: Decimal
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  24. def hashCode(): Int
    Definition Classes
    Decimal → AnyRef → Any
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. def isZero: Boolean
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  30. def precision: Int
  31. def quot(that: Decimal): Decimal
  32. def remainder(that: Decimal): Decimal
  33. def scale: Int
  34. def set(decimal: Decimal): Decimal

    Set this Decimal to the given Decimal value.

  35. def set(bigintval: BigInteger): Decimal

    If the value is not in the range of long, convert it to BigDecimal and the precision and scale are based on the converted value.

    If the value is not in the range of long, convert it to BigDecimal and the precision and scale are based on the converted value.

    This code avoids BigDecimal object allocation as possible to improve runtime efficiency

  36. def set(decimal: BigDecimal): Decimal

    Set this Decimal to the given BigDecimal value, inheriting its precision and scale.

  37. def set(decimal: BigDecimal, precision: Int, scale: Int): Decimal

    Set this Decimal to the given BigDecimal value, with a given precision and scale.

  38. def set(unscaled: Long, precision: Int, scale: Int): Decimal

    Set this Decimal to the given unscaled Long, with a given precision and scale.

  39. def set(intVal: Int): Decimal

    Set this Decimal to the given Int.

    Set this Decimal to the given Int. Will have precision 10 and scale 0.

  40. def set(longVal: Long): Decimal

    Set this Decimal to the given Long.

    Set this Decimal to the given Long. Will have precision 20 and scale 0.

  41. def setOrNull(unscaled: Long, precision: Int, scale: Int): Decimal

    Set this Decimal to the given unscaled Long, with a given precision and scale, and return it, or return null if it cannot be set due to overflow.

  42. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  43. def toBigDecimal: BigDecimal
  44. def toByte: Byte
  45. def toDebugString: String
  46. def toDouble: Double
  47. def toFloat: Float
  48. def toInt: Int
  49. def toJavaBigDecimal: BigDecimal
  50. def toJavaBigInteger: BigInteger
  51. def toLong: Long
  52. def toPlainString: String
  53. def toScalaBigInt: BigInt
  54. def toShort: Short
  55. def toString(): String
    Definition Classes
    Decimal → AnyRef → Any
  56. def toUnscaledLong: Long
  57. def unary_-: Decimal
  58. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  60. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Ordered[Decimal]

Inherited from Comparable[Decimal]

Inherited from AnyRef

Inherited from Any

Ungrouped