Convert the infinities to 'bx
This patch modifies the double to vector conversions to return 'bx for either +/- infinity.
This commit is contained in:
parent
768633e464
commit
c032d28aaa
13
verinum.cc
13
verinum.cc
|
|
@ -162,23 +162,14 @@ verinum::verinum(double val, bool dummy)
|
||||||
int exponent;
|
int exponent;
|
||||||
const unsigned BITS_IN_LONG = 8*sizeof(long);
|
const unsigned BITS_IN_LONG = 8*sizeof(long);
|
||||||
|
|
||||||
/* We return `bx for a NaN. */
|
/* We return `bx for a NaN or +/- infinity. */
|
||||||
if (val != val) {
|
if (val != val || (val && (val == 0.5*val))) {
|
||||||
nbits_ = 1;
|
nbits_ = 1;
|
||||||
bits_ = new V[nbits_];
|
bits_ = new V[nbits_];
|
||||||
bits_[0] = Vx;
|
bits_[0] = Vx;
|
||||||
return;
|
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. */
|
/* Convert to a positive result. */
|
||||||
if (val < 0.0) {
|
if (val < 0.0) {
|
||||||
is_neg = true;
|
is_neg = true;
|
||||||
|
|
|
||||||
|
|
@ -372,19 +372,12 @@ vvp_vector4_t::vvp_vector4_t(unsigned size, double val)
|
||||||
double fraction;
|
double fraction;
|
||||||
int exponent;
|
int exponent;
|
||||||
|
|
||||||
/* We return 'bx for a NaN. */
|
/* We return 'bx for a NaN or +/- infinity. */
|
||||||
if (val != val) {
|
if (val != val || (val && (val == 0.5*val))) {
|
||||||
allocate_words_(size, WORD_X_ABITS, WORD_X_BBITS);
|
allocate_words_(size, WORD_X_ABITS, WORD_X_BBITS);
|
||||||
return;
|
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. */
|
/* Convert to a positive result. */
|
||||||
if (val < 0.0) {
|
if (val < 0.0) {
|
||||||
is_neg = true;
|
is_neg = true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue