Return this number as a scala.math.BigDecimal.
Return this number as a scala.math.BigInt if it's a sufficiently small whole number.
Convert this number to its best scala.Double approximation.
Convert this number to its best scala.Double approximation.
Anything over Double.MaxValue
will be rounded to Double.PositiveInfinity
and anything below
Double.MinValue
is rounded to Double.NegativeInfinity
.
Return this number as a scala.Long if it's a valid scala.Long.
Truncate the number to a scala.Long.
Truncate the number to a scala.Long.
Truncation means that we round toward zero to the closest valid scala.Long. If the number
is 1e99
, for example, this will return Long.MaxValue
.
Universal equality derived from our type-safe equality.
Universal equality derived from our type-safe equality.
Hashing that is consistent with our universal equality.
Hashing that is consistent with our universal equality.
Return this number as a scala.Byte if it's a valid scala.Byte.
Return this number as an scala.Int if it's a valid scala.Int.
Return this number as a scala.Short if it's a valid scala.Short.
Truncate the number to a scala.Byte.
Truncate the number to a scala.Byte.
Truncation means that we round toward zero to the closest valid scala.Byte. If the number
is 1e99
, for example, this will return Byte.MaxValue
.
Truncate the number to an scala.Int.
Truncate the number to a scala.Short.
Truncate the number to a scala.Short.
Truncation means that we round toward zero to the closest valid scala.Short. If the number
is 1e99
, for example, this will return Short.MaxValue
.
Construct a JSON number if this is a valid JSON number.
Construct a JSON number if this is a valid JSON number.
(Since version 0.4.0) Use Json.fromJsonNumber
Construct a JSON number if this is a valid JSON number and a JSON null otherwise.
Construct a JSON number if this is a valid JSON number and a JSON null otherwise.
This matches the behaviour of most browsers, but it is a lossy operation as you can no longer
distinguish between Double.NaN
and infinity.
(Since version 0.4.0) Use Json.fromJsonNumber
Construct a JSON number if this is a valid JSON number and a JSON string otherwise.
Construct a JSON number if this is a valid JSON number and a JSON string otherwise.
This allows a scala.Double to be losslessly encoded, but it is likely to need custom handling for interoperability with other JSON systems.
(Since version 0.4.0) Use Json.fromJsonNumber
A JSON number with optimization by cases.