ExactNumber

com.phasmidsoftware.number.core.numerical.ExactNumber
See theExactNumber companion class
object ExactNumber

Companion object for the ExactNumber class.

Provides factory methods for creating instances of ExactNumber. These methods allow creation with a given Factor or default to the PureNumber factor. This object encapsulates logic to initialize ExactNumber instances with consistent internal representations and initializes the required values.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def apply(x: Int, factor: Factor): ExactNumber

Creates a new instance of ExactNumber from a given integer value and a specified factor.

Creates a new instance of ExactNumber from a given integer value and a specified factor.

Value parameters

factor

the factor associated with the ExactNumber instance.

x

the integer value to be encapsulated by the ExactNumber.

Attributes

Returns

a new ExactNumber instance with the specified value and factor.

def apply(x: Int): ExactNumber

Creates an instance of ExactNumber with the value x and a default factor of PureNumber.

Creates an instance of ExactNumber with the value x and a default factor of PureNumber.

Value parameters

x

an integer representing the value of the ExactNumber.

Attributes

Returns

an instance of ExactNumber with the specified value and the PureNumber factor.

def log(x: ExactNumber, b: ExactNumber): Option[Number]

Calculates the logarithm of a given ExactNumber x with base b. The method searches for an integer value i in the range -10 to 10 such that raising b to the power of i equals x. If such an i is found, it is returned wrapped in an Option as a Number. Otherwise, returns None.

Calculates the logarithm of a given ExactNumber x with base b. The method searches for an integer value i in the range -10 to 10 such that raising b to the power of i equals x. If such an i is found, it is returned wrapped in an Option as a Number. Otherwise, returns None.

Value parameters

b

the base of the logarithm.

x

the number for which the logarithm is to be calculated.

Attributes

Returns

an Option containing the logarithm result as a Number if an integer solution exists within the searched range, or None otherwise.