Number

com.phasmidsoftware.number.algebra.eager.Number
See theNumber companion trait
object Number

The Number object provides predefined constants and implicit conversions related to numerical operations. It includes representations of common numbers and utilities to work with the Number type.

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Number.type

Members list

Type members

Classlikes

object NumberIsAdditiveCommutativeMonoid extends AdditiveCommutativeMonoid[Number]

Provides an implicit additive commutative monoid implementation for the Number type.

Provides an implicit additive commutative monoid implementation for the Number type.

This object defines the zero element and the plus operation for the Number type, conforming to the algebraic structure of an additive commutative monoid.

The zero element acts as the additive identity, and the plus operation is both associative and commutative, enabling addition of two Number instances.

Attributes

Supertypes
trait AdditiveCommutativeMonoid[Number]
trait AdditiveCommutativeSemigroup[Number]
trait AdditiveMonoid[Number]
trait AdditiveSemigroup[Number]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
object NumberIsMultiplicativeGroup extends MultiplicativeGroup[Number]

An implicit object defining the multiplicative group structure for Number instances.

An implicit object defining the multiplicative group structure for Number instances.

The NumberIsMultiplicativeGroup provides implementations for the methods required by the MultiplicativeGroup type class, enabling operations such as multiplication (times) and division (div) as well as access to the multiplicative identity (one). It supports a variety of Number subtypes, including Real, RationalNumber, and WholeNumber, and handles necessary conversions or raises exceptions when operations cannot be performed.

Attributes

Supertypes
trait MultiplicativeGroup[Number]
trait MultiplicativeMonoid[Number]
trait MultiplicativeSemigroup[Number]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Value members

Concrete fields

Represents the value -1 as an instance of WholeNumber. It is a predefined constant in the Number object.

Represents the value -1 as an instance of WholeNumber. It is a predefined constant in the Number object.

Attributes

val one: Number

Represents the number one as a WholeNumber instance.

Represents the number one as a WholeNumber instance.

Attributes

val two: Number

Represents the value 2 as an instance of WholeNumber. It is a predefined constant in the Number object.

Represents the value 2 as an instance of WholeNumber. It is a predefined constant in the Number object.

Attributes

val zero: Number

Represents the value 0 as an instance of WholeNumber. It is a predefined constant in the Number object.

Represents the value 0 as an instance of WholeNumber. It is a predefined constant in the Number object.

Attributes

Givens

Givens

Provides a DyadicOperator instance for the Number type. This instance defines how dyadic operations are performed on different subtypes of Number, such as RationalNumber, WholeNumber, and Real. Cross-type operations between different subtypes are also handled within this implementation.

Provides a DyadicOperator instance for the Number type. This instance defines how dyadic operations are performed on different subtypes of Number, such as RationalNumber, WholeNumber, and Real. Cross-type operations between different subtypes are also handled within this implementation.

The operation op delegates to the respective DyadicOperator instances for each specific subtype, and in the case of cross-type operations, attempts to convert between the subtypes to ensure the operation can be conducted.

Attributes

Returns

A DyadicOperator[Number] instance that encapsulates the logic for performing dyadic operations on numbers and their subtypes, including cross-type compatibility.

given given_Eq_Number: Eq[Number]

Provides an instance of type Eq for the Number type.

Provides an instance of type Eq for the Number type.

This instance defines equality for Number objects by delegating to the eqv method. If the eqv method successfully determines equivalence, the result is used. Otherwise, false is returned.

Attributes

Returns

an Eq instance for the Number type, implementing custom equality logic based on the eqv method's logic.

Provides a given implementation of FuzzyEq for the Number type.

Provides a given implementation of FuzzyEq for the Number type.

This implementation defines fuzzy equality for Number instances by checking for exact equality (===) or performing a fuzzy equivalence comparison with a given probability p. The method delegates the fuzzy equivalence logic to the fuzzyEqv method of the Number type if exact equivalence is not established.

Attributes

Returns

An instance of FuzzyEq[Number] that supports fuzzy equality comparison for Number objects.

Implicits

Implicits

implicit def convIntToNumber(x: Int): Number

Attributes