# NonreducedFraction¶

class `abjad.mathtools.NonreducedFraction.``NonreducedFraction`(*arguments)

Nonreduced fraction.

Initializes with an integer numerator and integer denominator:

```>>> abjad.NonreducedFraction(3, 6)
NonreducedFraction(3, 6)
```

Initializes with only an integer denominator:

```>>> abjad.NonreducedFraction(3)
NonreducedFraction(3, 1)
```

Initializes with an integer pair:

```>>> abjad.NonreducedFraction((3, 6))
NonreducedFraction(3, 6)
```

Initializes with an integer singleton:

```>>> abjad.NonreducedFraction((3,))
NonreducedFraction(3, 1)
```

Nonreduced fractions inherit from built-in fraction:

```>>> isinstance(abjad.NonreducedFraction(3, 6), abjad.Fraction)
True
```

Nonreduced fractions are numbers:

```>>> import numbers
```
```>>> isinstance(abjad.NonreducedFraction(3, 6), numbers.Number)
True
```

Attributes Summary

 `__abs__` Gets absolute value of nonreduced fraction. `__add__` Adds `argument` to nonreduced fraction. `__div__` Divides nonreduced fraction by `argument`. `__eq__` Is true when `argument` equals nonreduced fraction. `__format__` Formats nonreduced fraction. `__ge__` Is true when nonreduced fraction is greater than or equal to `argument`. `__gt__` Is true when nonreduced fraction is greater than `argument`. `__hash__` Hashes nonreduced fraction. `__le__` Is true when nonreduced fraction is less than or equal to `argument`. `__lt__` Is true when nonreduced fraction is less than `argument`. `__mul__` Multiplies nonreduced fraction by `argument`. `__neg__` Negates nonreduced fraction. `__new__` Create and return a new object. `__pow__` Raises nonreduced fraction to `argument`. `__radd__` Adds nonreduced fraction to `argument`. `__rdiv__` Divides `argument` by nonreduced fraction. `__repr__` Gets interpreter representation of nonreduced fraction. `__rmul__` Multiplies `argument` by nonreduced fraction. `__rsub__` Subtracts nonreduced fraction from `argument`. `__rtruediv__` Divides `argument` by nonreduced fraction. `__str__` Gets string representation of nonreduced fraction. `__sub__` Subtracts `argument` from nonreduced fraction. `__truediv__` Divides nonreduced fraction in Python 3. `denominator` Denominator of nonreduced fraction. `imag` Nonreduced fractions have no imaginary part. `multiply` Multiplies nonreduced fraction by `multiplier` with numerator preservation where possible. `multiply_with_cross_cancelation` Multiplies nonreduced fraction by `argument` with cross-cancelation. `multiply_without_reducing` Multiplies nonreduced fraction by `argument` without reducing. `numerator` Numerator of nonreduced fraction. `pair` Read only pair of nonreduced fraction numerator and denominator. `real` Nonreduced fractions are their own real component. `reduce` Reduces nonreduced fraction. `with_denominator` Returns new nonreduced fraction with integer `denominator`. `with_multiple_of_denominator` Returns new nonreduced fraction with multiple of integer `denominator`.

Special methods

`__abs__`()

Gets absolute value of nonreduced fraction.

```>>> abs(abjad.NonreducedFraction(-3, 3))
NonreducedFraction(3, 3)
```

Returns nonreduced fraction.

`__add__`(argument)

Adds `argument` to nonreduced fraction.

```>>> abjad.NonreducedFraction(3, 3) + 1
NonreducedFraction(6, 3)
```
```>>> 1 + abjad.NonreducedFraction(3, 3)
NonreducedFraction(6, 3)
```

Returns nonreduced fraction.

`(Fraction).``__bool__`()

a != 0

`(Fraction).``__ceil__`()

Will be math.ceil(a) in 3.0.

`(Real).``__complex__`()

complex(self) == complex(float(self), 0)

`(Fraction).``__copy__`()
`(Fraction).``__deepcopy__`(memo)
`__div__`(argument)

Divides nonreduced fraction by `argument`.

```>>> abjad.NonreducedFraction(3, 3) / 1
NonreducedFraction(3, 3)
```

Returns nonreduced fraction.

`(Real).``__divmod__`(other)

divmod(self, other): The pair (self // other, self % other).

Sometimes this can be computed faster than the pair of operations.

`__eq__`(argument)

Is true when `argument` equals nonreduced fraction.

```>>> abjad.NonreducedFraction(3, 3) == 1
True
```

Returns true or false.

`(Rational).``__float__`()

float(self) = self.numerator / self.denominator

It’s important that this conversion use the integer’s “true” division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing.

`(Fraction).``__floor__`()

Will be math.floor(a) in 3.0.

`(Fraction).``__floordiv__`(b)

a // b

`__format__`(format_specification='')

Formats nonreduced fraction.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
>>> print(format(fraction))
abjad.NonreducedFraction(-6, 3)
```

Returns string.

`__ge__`(argument)

Is true when nonreduced fraction is greater than or equal to `argument`.

```>>> abjad.NonreducedFraction(3, 3) >= 1
True
```

Returns true or false.

`__gt__`(argument)

Is true when nonreduced fraction is greater than `argument`.

```>>> abjad.NonreducedFraction(3, 3) > 1
False
```

Returns true or false.

`__hash__`()

Hashes nonreduced fraction.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

`__le__`(argument)

Is true when nonreduced fraction is less than or equal to `argument`.

```>>> abjad.NonreducedFraction(3, 3) <= 1
True
```

Returns true or false.

`__lt__`(argument)

Is true when nonreduced fraction is less than `argument`.

```>>> abjad.NonreducedFraction(3, 3) < 1
False
```

Returns true or false.

`(Fraction).``__mod__`(b)

a % b

`__mul__`(argument)

Multiplies nonreduced fraction by `argument`.

```>>> abjad.NonreducedFraction(3, 3) * 3
NonreducedFraction(9, 3)
```

Returns nonreduced fraction.

`__neg__`()

Negates nonreduced fraction.

```>>> -abjad.NonreducedFraction(3, 3)
NonreducedFraction(-3, 3)
```

Returns nonreduced fraction.

static `__new__`(class_, *arguments)

Create and return a new object. See help(type) for accurate signature.

`(Fraction).``__pos__`()

+a: Coerces a subclass instance to Fraction

`__pow__`(argument)

Raises nonreduced fraction to `argument`.

```>>> abjad.NonreducedFraction(3, 6) ** -1
NonreducedFraction(6, 3)
```

Returns nonreduced fraction.

`__radd__`(argument)

Adds nonreduced fraction to `argument`.

```>>> 1 + abjad.NonreducedFraction(3, 3)
NonreducedFraction(6, 3)
```

Returns nonreduced fraction.

`__rdiv__`(argument)

Divides `argument` by nonreduced fraction.

```>>> 1 / abjad.NonreducedFraction(3, 3)
NonreducedFraction(3, 3)
```

Returns nonreduced fraction.

`(Real).``__rdivmod__`(other)

divmod(other, self): The pair (self // other, self % other).

Sometimes this can be computed faster than the pair of operations.

`__repr__`()

Gets interpreter representation of nonreduced fraction.

```>>> abjad.NonreducedFraction(3, 6)
NonreducedFraction(3, 6)
```

Returns string.

`(Fraction).``__rfloordiv__`(a)

a // b

`(Fraction).``__rmod__`(a)

a % b

`__rmul__`(argument)

Multiplies `argument` by nonreduced fraction.

```>>> 3 * abjad.NonreducedFraction(3, 3)
NonreducedFraction(9, 3)
```

Returns nonreduced fraction.

`(Fraction).``__round__`(ndigits=None)

Will be round(self, ndigits) in 3.0.

Rounds half toward even.

`(Fraction).``__rpow__`(a)

a ** b

`__rsub__`(argument)

Subtracts nonreduced fraction from `argument`.

```>>> 1 - abjad.NonreducedFraction(3, 3)
NonreducedFraction(0, 3)
```

Returns nonreduced fraction.

`__rtruediv__`(argument)

Divides `argument` by nonreduced fraction.

```>>> 1 / abjad.NonreducedFraction(3, 3)
NonreducedFraction(3, 3)
```

Returns nonreduced fraction.

`__str__`()

Gets string representation of nonreduced fraction.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> str(fraction)
'-6/3'
```

Returns string.

`__sub__`(argument)

Subtracts `argument` from nonreduced fraction.

```>>> abjad.NonreducedFraction(3, 3) - 2
NonreducedFraction(-3, 3)
```
```>>> abjad.NonreducedFraction(5, 4) - abjad.NonreducedFraction(18, 16)
NonreducedFraction(2, 16)
```
```>>> abjad.NonreducedFraction(18, 16) - abjad.NonreducedFraction(5, 4)
NonreducedFraction(-2, 16)
```

Returns nonreduced fraction.

`__truediv__`(argument)

Divides nonreduced fraction in Python 3.

Returns nonreduced fraction.

`(Fraction).``__trunc__`()

trunc(a)

Methods

`(Real).``conjugate`()

Conjugate is a no-op for Reals.

`(Fraction).``limit_denominator`(max_denominator=1000000)

Closest Fraction to self with denominator at most max_denominator.

```>>> Fraction('3.141592653589793').limit_denominator(10)
Fraction(22, 7)
>>> Fraction('3.141592653589793').limit_denominator(100)
Fraction(311, 99)
>>> Fraction(4321, 8765).limit_denominator(10000)
Fraction(4321, 8765)
```
`multiply`(multiplier, preserve_numerator=False)

Multiplies nonreduced fraction by `multiplier` with numerator preservation where possible.

```>>> fraction = abjad.NonreducedFraction(9, 16)
```
```>>> fraction.multiply((2, 3), preserve_numerator=True)
NonreducedFraction(9, 24)
```
```>>> fraction.multiply((1, 2), preserve_numerator=True)
NonreducedFraction(9, 32)
```
```>>> fraction.multiply((5, 6), preserve_numerator=True)
NonreducedFraction(45, 96)
```
```>>> fraction = abjad.NonreducedFraction(3, 8)
```
```>>> fraction.multiply((2, 3), preserve_numerator=True)
NonreducedFraction(3, 12)
```

Returns nonreduced fraction.

`multiply_with_cross_cancelation`(multiplier)

Multiplies nonreduced fraction by `argument` with cross-cancelation.

```>>> fraction = abjad.NonreducedFraction(4, 8)
```
```>>> fraction.multiply_with_cross_cancelation((2, 3))
NonreducedFraction(4, 12)
```
```>>> fraction.multiply_with_cross_cancelation((4, 1))
NonreducedFraction(4, 2)
```
```>>> fraction.multiply_with_cross_cancelation((3, 5))
NonreducedFraction(12, 40)
```
```>>> fraction.multiply_with_cross_cancelation((6, 5))
NonreducedFraction(12, 20)
```
```>>> fraction = abjad.NonreducedFraction(5, 6)
>>> fraction.multiply_with_cross_cancelation((6, 5))
NonreducedFraction(1, 1)
```

Returns nonreduced fraction.

`multiply_without_reducing`(argument)

Multiplies nonreduced fraction by `argument` without reducing.

```>>> fraction = abjad.NonreducedFraction(3, 8)
```
```>>> fraction.multiply_without_reducing((3, 3))
NonreducedFraction(9, 24)
```
```>>> fraction = abjad.NonreducedFraction(4, 8)
```
```>>> fraction.multiply_without_reducing((4, 5))
NonreducedFraction(16, 40)
```
```>>> fraction.multiply_without_reducing((3, 4))
NonreducedFraction(12, 32)
```

Returns nonreduced fraction.

`reduce`()

Reduces nonreduced fraction.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.reduce()
Fraction(-2, 1)
```

Returns fraction.

`with_denominator`(denominator)

Returns new nonreduced fraction with integer `denominator`.

```>>> abjad.NonreducedFraction(3, 6).with_denominator(12)
NonreducedFraction(6, 12)
```
```>>> for numerator in range(12):
...     fraction = abjad.NonreducedFraction(numerator, 6)
...     print(fraction, fraction.with_denominator(12))
...
0/6 0/12
1/6 2/12
2/6 4/12
3/6 6/12
4/6 8/12
5/6 10/12
6/6 12/12
7/6 14/12
8/6 16/12
9/6 18/12
10/6 20/12
11/6 22/12
```
```>>> for numerator in range(12):
...     fraction = abjad.NonreducedFraction(numerator, 6)
...     print(fraction, fraction.with_denominator(8))
...
0/6 0/8
1/6 1/6
2/6 2/6
3/6 4/8
4/6 4/6
5/6 5/6
6/6 8/8
7/6 7/6
8/6 8/6
9/6 12/8
10/6 10/6
11/6 11/6
```
```>>> for numerator in range(12):
...     fraction = abjad.NonreducedFraction(numerator, 6)
...     print(fraction, fraction.with_denominator(12))
...
0/6 0/12
1/6 2/12
2/6 4/12
3/6 6/12
4/6 8/12
5/6 10/12
6/6 12/12
7/6 14/12
8/6 16/12
9/6 18/12
10/6 20/12
11/6 22/12
```

Returns nonreduced fraction.

`with_multiple_of_denominator`(denominator)

Returns new nonreduced fraction with multiple of integer `denominator`.

```>>> fraction = abjad.NonreducedFraction(3, 6)
```
```>>> fraction.with_multiple_of_denominator(5)
NonreducedFraction(5, 10)
```
```>>> abjad.NonreducedFraction(1, 2).with_multiple_of_denominator(2)
NonreducedFraction(1, 2)
```
```>>> abjad.NonreducedFraction(1, 2).with_multiple_of_denominator(4)
NonreducedFraction(2, 4)
```
```>>> abjad.NonreducedFraction(1, 2).with_multiple_of_denominator(8)
NonreducedFraction(4, 8)
```
```>>> abjad.NonreducedFraction(1, 2).with_multiple_of_denominator(16)
NonreducedFraction(8, 16)
```

Returns nonreduced fraction.

Class & static methods

classmethod `(Fraction).``from_decimal`(dec)

Converts a finite Decimal instance to a rational number, exactly.

classmethod `(Fraction).``from_float`(f)

Converts a finite float to a rational number, exactly.

Beware that Fraction.from_float(0.3) != Fraction(3, 10).

Read-only properties

`denominator`

Denominator of nonreduced fraction.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.denominator
3
```

Returns positive integer.

`imag`

Nonreduced fractions have no imaginary part.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.imag
0
```

Returns zero.

`numerator`

Numerator of nonreduced fraction.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.numerator
-6
```

Returns integer.

`pair`

Read only pair of nonreduced fraction numerator and denominator.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.pair
(-6, 3)
```

Returns integer pair.

`real`

Nonreduced fractions are their own real component.

```>>> fraction = abjad.NonreducedFraction(-6, 3)
```
```>>> fraction.real
NonreducedFraction(-6, 3)
```

Returns nonreduced fraction.