[Issue 12958] New: core.checkedint.mulu is broken
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 20 04:45:30 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12958
Issue ID: 12958
Summary: core.checkedint.mulu is broken
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: code at klickverbot.at
The current [1] version of core.checkedint.mulu is broken. For example, 2^(n/2)
* 2^(n/2), where n is the bit width of the integer result, will produce r = 0,
but no overflow will be detected.
For the ulong case, I think that short of using floating point or trial
division for verification, the best implementation might be to split up the
numbers into 32 bit parts and perform the combining step manually (and checking
for overflow there).
[1]
https://github.com/D-Programming-Language/druntime/blob/12a0deafe2b1a573b489bce1719971fae0b219ff/src/core/checkedint.d#L445
--
More information about the Digitalmars-d-bugs
mailing list