Update real to int conversion: -inf is 'b0 not 'b1 like +inf.
The new real to int conversion was incorrectly setting the bits for minus infinity to all ones. This is incorrect in a two's complement encoding where the largest negative number would be a leading 1 followed by an infinite number of zeros.
This commit is contained in:
parent
6d4dd5ae3b
commit
1a41ac3145
|
|
@ -373,9 +373,10 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val)
|
|||
return;
|
||||
}
|
||||
|
||||
/* We return 'b1 for + or - infinity. */
|
||||
/* We return 'b1 for + infinity or 'b0 for - infinity. */
|
||||
if (val && (val == 0.5*val)) {
|
||||
allocate_words_(size, WORD_1_ABITS, WORD_1_BBITS);
|
||||
if (val > 0) allocate_words_(size, WORD_1_ABITS, WORD_1_BBITS);
|
||||
else allocate_words_(size, WORD_0_ABITS, WORD_0_BBITS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue