www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12958] New: core.checkedint.mulu is broken


          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 puremagic.com
          Reporter: code 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).


Jun 20 2014