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.
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.
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.
Tests if a
is one.
Tests if a
is one.
Tests if a
is zero.
Tests if a
is zero.
Given a sequence of as
, compute the product.
Given a sequence of as
, compute the product.
Given a sequence of as
, compute the sum.
Given a sequence of as
, compute the sum.
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).
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).
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.