[SR-11942] There is no recoverable overflow policy for FixedWidthInteger.dividingFullWidth #54362
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: fecad648170634d3696a4854ab14273b
Issue Description:
The addition and subtraction operators are supplemented by methods that report a single bit of overflow. The multiplication operator has a similar one-bit of overflow method, and has a full-width method that returns the product in two words. That second variant can supplant uses of the first variant. There are one-bit of overflow methods for division and remainder, to supplement the corresponding operators. There is also a full-width version of division, that takes a two-word divisor returns single words quotient and remainder.
The problem is when there is an overflow in the division. This can be caused by using a zero divisor or if the divisor is (absolutely) so small the quotient needs two words instead of one. The documentation says this causes a runtime error. The problem is that there is no alternative. There either needs to be a `dividingFullWidthWithOverflow` method, a variant of that method that returns a double-word quotient, or a documentation note in the current method on how to test for overflow conditions (testing for a zero divisor or a divisor that would need a double-word quotient). A respondent on the initial thread expressed a desire for the third option instead of adding yet another method.
The text was updated successfully, but these errors were encountered: