sealed abstract class JsonNumber extends AnyRef
JSON numbers with optimization by cases. Note: Javascript numbers are 64-bit decimals.
- Source
- JsonNumber.scala
- Alphabetic
- By Inheritance
- JsonNumber
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJson: Json
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(that: Any): Boolean
- Definition Classes
- JsonNumber → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- JsonNumber → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toBigInt: Option[BigInt]
Returns this number as a
BigInt
, only if this number is an integer. - def toByte: Option[Byte]
Returns this number as a
Byte
, only if this number is a validByte
. - lazy val toDouble: Option[Double]
Returns this number as a
Double
, only if this number can be represented as aDouble
. - lazy val toFloat: Option[Float]
Returns this number as a
Float
, only if this number can be represented as aFloat
. - def toInt: Option[Int]
Returns this number as a
Int
, only if this number is a validInt
. - def toShort: Option[Short]
Returns this number as a
Short
, only if this number is a validShort
. - def toString(): String
- Definition Classes
- AnyRef → Any
- def truncateToBigInt: Option[BigInt]
Truncates the number to a BigInt.
Truncates the number to a BigInt. Truncation means that we round the real number towards 0 to the closest BigInt.
Truncation fails for numbers whose decimal representation contains more than 2 ^ 18 digits, since creating
BigInt
values for these numbers is computationally expensive. - def truncateToByte: Byte
Truncates the number to a Byte.
Truncates the number to a Byte. Truncation means that we round the real number towards 0 to the closest, valid Byte. So, if the number is 1e99, then this will return
Byte.MaxValue
. - def truncateToDouble: Double
Truncates this number to the best
Double
approximation to this number.Truncates this number to the best
Double
approximation to this number. Anything overDouble.MaxValue
gets rounded toDouble.PositiveInfinity
and anything belowDouble.MinValue
gets rounded toDouble.NegativeInfinity
. - def truncateToFloat: Float
Truncates this number to the best
Float
approximation to this number.Truncates this number to the best
Float
approximation to this number. Anything overFloat.MaxValue
gets rounded toFloat.PositiveInfinity
and anything belowFloat.MinValue
gets rounded toFloat.NegativeInfinity
. - def truncateToInt: Int
Truncates the number to a Int.
Truncates the number to a Int. Truncation means that we round the real number towards 0 to the closest, valid Int. So, if the number is 1e99, then this will return
Int.MaxValue
. - def truncateToLong: Long
Truncates the number to a Long.
Truncates the number to a Long. Truncation means that we round the real number towards 0 to the closest, valid Long. So, if the number is 1e99, then this will return
Long.MaxValue
. - def truncateToShort: Short
Truncates the number to a Short.
Truncates the number to a Short. Truncation means that we round the real number towards 0 to the closest, valid Short. So, if the number is 1e99, then this will return
Short.MaxValue
. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()