Fixed
Details
Assignee
UnassignedUnassignedReporter
Alex MillerAlex MillerLabels
Approval
OkPatch
Code and TestPriority
MajorAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Alex Miller
Alex MillerLabels
Approval
Ok
Patch
Code and Test
Priority

Affects versions
Fix versions
Created February 2, 2022 at 2:06 AM
Updated June 28, 2023 at 9:57 PM
Resolved June 28, 2023 at 9:57 PM
https://ask.clojure.org/index.php/11521/some-corner-cases-that-might-considered-ratio-implementation
The math operations that construct and manipulate ratios assume that only the sign of the numerator is important. Using Long/MIN_VALUE in the numerator or divisor of a ratio can lead to some violations of this invariant, due to the oddity that (- Long/MIN_VALUE) = Long/MIN_VALUE (as there is no value available value representing that in longs).
Cause: In the special case of a Long/MIN_VALUE, the long ops impl of divide does not properly have any way to represent the ratio value with longs. However, at the end of the impl, the ratio is created with BigIntegers, which can represent it!
Proposed: Detect this case and use the BigIntOps impl instead.
Patch: clj-2694.patch
Screened by: fogus