Trait/Object

spire.math

Fractional

Related Docs: object Fractional | package math

Permalink

trait Fractional[A] extends Field[A] with NRoot[A] with Integral[A]

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Fractional
  2. Integral
  3. IsReal
  4. Signed
  5. Order
  6. PartialOrder
  7. Eq
  8. ConvertableTo
  9. ConvertableFrom
  10. NRoot
  11. Field
  12. MultiplicativeAbGroup
  13. MultiplicativeGroup
  14. EuclideanRing
  15. CRing
  16. MultiplicativeCMonoid
  17. MultiplicativeCSemigroup
  18. Ring
  19. Rng
  20. AdditiveAbGroup
  21. AdditiveCMonoid
  22. AdditiveCSemigroup
  23. AdditiveGroup
  24. Rig
  25. MultiplicativeMonoid
  26. Semiring
  27. MultiplicativeSemigroup
  28. AdditiveMonoid
  29. AdditiveSemigroup
  30. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def abs(a: A): A

    Permalink

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

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

    Definition Classes
    Signed
  2. abstract def ceil(a: A): A

    Permalink

    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.

    Definition Classes
    IsReal
  3. abstract def compare(x: A, y: A): Int

    Permalink
    Definition Classes
    Order
  4. abstract def div(x: A, y: A): A

    Permalink
    Definition Classes
    MultiplicativeGroup
  5. abstract def floor(a: A): A

    Permalink

    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.

    Definition Classes
    IsReal
  6. abstract def fpow(a: A, b: A): A

    Permalink
    Definition Classes
    NRoot
  7. abstract def fromAlgebraic(n: Algebraic): A

    Permalink
    Definition Classes
    ConvertableTo
  8. abstract def fromBigDecimal(n: BigDecimal): A

    Permalink
    Definition Classes
    ConvertableTo
  9. abstract def fromBigInt(n: BigInt): A

    Permalink
    Definition Classes
    ConvertableTo
  10. abstract def fromByte(n: Byte): A

    Permalink
    Definition Classes
    ConvertableTo
  11. abstract def fromFloat(n: Float): A

    Permalink
    Definition Classes
    ConvertableTo
  12. abstract def fromLong(n: Long): A

    Permalink
    Definition Classes
    ConvertableTo
  13. abstract def fromRational(n: Rational): A

    Permalink
    Definition Classes
    ConvertableTo
  14. abstract def fromReal(n: Real): A

    Permalink
    Definition Classes
    ConvertableTo
  15. abstract def fromShort(n: Short): A

    Permalink
    Definition Classes
    ConvertableTo
  16. abstract def fromType[B](b: B)(implicit arg0: ConvertableFrom[B]): A

    Permalink
    Definition Classes
    ConvertableTo
  17. abstract def gcd(a: A, b: A): A

    Permalink
    Definition Classes
    EuclideanRing
  18. abstract def getClass(): Class[_]

    Permalink
    Definition Classes
    Any
  19. abstract def isWhole(a: A): Boolean

    Permalink

    Returns true iff a is a an integer.

    Returns true iff a is a an integer.

    Definition Classes
    IsReal
  20. abstract def mod(a: A, b: A): A

    Permalink
    Definition Classes
    EuclideanRing
  21. abstract def negate(x: A): A

    Permalink
    Definition Classes
    AdditiveGroup
  22. abstract def nroot(a: A, n: Int): A

    Permalink
    Definition Classes
    NRoot
  23. abstract def one: A

    Permalink
    Definition Classes
    MultiplicativeMonoid
  24. abstract def plus(x: A, y: A): A

    Permalink
    Definition Classes
    AdditiveSemigroup
  25. abstract def quot(a: A, b: A): A

    Permalink
    Definition Classes
    EuclideanRing
  26. abstract def round(a: A): A

    Permalink

    Rounds a to the nearest integer.

    Rounds a to the nearest integer.

    Definition Classes
    IsReal
  27. abstract def signum(a: A): Int

    Permalink

    Returns 0 if a is 0, > 0 if a is positive, and < 0 is a is negative.

    Returns 0 if a is 0, > 0 if a is positive, and < 0 is a is negative.

    Definition Classes
    Signed
  28. abstract def times(x: A, y: A): A

    Permalink
    Definition Classes
    MultiplicativeSemigroup
  29. abstract def toAlgebraic(a: A): Algebraic

    Permalink
    Definition Classes
    ConvertableFrom
  30. abstract def toBigDecimal(a: A): BigDecimal

    Permalink
    Definition Classes
    ConvertableFrom
  31. abstract def toBigInt(a: A): BigInt

    Permalink
    Definition Classes
    ConvertableFrom
  32. abstract def toByte(a: A): Byte

    Permalink
    Definition Classes
    ConvertableFrom
  33. abstract def toDouble(a: A): Double

    Permalink

    Approximates a as a Double.

    Approximates a as a Double.

    Definition Classes
    IsReal
  34. abstract def toFloat(a: A): Float

    Permalink
    Definition Classes
    ConvertableFrom
  35. abstract def toInt(a: A): Int

    Permalink
    Definition Classes
    ConvertableFrom
  36. abstract def toLong(a: A): Long

    Permalink
    Definition Classes
    ConvertableFrom
  37. abstract def toNumber(a: A): Number

    Permalink
    Definition Classes
    ConvertableFrom
  38. abstract def toRational(a: A): Rational

    Permalink
    Definition Classes
    ConvertableFrom
  39. abstract def toReal(a: A): Real

    Permalink
    Definition Classes
    IsReal
  40. abstract def toShort(a: A): Short

    Permalink
    Definition Classes
    ConvertableFrom
  41. abstract def toString(a: A): String

    Permalink
    Definition Classes
    ConvertableFrom
  42. abstract def toType[B](a: A)(implicit arg0: ConvertableTo[B]): B

    Permalink
    Definition Classes
    ConvertableFrom
  43. abstract def zero: A

    Permalink
    Definition Classes
    AdditiveMonoid

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. def additive: AbGroup[A]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  7. def eqv(x: A, y: A): Boolean

    Permalink

    Returns true if x and y are equivalent, false otherwise.

    Returns true if x and y are equivalent, false otherwise.

    Definition Classes
    OrderPartialOrderEq
  8. final def euclid(a: A, b: A)(implicit eq: Eq[A]): A

    Permalink
    Attributes
    protected[this]
    Definition Classes
    EuclideanRing
    Annotations
    @tailrec()
  9. def fromDouble(a: Double): A

    Permalink

    This is implemented in terms of basic Field ops.

    This is implemented in terms of basic Field ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method is overriden.

    This is possible because a Double is a rational number.

    Definition Classes
    Field
  10. def fromInt(n: Int): A

    Permalink

    Defined to be equivalent to additive.sumn(one, n).

    Defined to be equivalent to additive.sumn(one, n). That is, n repeated summations of this ring's one, or -one if n is negative.

    Definition Classes
    Ring
  11. def gt(x: A, y: A): Boolean

    Permalink
    Definition Classes
    OrderPartialOrder
  12. def gteqv(x: A, y: A): Boolean

    Permalink
    Definition Classes
    OrderPartialOrder
  13. def hashCode(): Int

    Permalink
    Definition Classes
    Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. def isOne(a: A)(implicit ev: Eq[A]): Boolean

    Permalink
    Definition Classes
    MultiplicativeMonoid
  16. def isSignNegative(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  17. def isSignNonNegative(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  18. def isSignNonPositive(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  19. def isSignNonZero(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  20. def isSignPositive(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  21. def isSignZero(a: A): Boolean

    Permalink
    Definition Classes
    Signed
  22. def isZero(a: A)(implicit ev: Eq[A]): Boolean

    Permalink

    Tests if a is zero.

    Tests if a is zero.

    Definition Classes
    AdditiveMonoid
  23. def lcm(a: A, b: A): A

    Permalink
    Definition Classes
    EuclideanRing
  24. def lt(x: A, y: A): Boolean

    Permalink
    Definition Classes
    OrderPartialOrder
  25. def lteqv(x: A, y: A): Boolean

    Permalink
    Definition Classes
    OrderPartialOrder
  26. def max(x: A, y: A): A

    Permalink
    Definition Classes
    Order
  27. def min(x: A, y: A): A

    Permalink
    Definition Classes
    Order
  28. def minus(x: A, y: A): A

    Permalink
    Definition Classes
    AdditiveGroup
  29. def multiplicative: AbGroup[A]

    Permalink
  30. def neqv(x: A, y: A): Boolean

    Permalink

    Returns false if x and y are equivalent, true otherwise.

    Returns false if x and y are equivalent, true otherwise.

    Definition Classes
    Eq
  31. def on[B](f: (B) ⇒ A): Order[B]

    Permalink

    Defines an order on B by mapping B to A using f and using As order to order B.

    Defines an order on B by mapping B to A using f and using As order to order B.

    Definition Classes
    OrderPartialOrderEq
  32. def partialCompare(x: A, y: A): Double

    Permalink

    Result of comparing x with y.

    Result of comparing x with y. Returns NaN if operands are not comparable. If operands are comparable, returns a Double whose sign is: - negative iff x < y - zero iff x === y - positive iff x > y

    Definition Classes
    OrderPartialOrder
  33. def pmax(x: A, y: A): Option[A]

    Permalink

    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.

    Definition Classes
    PartialOrder
  34. def pmin(x: A, y: A): Option[A]

    Permalink

    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.

    Definition Classes
    PartialOrder
  35. def pow(a: A, n: Int): A

    Permalink

    This is similar to Semigroup#pow, except that a pow 0 is defined to be the multiplicative identity.

    This is similar to Semigroup#pow, except that a pow 0 is defined to be the multiplicative identity.

    Definition Classes
    RigSemiring
  36. def prod(as: TraversableOnce[A]): A

    Permalink

    Given a sequence of as, sum them using the monoid and return the total.

    Given a sequence of as, sum them using the monoid and return the total.

    Definition Classes
    MultiplicativeMonoid
  37. def prodOption(as: TraversableOnce[A]): Option[A]

    Permalink

    Given a sequence of as, sum them using the semigroup and return the total.

    Given a sequence of as, sum them using the semigroup and return the total.

    If the sequence is empty, returns None. Otherwise, returns Some(total).

    Definition Classes
    MultiplicativeSemigroup
  38. def prodn(a: A, n: Int): A

    Permalink

    Return a multiplicated with itself n times.

    Return a multiplicated with itself n times.

    Definition Classes
    MultiplicativeGroupMultiplicativeMonoidMultiplicativeSemigroup
  39. def prodnAboveOne(a: A, n: Int): A

    Permalink
    Attributes
    protected
    Definition Classes
    MultiplicativeSemigroup
  40. def quotmod(a: A, b: A): (A, A)

    Permalink
    Definition Classes
    EuclideanRing
  41. def reciprocal(x: A): A

    Permalink
    Definition Classes
    MultiplicativeGroup
  42. def reverse: Order[A]

    Permalink

    Defines an ordering on A where all arrows switch direction.

    Defines an ordering on A where all arrows switch direction.

    Definition Classes
    OrderPartialOrder
  43. def sign(a: A): Sign

    Permalink

    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.

    Definition Classes
    Signed
  44. def sqrt(a: A): A

    Permalink
    Definition Classes
    NRoot
  45. def sum(as: TraversableOnce[A]): A

    Permalink

    Given a sequence of as, sum them using the monoid and return the total.

    Given a sequence of as, sum them using the monoid and return the total.

    Definition Classes
    AdditiveMonoid
  46. def sumOption(as: TraversableOnce[A]): Option[A]

    Permalink

    Given a sequence of as, sum them using the semigroup and return the total.

    Given a sequence of as, sum them using the semigroup and return the total.

    If the sequence is empty, returns None. Otherwise, returns Some(total).

    Definition Classes
    AdditiveSemigroup
  47. def sumn(a: A, n: Int): A

    Permalink

    Return a added with itself n times.

    Return a added with itself n times.

    Definition Classes
    AdditiveGroupAdditiveMonoidAdditiveSemigroup
  48. def sumnAboveOne(a: A, n: Int): A

    Permalink
    Attributes
    protected
    Definition Classes
    AdditiveSemigroup
  49. def toString(): String

    Permalink
    Definition Classes
    Any
  50. def tryCompare(x: A, y: A): Option[Int]

    Permalink

    Result of comparing x with y.

    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

    Definition Classes
    PartialOrder

Inherited from Integral[A]

Inherited from IsReal[A]

Inherited from Signed[A]

Inherited from Order[A]

Inherited from PartialOrder[A]

Inherited from Eq[A]

Inherited from ConvertableTo[A]

Inherited from ConvertableFrom[A]

Inherited from NRoot[A]

Inherited from Field[A]

Inherited from MultiplicativeAbGroup[A]

Inherited from MultiplicativeGroup[A]

Inherited from EuclideanRing[A]

Inherited from CRing[A]

Inherited from MultiplicativeCMonoid[A]

Inherited from MultiplicativeCSemigroup[A]

Inherited from Ring[A]

Inherited from Rng[A]

Inherited from AdditiveAbGroup[A]

Inherited from AdditiveCMonoid[A]

Inherited from AdditiveCSemigroup[A]

Inherited from AdditiveGroup[A]

Inherited from Rig[A]

Inherited from MultiplicativeMonoid[A]

Inherited from Semiring[A]

Inherited from MultiplicativeSemigroup[A]

Inherited from AdditiveMonoid[A]

Inherited from AdditiveSemigroup[A]

Inherited from Any

Ungrouped