Integral

trait Integral[@specialized(Int, Long) A] extends EuclideanRing[A] with ConvertableFrom[A] with ConvertableTo[A] with IsReal[A] with Order[A]

Integral number types, where / is truncated division.

Companion:
object

Value members

Inherited methods

def abs(a: A): A

An idempotent function that ensures an object has a non-negative sign.

An idempotent function that ensures an object has a non-negative sign.

Inherited from:
Signed
def ceil(a: A): A

Rounds a the nearest integer that is greater than or equal to a.

Rounds a the nearest integer that is greater than or equal to a.

Inherited from:
IsReal
def compare(x: A, y: A): Int

Result of comparing x with y. Returns an Int whose sign is:

Result of comparing x with y. Returns an Int whose sign is:

  • negative iff x < y
  • zero iff x = y
  • positive iff x > y
Inherited from:
Order
def comparison(x: A, y: A): Comparison

Like compare, but returns a cats.kernel.Comparison instead of an Int. Has the benefit of being able to pattern match on, but not as performant.

Like compare, but returns a cats.kernel.Comparison instead of an Int. Has the benefit of being able to pattern match on, but not as performant.

Inherited from:
Order
def emod(a: A, b: A): A
Inherited from:
EuclideanRing
def equot(a: A, b: A): A
Inherited from:
EuclideanRing
def equotmod(a: A, b: A): (A, A)
Inherited from:
EuclideanRing
override def eqv(x: A, y: A): Boolean

Returns true if x = y, false otherwise.

Returns true if x = y, false otherwise.

Definition Classes
Inherited from:
Order
Inherited from:
EuclideanRing
def floor(a: A): A

Rounds a the nearest integer that is less than or equal to a.

Rounds a the nearest integer that is less than or equal to a.

Inherited from:
IsReal
Inherited from:
ConvertableTo
Inherited from:
ConvertableTo
def fromBigInt(n: BigInt): A

Convert the given BigInt to an instance of A.

Convert the given BigInt to an instance of A.

This is equivalent to n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Inherited from:
Ring
def fromByte(n: Byte): A
Inherited from:
ConvertableTo
def fromDouble(n: Double): A
Inherited from:
ConvertableTo
def fromFloat(n: Float): A
Inherited from:
ConvertableTo
def fromInt(n: Int): A

Convert the given integer to an instance of A.

Convert the given integer to an instance of A.

Defined to be equivalent to sumN(one, n).

That is, n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Inherited from:
Ring
def fromLong(n: Long): A
Inherited from:
ConvertableTo
Inherited from:
ConvertableTo
def fromReal(n: Real): A
Inherited from:
ConvertableTo
def fromShort(n: Short): A
Inherited from:
ConvertableTo
def fromType[B : ConvertableFrom](b: B): A
Inherited from:
ConvertableTo
def gcd(a: A, b: A)(implicit ev: Eq[A]): A
Inherited from:
EuclideanRing
override def gt(x: A, y: A): Boolean

Returns true if x > y, false otherwise.

Returns true if x > y, false otherwise.

Definition Classes
Inherited from:
Order
override def gteqv(x: A, y: A): Boolean

Returns true if x >= y, false otherwise.

Returns true if x >= y, false otherwise.

Definition Classes
Inherited from:
Order
def isOne(a: A)(implicit ev: Eq[A]): Boolean

Tests if a is one.

Tests if a is one.

Inherited from:
MultiplicativeMonoid
Inherited from:
Signed
Inherited from:
Signed
Inherited from:
Signed
Inherited from:
Signed
Inherited from:
Signed
def isSignZero(a: A): Boolean
Inherited from:
Signed
def isWhole(a: A): Boolean

Returns true iff a is a an integer.

Returns true iff a is a an integer.

Inherited from:
IsReal
def isZero(a: A)(implicit ev: Eq[A]): Boolean

Tests if a is zero.

Tests if a is zero.

Inherited from:
AdditiveMonoid
def lcm(a: A, b: A)(implicit ev: Eq[A]): A
Inherited from:
EuclideanRing
override def lt(x: A, y: A): Boolean

Returns true if x < y, false otherwise.

Returns true if x < y, false otherwise.

Definition Classes
Inherited from:
Order
override def lteqv(x: A, y: A): Boolean

Returns true if x <= y, false otherwise.

Returns true if x <= y, false otherwise.

Definition Classes
Inherited from:
Order
def max(x: A, y: A): A

If x > y, return x, else return y.

If x > y, return x, else return y.

Inherited from:
Order
def min(x: A, y: A): A

If x < y, return x, else return y.

If x < y, return x, else return y.

Inherited from:
Order
def minus(x: A, y: A): A
Inherited from:
AdditiveGroup
def negate(x: A): A
Inherited from:
AdditiveGroup
override def neqv(x: A, y: A): Boolean

Returns true if x != y, false otherwise.

Returns true if x != y, false otherwise.

Note: this default implementation provided by Order is the same as the one defined in Eq, but for purposes of binary compatibility, the override in Order has not yet been removed. See this discussion.

Definition Classes
Inherited from:
Order
def one: A
Inherited from:
MultiplicativeMonoid
def order: Order[A]
Inherited from:
Signed
def partialCompare(x: A, y: A): Double
Inherited from:
Order

Like partialCompare, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

Like partialCompare, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

Inherited from:
PartialOrder
def plus(x: A, y: A): A
Inherited from:
AdditiveSemigroup
def pmax(x: A, y: A): Option[A]

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Inherited from:
PartialOrder
def pmin(x: A, y: A): Option[A]

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Inherited from:
PartialOrder
override def pow(a: A, n: Int): A
@nowarn("msg=deprecated")
def product(as: IterableOnce[A]): A

Given a sequence of as, compute the product.

Given a sequence of as, compute the product.

Inherited from:
MultiplicativeMonoid
def round(a: A): A

Rounds a to the nearest integer.

Rounds a to the nearest integer.

Inherited from:
IsReal
def sign(a: A): Sign

Returns Zero if a is 0, Positive if a is positive, and Negative is a is negative.

Returns Zero if a is 0, Positive if a is positive, and Negative is a is negative.

Inherited from:
Signed
def signum(a: A): Int

Returns 0 if a is 0, 1 if a is positive, and -1 is a is negative.

Returns 0 if a is 0, 1 if a is positive, and -1 is a is negative.

Inherited from:
Signed
@nowarn("msg=deprecated")
def sum(as: IterableOnce[A]): A

Given a sequence of as, compute the sum.

Given a sequence of as, compute the sum.

Inherited from:
AdditiveMonoid
override def sumN(a: A, n: Int): A
Definition Classes
Inherited from:
AdditiveGroup
def times(x: A, y: A): A
Inherited from:
ConvertableFrom
Inherited from:
ConvertableFrom
def toBigInt(a: A): BigInt
Inherited from:
ConvertableFrom
def toByte(a: A): Byte
Inherited from:
ConvertableFrom
def toDouble(a: A): Double

Approximates a as a Double.

Approximates a as a Double.

Inherited from:
IsReal
def toFloat(a: A): Float
Inherited from:
ConvertableFrom
def toInt(a: A): Int
Inherited from:
ConvertableFrom
def toLong(a: A): Long
Inherited from:
ConvertableFrom
def toNumber(a: A): Number
Inherited from:
ConvertableFrom

Convert a Order[A] to a scala.math.Ordering[A] instance.

Convert a Order[A] to a scala.math.Ordering[A] instance.

Inherited from:
Order
def toRational(a: A): Rational
Inherited from:
ConvertableFrom
def toReal(a: A): Real
Inherited from:
IsReal
def toShort(a: A): Short
Inherited from:
ConvertableFrom
def toString(a: A): String
Inherited from:
ConvertableFrom
def toType[B : ConvertableTo](a: A): B
Inherited from:
ConvertableFrom
def tryCompare(x: A, y: A): Option[Int]

Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is:

Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is:

  • negative iff x < y
  • zero iff x = y
  • positive iff x > y
Inherited from:
PartialOrder
@nowarn("msg=deprecated")
override def tryProduct(as: IterableOnce[A]): Option[A]
@nowarn("msg=deprecated")
override def trySum(as: IterableOnce[A]): Option[A]
Definition Classes
Inherited from:
AdditiveMonoid
def zero: A
Inherited from:
AdditiveMonoid