Return this number as a scala.math.BigDecimal.
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
.
Type-safe inequality for JsonNumber.
Type-safe equality for JsonNumber.
Construct a JSON number if this is a valid JSON number.
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.
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.
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 true
if and only if this number wraps a scala.Double and is either
Double.NegativeInfinity
or Double.PositiveInfinity
.
Return true
if and only if this number wraps a scala.Double and is either
Double.NegativeInfinity
or Double.PositiveInfinity
.
Return true
if and only if this number wraps a scala.Double and it is Double.NaN
.
Return true
if and only if this number wraps a scala.Double and it is Double.NaN
.
Return true if this is a valid real number (i.e.
Return true if this is a valid real number (i.e. not infinity or Double.NaN
).
Return this number as a scala.math.BigInt if it is an integer.
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.math.BigInt.
Truncate the number to a scala.math.BigInt.
Truncation means that we round toward zero to the closest scala.math.BigInt.
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
.
A JSON number with optimization by cases.