Real should indicate error in parsing

This commit is contained in:
serso
2016-04-22 21:28:26 +02:00
parent b00e02a693
commit af5bf16182
7 changed files with 56 additions and 43 deletions

View File

@@ -771,8 +771,8 @@ public final class Real {
* &nbsp;&nbsp;&nbsp;&nbsp;base-16: <code>"/FFF800C.CCCE e64"</code>
* <p/>
* <p>The number is parsed until the end of the string or an unknown
* character is encountered, then silently returns even if the whole
* string has not been parsed. Please note that specifying an
* character is encountered. Note that in case of latter this Real becomes
* NAN. Please note that specifying an
* excessive number of digits in base-10 may in fact decrease the
* accuracy of the result because of the extra multiplications performed.
* <p/>
@@ -2243,6 +2243,10 @@ public final class Real {
return (this.sign == 0) ? (mantissa >>> shift) : -(mantissa >>> shift);
}
public double toDouble() {
return Double.longBitsToDouble(toDoubleBits());
}
/**
* Returns <code>true</code> if the value of this <code>Real</code>
* represents a mathematical integer. If the value is too large to
@@ -6184,6 +6188,10 @@ public final class Real {
}
}
sign = tmpSign;
if (index != length) {
// signal error
assign(NAN);
}
}
//*************************************************************************