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
{{ message }}
Repository navigation
Commit 6a0eecd
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CLAUDE.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,8 @@ dotnet run -c Release --project PreciseNumber.Benchmarks -- --filter '*' --job s
33
33
### Key Design Patterns
34
34
35
35
- Factory methods `CreateFromInteger<T>()` and `CreateFromFloatingPoint<T>()` handle type-specific conversion logic
36
-
- Arithmetic operations use `MakeCommonized()` to align exponents before calculation
36
+
- Addition, subtraction and modulus align exponents before calculating; multiplication and division work on the significands directly
37
+
-`Divide` is exact when the quotient terminates, and otherwise rounds to a precision that never falls below the wider operand or `MinimumDivisionPrecision`. `Exp` and non-integer `Pow` still route through `double`
37
38
- The `sanitize` constructor parameter controls whether trailing zeros are removed (default: true)
Copy file name to clipboardExpand all lines: README.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,9 +351,17 @@ You can control precision using:
351
351
352
352
-**ReduceSignificance()**: Reduces to a specific number of significant digits
353
353
354
+
-**Divide(left, right, significantDigits)**: Chooses the precision of a quotient
355
+
356
+
Division produces a terminating quotient exactly, however many digits that takes — `1 / 8` is
357
+
`0.125`, and `1 / 2^64` keeps all 64 decimal places. A repeating quotient is produced to the
358
+
precision of the wider operand, never fewer than `MinimumDivisionPrecision` (50) significant
359
+
digits, with the last digit rounded half away from zero. Pass an explicit precision to the
360
+
three-argument overload when you want something other than that.
361
+
354
362
## Limitations
355
363
356
-
-Operations that inherently require approximation (like certain roots or logarithms) fall back to`double` precision for calculation
364
+
-`Exp()`, and `Pow()` with a non-integer power, are computed through`double`and are therefore limited to its precision. Addition, subtraction, multiplication and division are not
357
365
358
366
- Conversion to standard types may throw `OverflowException` if the value is too large
0 commit comments