Decimal

com.choreograph.tyda.Decimal$package.Decimal
object Decimal

Attributes

Source
Decimal.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Decimal.type

Members list

Type members

Classlikes

sealed trait Valid[Precision <: Int, Scale <: Int] extends Serializable

Attributes

Source
Decimal.scala
Supertypes
trait Serializable
class Object
trait Matchable
class Any

Types

type MaxPrecision = 38

Attributes

Source
Decimal.scala

Value members

Concrete methods

def apply[Precision <: Int, Scale <: Int](using valid: Valid[Precision, Scale], ev: ((Precision - Scale) >= 10) =:= true)(value: Int): Decimal[Precision, Scale]

Create a Decimal from an Int value.

Create a Decimal from an Int value.

The function takes evidence that requires there to be enough precision to represent all Int values.

Attributes

Source
Decimal.scala

Create a Decimal from a Long value.

Create a Decimal from a Long value.

The function takes evidence that requires there to be enough precision to represent all Long values.

Attributes

Source
Decimal.scala
def apply[Precision <: Int, Scale <: Int](using valid: Valid[Precision, Scale])(value: BigDecimal): Option[Decimal[Precision, Scale]]

Construct a Decimal from a Java BigDecimal.

Construct a Decimal from a Java BigDecimal.

Returns None if the required precision is not met and performs rounding if the BigDecimal has higher scale.

Attributes

Source
Decimal.scala

Construct a Decimal from a BigDecimal.

Construct a Decimal from a BigDecimal.

Returns None if the required precision is not met and performs rounding if the BigDecimal has higher scale.

Attributes

Source
Decimal.scala

Create a Decimal from a Byte value.

Create a Decimal from a Byte value.

The function takes evidence that requires there to be enough precision to represent all Byte values (which require at most 3 digits plus the scale).

Attributes

Source
Decimal.scala

Create a Decimal from a Short value.

Create a Decimal from a Short value.

The function takes evidence that requires there to be enough precision to represent all Short values (which require at most 5 digits plus the scale).

Attributes

Source
Decimal.scala

Construct a Decimal from a Float value.

Construct a Decimal from a Float value.

Returns None if the value is NaN or infinite, otherwise returns the closest Decimal representation.

Attributes

Source
Decimal.scala

Construct a Decimal from a Double value.

Construct a Decimal from a Double value.

Returns None if the value is NaN or infinite, otherwise returns the closest Decimal representation.

Attributes

Source
Decimal.scala

Returns a Decimal containing 0.

Returns a Decimal containing 0.

Attributes

Source
Decimal.scala

Concrete fields

Attributes

Source
Decimal.scala

Extensions

Extensions

extension [Precision <: Int, Scale <: Int](d: Decimal[Precision, Scale])

Rounds the decimal to the nearest Int.

Rounds the decimal to the nearest Int.

Returns None if the value is out of bounds for a Int.

Attributes

Source
Decimal.scala

Rounds the decimal to the nearest long. Returns None if the value is out of bounds for a long.

Rounds the decimal to the nearest long. Returns None if the value is out of bounds for a long.

Attributes

Source
Decimal.scala

Converts the decimal into a BigDecimal.

Converts the decimal into a BigDecimal.

Attributes

Source
Decimal.scala

Converts the decimal into a Double.

Converts the decimal into a Double.

Note: In some cases this conversion will lose precision.

Attributes

Source
Decimal.scala
def toFloat: Float

Converts the decimal into a Float.

Converts the decimal into a Float.

Note: In some cases this conversion will lose precision.

Attributes

Source
Decimal.scala

Rounds the decimal to an Byte by truncating the value.

Rounds the decimal to an Byte by truncating the value.

Returns None if the value is out of bounds for a Int.

Attributes

Source
Decimal.scala

Rounds the decimal to an Int by truncating the value.

Rounds the decimal to an Int by truncating the value.

Returns None if the value is out of bounds for a Int.

Attributes

Source
Decimal.scala

Rounds the decimal to an Long by truncating the value.

Rounds the decimal to an Long by truncating the value.

Returns None if the value is out of bounds for a long.

Attributes

Source
Decimal.scala

Rounds the decimal to an Short by truncating the value.

Rounds the decimal to an Short by truncating the value.

Returns None if the value is out of bounds for a Short.

Attributes

Source
Decimal.scala
def widen[P2 <: Int, S2 <: Int](using valid: Valid[P2, S2], maxIncrease: ((P2 - S2) >= (Precision - Scale)) =:= true, scaleIncrease: (S2 >= Scale) =:= true): Decimal[P2, S2]

Widens the Decimal to a new precision and scale.

Widens the Decimal to a new precision and scale.

Attributes

Source
Decimal.scala
extension [Precision <: Int](d: Decimal[Precision, 0])

Converts the decimal to an Bytes if it is within the bounds of an Byte.

Converts the decimal to an Bytes if it is within the bounds of an Byte.

Attributes

Source
Decimal.scala

Converts the decimal to an Int if it is within the bounds of an Int.

Converts the decimal to an Int if it is within the bounds of an Int.

Attributes

Source
Decimal.scala

Converts the decimal to a Long if it is within the bounds of a Long.

Converts the decimal to a Long if it is within the bounds of a Long.

Attributes

Source
Decimal.scala

Converts the decimal to an Short if it is within the bounds of an Short.

Converts the decimal to an Short if it is within the bounds of an Short.

Attributes

Source
Decimal.scala
extension [Precision <: Int](d: Decimal[Precision, 0])(using (Precision <= 10) =:= true)
def toInt: Int

Converts the decimal to a Long that is statically know to be representable as a Long.

Converts the decimal to a Long that is statically know to be representable as a Long.

Attributes

Source
Decimal.scala
extension [Precision <: Int](d: Decimal[Precision, 0])(using (Precision <= 19) =:= true)
def toLong: Long

Converts the decimal to a Long that is statically know to be representable as a Long.

Converts the decimal to a Long that is statically know to be representable as a Long.

Attributes

Source
Decimal.scala