# NonreducedFraction¶

class `mathtools.``NonreducedFraction`

Nonereduced fraction.

```>>> import abjad
```

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
```

## Attribute summary¶

 `conjugate` Conjugate is a no-op for Reals. `denominator` Denominator of nonreduced fraction. `from_decimal` Converts a finite Decimal instance to a rational number, exactly. `from_float` Converts a finite float to a rational number, exactly. `imag` Nonreduced fractions have no imaginary part. `limit_denominator` Closest Fraction to self with denominator at most max_denominator. `multiply_with_cross_cancelation`(multiplier) Multiplies nonreduced fraction by argument with cross-cancelation. `multiply_with_numerator_preservation`(multiplier) Multiplies nonreduced fraction by multiplier with numerator preservation where possible. `multiply_without_reducing`(argument) 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`(denominator) Returns new nonreduced fraction with integer denominator. `with_multiple_of_denominator`(denominator) Returns new nonreduced fraction with multiple of integer denominator. `__abs__`() Gets absolute value of nonreduced fraction. `__add__`(argument) Adds argument to nonreduced fraction. `__bool__` self != 0 `__ceil__` math.ceil(a) `__complex__` complex(self) == complex(float(self), 0) `__copy__` `__deepcopy__` `__div__`(argument) Divides nonreduced fraction by argument. `__divmod__` divmod(self, other): The pair (self // other, self % other). `__eq__`(argument) Is true when argument equals nonreduced fraction. `__float__` float(self) = self.numerator / self.denominator `__floor__` math.floor(a) `__floordiv__` a // b `__format__`([format_specification]) Formats nonreduced fraction. `__ge__`(argument) Is true when nonreduced fraction is greater than or equal to argument. `__gt__`(argument) Is true when nonreduced fraction is greater than argument. `__hash__`() Hashes nonreduced fraction. `__le__`(argument) Is true when nonreduced fraction is less than or equal to argument. `__lt__`(argument) Is true when nonreduced fraction is less than argument. `__mod__` a % b `__mul__`(argument) Multiplies nonreduced fraction by argument. `__ne__`(argument) Is true when Abjad object does not equal argument. `__neg__`() Negates nonreduced fraction. `__new__`(class_, *arguments) `__pos__` +a: Coerces a subclass instance to Fraction `__pow__`(argument) Raises nonreduced fraction to argument. `__radd__`(argument) Adds nonreduced fraction to argument. `__rdiv__`(argument) Divides argument by nonreduced fraction. `__rdivmod__` Return divmod(value, self). `__repr__`() Gets interpreter representation of nonreduced fraction. `__rfloordiv__` Return value//self. `__rmod__` Return value%self. `__rmul__`(argument) Multiplies argument by nonreduced fraction. `__round__` round(self, ndigits) `__rpow__` Return pow(value, self, mod). `__rsub__`(argument) Subtracts nonreduced fraction from argument. `__rtruediv__`(argument) Divides argument by nonreduced fraction. `__str__`() Gets string representation of nonreduced fraction. `__sub__`(argument) Subtracts argument from nonreduced fraction. `__truediv__`(argument) Divides nonreduced fraction in Python 3. `__trunc__` trunc(a)

`NonreducedFraction.``denominator`

Denominator of nonreduced fraction.

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

Returns positive integer.

`NonreducedFraction.``imag`

Nonreduced fractions have no imaginary part.

```>>> fraction.imag
0
```

Returns zero.

`NonreducedFraction.``numerator`

Numerator of nonreduced fraction.

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

Returns integer.

`NonreducedFraction.``pair`

Read only pair of nonreduced fraction numerator and denominator.

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

Returns integer pair.

`NonreducedFraction.``real`

Nonreduced fractions are their own real component.

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

Returns nonreduced fraction.

## Methods¶

`(Fraction).``conjugate`()

Conjugate is a no-op for Reals.

`(Fraction).``from_decimal`()

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

`(Fraction).``from_float`()

Converts a finite float to a rational number, exactly.

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

`(Fraction).``limit_denominator`()

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)
```
`NonreducedFraction.``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.

`NonreducedFraction.``multiply_with_numerator_preservation`(multiplier)

Multiplies nonreduced fraction by multiplier with numerator preservation where possible.

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

Returns nonreduced fraction.

`NonreducedFraction.``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.

`NonreducedFraction.``reduce`()

Reduces nonreduced fraction.

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

Returns fraction.

`NonreducedFraction.``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):
...     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):
...     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):
...     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.

`NonreducedFraction.``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.

## Special methods¶

`NonreducedFraction.``__abs__`()

Gets absolute value of nonreduced fraction.

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

Returns nonreduced fraction.

`NonreducedFraction.``__add__`(argument)

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

Returns nonreduced fraction.

`(Fraction).``__bool__`()

self != 0

`(Fraction).``__ceil__`()

math.ceil(a)

`(Fraction).``__complex__`()

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

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

Divides nonreduced fraction by argument.

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

Returns nonreduced fraction.

`(Fraction).``__divmod__`()

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

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

`NonreducedFraction.``__eq__`(argument)

Is true when argument equals nonreduced fraction.

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

Returns true or false.

`(Fraction).``__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__`()

math.floor(a)

`(Fraction).``__floordiv__`()

a // b

`NonreducedFraction.``__format__`(format_specification='')

Formats nonreduced fraction.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

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

Returns string.

`NonreducedFraction.``__ge__`(argument)

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

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

Returns true or false.

`NonreducedFraction.``__gt__`(argument)

Is true when nonreduced fraction is greater than argument.

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

Returns true or false.

`NonreducedFraction.``__hash__`()

Hashes nonreduced fraction.

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

Returns integer.

`NonreducedFraction.``__le__`(argument)

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

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

Returns true or false.

`NonreducedFraction.``__lt__`(argument)

Is true when nonreduced fraction is less than argument.

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

Returns true or false.

`(Fraction).``__mod__`()

a % b

`NonreducedFraction.``__mul__`(argument)

Multiplies nonreduced fraction by argument.

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

Returns nonreduced fraction.

`(AbjadObject).``__ne__`(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

`NonreducedFraction.``__neg__`()

Negates nonreduced fraction.

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

Returns nonreduced fraction.

static `NonreducedFraction.``__new__`(class_, *arguments)
`(Fraction).``__pos__`()

+a: Coerces a subclass instance to Fraction

`NonreducedFraction.``__pow__`(argument)

Raises nonreduced fraction to argument.

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

Returns nonreduced fraction.

`NonreducedFraction.``__radd__`(argument)

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

Returns nonreduced fraction.

`NonreducedFraction.``__rdiv__`(argument)

Divides argument by nonreduced fraction.

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

Returns nonreduced fraction.

`(Fraction).``__rdivmod__`()

Return divmod(value, self).

`NonreducedFraction.``__repr__`()

Gets interpreter representation of nonreduced fraction.

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

Returns string.

`(Fraction).``__rfloordiv__`()

Return value//self.

`(Fraction).``__rmod__`()

Return value%self.

`NonreducedFraction.``__rmul__`(argument)

Multiplies argument by nonreduced fraction.

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

Returns nonreduced fraction.

`(Fraction).``__round__`()

round(self, ndigits)

Rounds half toward even.

`(Fraction).``__rpow__`()

Return pow(value, self, mod).

`NonreducedFraction.``__rsub__`(argument)

Subtracts nonreduced fraction from argument.

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

Returns nonreduced fraction.

`NonreducedFraction.``__rtruediv__`(argument)

Divides argument by nonreduced fraction.

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

Returns nonreduced fraction.

`NonreducedFraction.``__str__`()

Gets string representation of nonreduced fraction.

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

Returns string.

`NonreducedFraction.``__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.

`NonreducedFraction.``__truediv__`(argument)

Divides nonreduced fraction in Python 3.

Returns nonreduced fraction.

`(Fraction).``__trunc__`()

trunc(a)