Convert the infinities to 'bx

This patch modifies the double to vector conversions to return
'bx for either +/- infinity.
This commit is contained in:
Cary R 2008-08-15 11:31:36 -07:00 committed by Stephen Williams
parent 768633e464
commit c032d28aaa
2 changed files with 4 additions and 20 deletions

View File

@ -162,23 +162,14 @@ verinum::verinum(double val, bool dummy)
int exponent;
const unsigned BITS_IN_LONG = 8*sizeof(long);
/* We return `bx for a NaN. */
if (val != val) {
/* We return `bx for a NaN or +/- infinity. */
if (val != val || (val && (val == 0.5*val))) {
nbits_ = 1;
bits_ = new V[nbits_];
bits_[0] = Vx;
return;
}
/* We return 'b1 for + infinity or 'b0 for - infinity. */
if (val && (val == 0.5*val)) {
nbits_ = 1;
bits_ = new V[nbits_];
if (val > 0) bits_[0] = V1;
else bits_[0] = V0;
return;
}
/* Convert to a positive result. */
if (val < 0.0) {
is_neg = true;

View File

@ -372,19 +372,12 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val)
double fraction;
int exponent;
/* We return 'bx for a NaN. */
if (val != val) {
/* We return 'bx for a NaN or +/- infinity. */
if (val != val || (val && (val == 0.5*val))) {
allocate_words_(size, WORD_X_ABITS, WORD_X_BBITS);
return;
}
/* We return 'b1 for + infinity or 'b0 for - infinity. */
if (val && (val == 0.5*val)) {
if (val > 0) allocate_words_(size, WORD_1_ABITS, WORD_1_BBITS);
else allocate_words_(size, WORD_0_ABITS, WORD_0_BBITS);
return;
}
/* Convert to a positive result. */
if (val < 0.0) {
is_neg = true;