RealIsFractional

com.phasmidsoftware.number.core.numerical.Real.RealIsFractional
See theRealIsFractional companion object
trait RealIsFractional extends Fractional[Real], RealIsNumeric

Following are the definitions required by Fractional[Real]

Attributes

Companion
object
Graph
Supertypes
trait Fractional[Real]
trait Numeric[Real]
trait Ordering[Real]
trait PartialOrdering[Real]
trait Equiv[Real]
trait Serializable
trait Comparator[Real]
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Type members

Inherited classlikes

class FractionalOps(lhs: Fractional.this.T) extends NumericOps

Attributes

Inherited from:
Fractional
Supertypes
class Fractional.this.NumericOps
class Object
trait Matchable
class Any
class NumericOps(lhs: Numeric.this.T)

Attributes

Inherited from:
Numeric
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Fractional.this.FractionalOps
class OrderingOps(lhs: Ordering.this.T)

This inner class defines comparison operators available for T.

This inner class defines comparison operators available for T.

It can't extend AnyVal because it is not a top-level class or a member of a statically accessible object.

Value parameters

lhs

the left-hand side value for infix comparison operations

Attributes

Inherited from:
Ordering
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def div(x: Real, y: Real): Real

Divides one Real number by another.

Divides one Real number by another.

Value parameters

x

the numerator as a Real number

y

the denominator as a Real number, should not be zero

Attributes

Returns

the result of dividing x by y as a Real number

Inherited methods

def abs(x: Real): Real

Attributes

Inherited from:
Numeric
def compare(x: Real, y: Real): Int

When we do a compare on NatLog numbers, they are in the same order as PureNumber numbers (i.e. monotonically increasing). It's not necessary to convert exact numbers to fuzzy numbers for this purpose, we simply pretend that the NatLog numbers are PureNumber numbers.

When we do a compare on NatLog numbers, they are in the same order as PureNumber numbers (i.e. monotonically increasing). It's not necessary to convert exact numbers to fuzzy numbers for this purpose, we simply pretend that the NatLog numbers are PureNumber numbers.

Value parameters

x

the first Real.

y

the second Real.

Attributes

Returns

an Int representing the order.

Inherited from:
RealIsOrdering
override def equiv(x: Real, y: Real): Boolean

Returns true if x == y in the ordering.

Returns true if x == y in the ordering.

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Definition Classes
Ordering -> PartialOrdering -> Equiv
Inherited from:
Ordering
def fromInt(x: Int): Real

Converts an integer value to a Real instance.

Converts an integer value to a Real instance.

Value parameters

x

the integer value to be converted.

Attributes

Returns

the Real instance corresponding to the given integer value.

Inherited from:
RealIsNumeric
override def gt(x: Real, y: Real): Boolean

Returns true if x > y in the ordering.

Returns true if x > y in the ordering.

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def gteq(x: Real, y: Real): Boolean

Returns true if x >= y in the ordering.

Returns true if x >= y in the ordering.

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def isReverseOf(other: Ordering[_]): Boolean

Returns whether or not the other ordering is the opposite ordering of this one.

Returns whether or not the other ordering is the opposite ordering of this one.

Equivalent to other == this.reverse.

Implementations should only override this method if they are overriding reverse as well.

Value parameters

other

the ordering to check

Attributes

Returns

true if other is the reverse of this ordering, false otherwise

Inherited from:
Ordering
override def lt(x: Real, y: Real): Boolean

Returns true if x < y in the ordering.

Returns true if x < y in the ordering.

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def lteq(x: Real, y: Real): Boolean

Returns true if x <= y in the ordering.

Returns true if x <= y in the ordering.

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def max[U <: Real](x: U, y: U): U

Returns x if x >= y, otherwise y.

Returns x if x >= y, otherwise y.

Type parameters

U

a subtype of T, used to preserve the specific type in the return value

Value parameters

x

the first candidate value

y

the second candidate value

Attributes

Inherited from:
Ordering
def min[U <: Real](x: U, y: U): U

Returns x if x <= y, otherwise y.

Returns x if x <= y, otherwise y.

Type parameters

U

a subtype of T, used to preserve the specific type in the return value

Value parameters

x

the first candidate value

y

the second candidate value

Attributes

Inherited from:
Ordering
def minus(x: Real, y: Real): Real

Subtracts the second real number from the first real number.

Subtracts the second real number from the first real number.

Value parameters

x

the first operand of type Real

y

the second operand of type Real to be subtracted from the first operand

Attributes

Returns

the result of subtracting the second operand from the first operand, of type Real

Inherited from:
RealIsNumeric
def negate(x: Real): Real

Computes the negation of the given Real number.

Computes the negation of the given Real number.

Value parameters

x

the Real number to be negated

Attributes

Returns

a new Real number representing the negation of the input value

Inherited from:
RealIsNumeric
def on[U](f: U => Real): Ordering[U]

Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:

def compare[U, T: Ordering](x: U, y: U, f: U => T) = Ordering[T].compare(f(x), f(y))

Type parameters

U

the type of the values to be ordered

Value parameters

f

the function to extract a T value from a U value

Attributes

Returns

an Ordering[U] that orders values by applying f and comparing the results using this ordering

Inherited from:
Ordering
def one: Real

Attributes

Inherited from:
Numeric
def orElse(other: Ordering[Real]): Ordering[Real]

Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.

Value parameters

other

an Ordering to use if this Ordering returns zero

Attributes

Returns

an Ordering[T] that uses this ordering first, falling back to other when values are equal

Example
case class Pair(a: Int, b: Int)
val pairOrdering = Ordering.by[Pair, Int](_.a)
                          .orElse(Ordering.by[Pair, Int](_.b))
Inherited from:
Ordering
def orElseBy[S](f: Real => S)(implicit ord: Ordering[S]): Ordering[Real]

Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:

def compare[T, S: Ordering](x: T, y: T, f: T => S) = Ordering[S].compare(f(x), f(y))

This function is equivalent to passing the result of Ordering.by(f) to orElse.

Type parameters

S

the type returned by the extraction function f

Value parameters

f

the function to extract a comparison key from a T value

ord

the implicit ordering for the extracted key type S

Attributes

Returns

an Ordering[T] that uses this ordering first, falling back to comparing by f when values are equal

Example
case class Pair(a: Int, b: Int)
val pairOrdering = Ordering.by[Pair, Int](_.a)
                          .orElseBy[Int](_.b)
Inherited from:
Ordering
def parseString(str: String): Option[Real]

Parses a given string and attempts to convert it into an Option[Real].

Parses a given string and attempts to convert it into an Option[Real].

Value parameters

str

the input string that needs to be parsed

Attributes

Returns

an Option[Real] representing the parsed value if successful, or None if the parsing fails

Inherited from:
RealIsNumeric
def plus(x: Real, y: Real): Real

Adds two Real numbers and returns the result.

Adds two Real numbers and returns the result.

Value parameters

x

The first Real number to be added.

y

The second Real number to be added.

Attributes

Returns

The result of adding x and y as a Real number.

Inherited from:
RealIsNumeric
override def reverse: Ordering[Real]

Returns the opposite ordering of this one.

Returns the opposite ordering of this one.

Implementations overriding this method MUST override isReverseOf as well if they change the behavior at all (for example, caching does not require overriding it).

Attributes

Returns

an Ordering[T] that compares elements in the reverse order of this ordering

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def reversed(): Comparator[Real]

Attributes

Inherited from:
Comparator
def sign(x: Real): Real

Attributes

Inherited from:
Numeric
def thenComparing[U <: Comparable[_ >: U <: <FromJavaObject>]](x$0: Function[_ >: Real <: <FromJavaObject>, _ <: U]): Comparator[Real]

Attributes

Inherited from:
Comparator
def thenComparing[U <: <FromJavaObject>](x$0: Function[_ >: Real <: <FromJavaObject>, _ <: U], x$1: Comparator[_ >: U <: <FromJavaObject>]): Comparator[Real]

Attributes

Inherited from:
Comparator
def thenComparing(x$0: Comparator[_ >: Real <: <FromJavaObject>]): Comparator[Real]

Attributes

Inherited from:
Comparator
def thenComparingDouble(x$0: ToDoubleFunction[_ >: Real <: <FromJavaObject>]): Comparator[Real]

Attributes

Inherited from:
Comparator
def thenComparingInt(x$0: ToIntFunction[_ >: Real <: <FromJavaObject>]): Comparator[Real]

Attributes

Inherited from:
Comparator
def thenComparingLong(x$0: ToLongFunction[_ >: Real <: <FromJavaObject>]): Comparator[Real]

Attributes

Inherited from:
Comparator
def times(x: Real, y: Real): Real

Multiplies two Real numbers and returns the result as a Real.

Multiplies two Real numbers and returns the result as a Real.

Value parameters

x

the first Real number

y

the second Real number

Attributes

Returns

the product of x and y as a Real

Inherited from:
RealIsNumeric
def toDouble(x: Real): Double

Converts a Real number into a Double representation.

Converts a Real number into a Double representation.

Value parameters

x

the Real number to be converted

Attributes

Returns

the Double representation of the given Real number

Inherited from:
RealIsNumeric
def toFloat(x: Real): Float

Converts a Real number to a Float representation.

Converts a Real number to a Float representation.

Value parameters

x

the Real number to be converted.

Attributes

Returns

the Float representation of the given Real number.

Inherited from:
RealIsNumeric
def toInt(x: Real): Int

Converts a Real number to an Int by first converting it to a Long, then narrowing it to an Int.

Converts a Real number to an Int by first converting it to a Long, then narrowing it to an Int.

Value parameters

x

the Real number to be converted

Attributes

Returns

the integer representation of the Real number

Inherited from:
RealIsNumeric
def toLong(x: Real): Long

Converts a Real value to its corresponding Long representation.

Converts a Real value to its corresponding Long representation.

Value parameters

x

the Real value to be converted

Attributes

Returns

the Long representation of the given Real value

Inherited from:
RealIsNumeric
def tryCompare(x: Real, y: Real): Some[Int]

Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).

Value parameters

x

the first value to compare

y

the second value to compare

Attributes

Inherited from:
Ordering
def zero: Real

Attributes

Inherited from:
Numeric

Deprecated and Inherited methods

def signum(x: Real): Int

Attributes

Deprecated
[Since version 2.13.0] use `sign` method instead
Inherited from:
Numeric

Implicits

Inherited implicits

implicit override def mkNumericOps(lhs: Real): FractionalOps

Attributes

Definition Classes
Fractional -> Numeric
Inherited from:
Fractional
implicit def mkOrderingOps(lhs: Real): OrderingOps

This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.

Value parameters

lhs

the value to enrich with ordering operators

Attributes

Inherited from:
Ordering