You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type conversions to integers or decimal types without support for _NaN_ or _Infinity_ now throw an OverflowException instead of a DivideByZeroException.
Copy file name to clipboardExpand all lines: BreakingChanges.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ This file contains a summary of the most important breaking changes, sorted by v
9
9
### 9.0.0
10
10
11
11
- When using the .NET8 assembly, the data type implements the two interfaces `INumber<Fraction>` and `ISignedNumber<Fraction>` with the corresponding support but also possible side effects when using the generic [math functions](https://learn.microsoft.com/en-us/dotnet/standard/generics/math). For more information, see this [Microsoft blog article](https://devblogs.microsoft.com/dotnet/dotnet-7-generic-math/).
12
+
- Type conversions to integers or decimal types without support for _NaN_ or _Infinity_ now throw an `OverflowException` instead of a `DivideByZeroException`.
Copy file name to clipboardExpand all lines: Changelog.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,12 @@
5
5
- PR [Implemented the INumber<Fraction> interface](https://github.com/Fractions-DotNet/Fractions/pull/96) by [lipchev](https://github.com/lipchev)
6
6
- PR [More DecimalQuantityFormatter performance optimizations](https://github.com/Fractions-DotNet/Fractions/pull/115) by [lipchev](https://github.com/lipchev)
7
7
- Replaced [FluentAssertions](https://xceed.com/products/unit-testing/fluent-assertions/) with [AwesomeAssertions](https://awesomeassertions.org/)
8
+
- Type conversions to integers or decimal types without support for _NaN_ or _Infinity_ now throw an `OverflowException` instead of a `DivideByZeroException`.
8
9
9
10
### Breaking changes
10
11
11
12
- When using the .NET8 assembly, the data type implements the two interfaces `INumber<Fraction>` and `ISignedNumber<Fraction>` with the corresponding support but also possible side effects when using the generic [math functions](https://learn.microsoft.com/en-us/dotnet/standard/generics/math). For more information, see this [Microsoft blog article](https://devblogs.microsoft.com/dotnet/dotnet-7-generic-math/).
13
+
- Type conversions to integers or decimal types without support for _NaN_ or _Infinity_ now throw an `OverflowException` instead of a `DivideByZeroException`.
12
14
13
15
## 8.3.2
14
16
- PR [Optimizing the PowerOfTen function for exponents in the range 18-54](https://github.com/danm-de/Fractions/pull/110) by [lipchev](https://github.com/lipchev)
Copy file name to clipboardExpand all lines: src/Fractions/Fraction.ConvertTo.cs
+14-13Lines changed: 14 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
usingSystem;
2
2
usingSystem.Numerics;
3
+
usingFractions.Properties;
3
4
4
5
namespaceFractions;
5
6
@@ -13,9 +14,8 @@ public readonly partial struct Fraction {
13
14
/// Converts the fraction to a 32-bit signed integer.
14
15
/// </summary>
15
16
/// <returns>The result of the integer division of the numerator by the denominator.</returns>
16
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
17
17
/// <exception cref="OverflowException">
18
-
/// Thrown when the result of the division is outside the range of a 32-bit signed integer.
18
+
/// Thrown when the result of the division is outside the range of a 32-bit signed integer or when the denominator is zero, meaning the value is NaN or infinity.
19
19
/// </exception>
20
20
publicintToInt32(){
21
21
return(int)ToBigInteger();
@@ -25,9 +25,8 @@ public int ToInt32() {
25
25
/// Converts the fraction to a 64-bit signed integer.
26
26
/// </summary>
27
27
/// <returns>The result of the integer division of the numerator by the denominator.</returns>
28
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
29
28
/// <exception cref="OverflowException">
30
-
/// Thrown when the result of the division is outside the range of a 64-bit signed integer.
29
+
/// Thrown when the result of the division is outside the range of a 64-bit signed integer or when the denominator is zero, meaning the value is NaN or infinity.
31
30
/// </exception>
32
31
publiclongToInt64(){
33
32
return(long)ToBigInteger();
@@ -37,9 +36,8 @@ public long ToInt64() {
37
36
/// Converts the fraction to a 32-bit unsigned integer.
38
37
/// </summary>
39
38
/// <returns>The result of the integer division of the numerator by the denominator.</returns>
40
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
41
39
/// <exception cref="OverflowException">
42
-
/// Thrown when the result of the division is outside the range of a 32-bit unsigned integer.
40
+
/// Thrown when the result of the division is outside the range of a 32-bit unsigned integer or when the denominator is zero, meaning the value is NaN or infinity.
43
41
/// </exception>
44
42
[CLSCompliant(false)]
45
43
publicuintToUInt32(){
@@ -50,9 +48,8 @@ public uint ToUInt32() {
50
48
/// Converts the fraction to a 64-bit unsigned integer.
51
49
/// </summary>
52
50
/// <returns>The result of the integer division of the numerator by the denominator.</returns>
53
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
54
51
/// <exception cref="OverflowException">
55
-
/// Thrown when the result of the division is outside the range of a 64-bit unsigned integer.
52
+
/// Thrown when the result of the division is outside the range of a 64-bit unsigned integer or when the denominator is zero, meaning the value is NaN or infinity.
56
53
/// </exception>
57
54
[CLSCompliant(false)]
58
55
publiculongToUInt64(){
@@ -63,9 +60,14 @@ public ulong ToUInt64() {
63
60
/// Converts the fraction to a BigInteger.
64
61
/// </summary>
65
62
/// <returns>The result of the integer division of the numerator by the denominator.</returns>
66
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
63
+
/// <exception cref="OverflowException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
@@ -76,17 +78,16 @@ public BigInteger ToBigInteger() {
76
78
/// The fraction represented as a decimal. If the number exceeds decimal precision, the extra decimals are lost
77
79
/// due to rounding.
78
80
/// </returns>
79
-
/// <exception cref="DivideByZeroException">Thrown when the denominator is zero - i.e. the value is NaN or Infinity.</exception>
80
81
/// <exception cref="OverflowException">
81
-
/// Thrown when the number represented by this fraction is outside the decimal range.
82
+
/// Thrown when the number represented by this fraction is outside the decimal range or when the denominator is zero, meaning the value is NaN or infinity.
0 commit comments