class DoubleAlgebra extends Field[Double] with Serializable
Due to the way floating-point equality works, this instance is not lawful under equality, but is correct when taken as an approximation of an exact value.
If you would prefer an absolutely lawful fractional value, you'll need to investigate rational numbers or more exotic types.
- Source
- double.scala
- Alphabetic
- By Inheritance
- DoubleAlgebra
- Field
- CommutativeSemifield
- MultiplicativeCommutativeGroup
- DivisionRing
- Semifield
- MultiplicativeGroup
- EuclideanRing
- GCDRing
- CommutativeRing
- CommutativeRng
- CommutativeRig
- MultiplicativeCommutativeMonoid
- CommutativeSemiring
- MultiplicativeCommutativeSemigroup
- Ring
- Rng
- AdditiveCommutativeGroup
- AdditiveGroup
- Rig
- MultiplicativeMonoid
- Semiring
- MultiplicativeSemigroup
- AdditiveCommutativeMonoid
- AdditiveCommutativeSemigroup
- AdditiveMonoid
- AdditiveSemigroup
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new DoubleAlgebra()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def additive: CommutativeGroup[Double]
- Definition Classes
- AdditiveCommutativeGroup → AdditiveCommutativeMonoid → AdditiveCommutativeSemigroup → AdditiveGroup → AdditiveMonoid → AdditiveSemigroup
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def div(x: Double, y: Double): Double
- Definition Classes
- DoubleAlgebra → MultiplicativeGroup
- def emod(a: Double, b: Double): Double
- Definition Classes
- Field → EuclideanRing
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def equot(a: Double, b: Double): Double
- Definition Classes
- Field → EuclideanRing
- def equotmod(a: Double, b: Double): (Double, Double)
- Definition Classes
- Field → EuclideanRing
- def euclideanFunction(a: Double): BigInt
- Definition Classes
- Field → EuclideanRing
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fromBigInt(n: BigInt): Double
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'sone
, or-n
summations of-one
ifn
is negative.Most type class instances should consider overriding this method for performance reasons.
- Definition Classes
- DoubleAlgebra → Ring
- def fromDouble(x: Double): Double
This is implemented in terms of basic Ring ops.
This is implemented in terms of basic Ring ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method be overriden.
This is possible because a Double is a rational number.
- Definition Classes
- DoubleAlgebra → Field → DivisionRing
- def fromInt(x: Int): Double
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'sone
, or-n
summations of-one
ifn
is negative.Most type class instances should consider overriding this method for performance reasons.
- Definition Classes
- DoubleAlgebra → Ring
- def gcd(a: Double, b: Double)(implicit eqA: Eq[Double]): Double
- Definition Classes
- Field → EuclideanRing → GCDRing
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isOne(a: Double)(implicit ev: Eq[Double]): Boolean
Tests if
a
is one.Tests if
a
is one.- Definition Classes
- MultiplicativeMonoid
- def isZero(a: Double)(implicit ev: Eq[Double]): Boolean
Tests if
a
is zero.Tests if
a
is zero.- Definition Classes
- AdditiveMonoid
- def lcm(a: Double, b: Double)(implicit eqA: Eq[Double]): Double
- Definition Classes
- Field → EuclideanRing → GCDRing
- def minus(x: Double, y: Double): Double
- Definition Classes
- DoubleAlgebra → AdditiveGroup
- def multiplicative: CommutativeGroup[Double]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def negate(x: Double): Double
- Definition Classes
- DoubleAlgebra → AdditiveGroup
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def one: Double
- Definition Classes
- DoubleAlgebra → MultiplicativeMonoid
- def plus(x: Double, y: Double): Double
- Definition Classes
- DoubleAlgebra → AdditiveSemigroup
- def positivePow(a: Double, n: Int): Double
- Attributes
- protected[this]
- Definition Classes
- MultiplicativeSemigroup
- def positiveSumN(a: Double, n: Int): Double
- Attributes
- protected[this]
- Definition Classes
- AdditiveSemigroup
- def pow(x: Double, y: Int): Double
- Definition Classes
- DoubleAlgebra → MultiplicativeGroup → MultiplicativeMonoid → MultiplicativeSemigroup
- def product(as: TraversableOnce[Double]): Double
Given a sequence of
as
, compute the product.Given a sequence of
as
, compute the product.- Definition Classes
- MultiplicativeMonoid
- Annotations
- @nowarn()
- def reciprocal(x: Double): Double
- Definition Classes
- DoubleAlgebra → MultiplicativeGroup
- def sum(as: TraversableOnce[Double]): Double
Given a sequence of
as
, compute the sum.Given a sequence of
as
, compute the sum.- Definition Classes
- AdditiveMonoid
- Annotations
- @nowarn()
- def sumN(a: Double, n: Int): Double
- Definition Classes
- AdditiveGroup → AdditiveMonoid → AdditiveSemigroup
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def times(x: Double, y: Double): Double
- Definition Classes
- DoubleAlgebra → MultiplicativeSemigroup
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tryProduct(as: TraversableOnce[Double]): Option[Double]
Given a sequence of
as
, combine them and return the total.Given a sequence of
as
, combine them and return the total.If the sequence is empty, returns None. Otherwise, returns Some(total).
- Definition Classes
- MultiplicativeMonoid → MultiplicativeSemigroup
- Annotations
- @nowarn()
- def trySum(as: TraversableOnce[Double]): Option[Double]
Given a sequence of
as
, combine them and return the total.Given a sequence of
as
, combine them and return the total.If the sequence is empty, returns None. Otherwise, returns Some(total).
- Definition Classes
- AdditiveMonoid → AdditiveSemigroup
- Annotations
- @nowarn()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zero: Double
- Definition Classes
- DoubleAlgebra → AdditiveMonoid