NumberTag

trait NumberTag[A]

A NumberTag provides information about important implementations details of numbers. For instance, it includes information about whether we can expect arithmetic to overflow or produce invalid values, the bounds of the number if they exist, whether it is an approximate or exact number type, etc.

Companion
object
class Object
trait Matchable
class Any
class BuiltinIntTag[A]
class CustomTag[A]
class LargeTag[A]

Value members

Abstract methods

def hasMaxValue: Option[A]

Returns the largest finite value that A can represent, if one exists. For instance, the largest finite value representable by Double is 1.7976931348623157E308. On the other hand, BigInt has no largest value.

Returns the largest finite value that A can represent, if one exists. For instance, the largest finite value representable by Double is 1.7976931348623157E308. On the other hand, BigInt has no largest value.

def hasMinValue: Option[A]

Returns the smallest finite value that A can represent, if one exists. For instance, the smallest finite value representable by Double is -1.7976931348623157E308. On the other hand, BigInt has no smallest value.

Returns the smallest finite value that A can represent, if one exists. For instance, the smallest finite value representable by Double is -1.7976931348623157E308. On the other hand, BigInt has no smallest value.

def hasNaN: Option[A]

If A has values that represent an undefined or invalid value, then a repsentitive value may be used here. Otherwise this returned None to indicate that all values in A are valid numbers in the extended real number line.

If A has values that represent an undefined or invalid value, then a repsentitive value may be used here. Otherwise this returned None to indicate that all values in A are valid numbers in the extended real number line.

def hasNegativeInfinity: Option[A]

If A has a value that represents a negative infinity, then it is returned here, otherwise a value of None indicates that negative infinity cannot be represented in A.

If A has a value that represents a negative infinity, then it is returned here, otherwise a value of None indicates that negative infinity cannot be represented in A.

def hasPositiveInfinity: Option[A]

If A has a value that represents a positive infinity, then it is returned here, otherwise a value of None indicates that positive infinity cannot be represented in A.

If A has a value that represents a positive infinity, then it is returned here, otherwise a value of None indicates that positive infinity cannot be represented in A.

def hasZero: Option[A]

If A has a value that represents the real value 0, then it is returned here. Otherwise None is returned.

If A has a value that represents the real value 0, then it is returned here. Otherwise None is returned.

def isInfinite(a: A): Boolean

Returns true if a is an infinite value (either positive or negative) and false otherwise.

Returns true if a is an infinite value (either positive or negative) and false otherwise.

def isNaN(a: A): Boolean

Returns true if a is an invalid number. Note that positive and negative infinities are valid numbers.

Returns true if a is an invalid number. Note that positive and negative infinities are valid numbers.

def isSigned: Boolean

Returns true if A can represent both positive and negative values.

Returns true if A can represent both positive and negative values.

def overflows: Boolean

Returns true if this value can overflow as a result of arithmetic operations. Types that overflow include Int and Long.

Returns true if this value can overflow as a result of arithmetic operations. Types that overflow include Int and Long.

Returns the resolution of this number.

Returns the resolution of this number.

Concrete methods

def finite: Boolean

Returns true if all values representable by A are finite and live on the real number line.

Returns true if all values representable by A are finite and live on the real number line.

def infinite: Boolean

Returns true if this type can represent arbitrarily large or small values.

Returns true if this type can represent arbitrarily large or small values.

def isFinite(a: A): Boolean

Returns true if a represents a finite value (neither infinite nor invalid).

Returns true if a represents a finite value (neither infinite nor invalid).