RepeatingDecimal

com.phasmidsoftware.number.expression.parse.RepeatingDecimal
case class RepeatingDecimal(sign: Boolean, integerPart: String, nonRepeatingPart: Option[String], repeatingPart: String) extends ValuableNumber

Represents a repeating decimal number, including its sign, integer part, non-repeating fractional part (if any), and repeating fractional part.

This class models numbers that can be expressed as decimals with repeating cycles, providing functionality to compute their exact rational representation.

Value parameters

integerPart

The integer portion of the decimal number.

nonRepeatingPart

The non-repeating fractional part of the decimal (optional).

repeatingPart

The repeating fractional part of the decimal.

sign

Specifies the sign of the number (true for positive, false for negative).

Attributes

Constructor

Creates a new instance of the RepeatingDecimal.

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def value: Try[Rational]

Computes the rational value represented by the repeating decimal, including:

Computes the rational value represented by the repeating decimal, including:

  • the integer part,
  • the non-repeating fractional part (if present),
  • the repeating fractional part.

The result is a signed Rational that combines all parts based on the properties of the repeating decimal.

Attributes

Returns

Try containing the computed Rational representation of the repeating decimal, or a failure if any error occurs during computation.

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product