[Issue 3520] std.numeric.CustomFloat horribly broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 16 20:15:36 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3520



--- Comment #1 from David Simcha <dsimcha at yahoo.com> 2009-11-16 20:15:34 PST ---
Okay, I've gotten a good start on debugging this by pragma'ing the bitfield
code and pasting it in to temporarily get rid of the mixin.  The assert failure
is in setting the exponent:

void exponent(uint v){
    assert(v >= exponent_min);
    assert(v <= exponent_max);  // FAILS
    signfractionexponent = cast(typeof(signfractionexponent))
((signfractionexponent & ~49152U) | ((cast(typeof(signfractionexponent)) v <<
14U) & 49152U));
}


The problem appears to be overflow in the following code in opAssign:

exponent = cast(typeof(exponent_max))
    (value.exponent + (bias - value.bias));

If the result is negative, we get overflow.  Instead, this should probably
result in a denormal or something.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list