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.
- Alphabetic
- By Inheritance
- DoubleAlgebra
- Field
- MultiplicativeCommutativeGroup
- MultiplicativeGroup
- CommutativeRing
- CommutativeRng
- CommutativeRig
- MultiplicativeCommutativeMonoid
- CommutativeSemiring
- MultiplicativeCommutativeSemigroup
- Ring
- Rng
- AdditiveCommutativeGroup
- AdditiveGroup
- Rig
- MultiplicativeMonoid
- Semiring
- MultiplicativeSemigroup
- AdditiveCommutativeMonoid
- AdditiveCommutativeSemigroup
- AdditiveMonoid
- AdditiveSemigroup
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
div(x: Double, y: Double): Double
- Definition Classes
- DoubleAlgebra → MultiplicativeGroup
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.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 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 be overriden.
This is possible because a Double is a rational number.
- Definition Classes
- DoubleAlgebra → Field
-
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
-
final
def
getClass(): Class[_]
- 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
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
-
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
-
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
-
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
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
zero: Double
- Definition Classes
- DoubleAlgebra → AdditiveMonoid