mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 23:00:45 +01:00
[poincare] Integer: add safeguards on infinite Integer
This commit is contained in:
@@ -105,6 +105,10 @@ T NaturalIntegerAbstract::approximate() const {
|
||||
* - the mantissa is the beginning of our BigInt, discarding the first bit
|
||||
*/
|
||||
|
||||
if (isInfinity()) {
|
||||
return INFINITY;
|
||||
}
|
||||
|
||||
native_uint_t lastDigit = digit(m_numberOfDigits-1);
|
||||
uint8_t numberOfBitsInLastDigit = log2(lastDigit);
|
||||
|
||||
@@ -155,6 +159,7 @@ T NaturalIntegerAbstract::approximate() const {
|
||||
// Properties
|
||||
|
||||
int NaturalIntegerAbstract::NumberOfBase10Digits(const NaturalIntegerAbstract * i) {
|
||||
assert(!i->isInfinity());
|
||||
int numberOfDigits = 1;
|
||||
Integer ref(i);
|
||||
Integer base(10);
|
||||
|
||||
Reference in New Issue
Block a user