Minor patch.
This commit is contained in:
parent
9f60093b41
commit
a8bf10ea5a
|
@ -75,11 +75,9 @@ decimal parse_decimal(const char *&p) noexcept {
|
|||
++p;
|
||||
}
|
||||
while (is_integer(*p)) {
|
||||
if (answer.num_digits + 1 < max_digits) {
|
||||
if (answer.num_digits < max_digits) {
|
||||
answer.digits[answer.num_digits] = uint8_t(*p - '0');
|
||||
} else {
|
||||
answer.truncated = true;
|
||||
}
|
||||
}
|
||||
answer.num_digits++;
|
||||
++p;
|
||||
}
|
||||
|
@ -95,11 +93,9 @@ decimal parse_decimal(const char *&p) noexcept {
|
|||
}
|
||||
}
|
||||
while (is_integer(*p)) {
|
||||
if (answer.num_digits + 1 < max_digits) {
|
||||
if (answer.num_digits < max_digits) {
|
||||
answer.digits[answer.num_digits] = uint8_t(*p - '0');
|
||||
} else {
|
||||
answer.truncated = true;
|
||||
}
|
||||
}
|
||||
answer.num_digits++;
|
||||
++p;
|
||||
}
|
||||
|
@ -126,6 +122,10 @@ decimal parse_decimal(const char *&p) noexcept {
|
|||
answer.decimal_point += (neg_exp ? -exp_number : exp_number);
|
||||
}
|
||||
answer.decimal_point += answer.num_digits;
|
||||
if(answer.num_digits > max_digits ) {
|
||||
answer.num_digits = max_digits;
|
||||
answer.truncated = true;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace number_tests {
|
|||
bool ground_truth() {
|
||||
std::cout << __func__ << std::endl;
|
||||
std::pair<std::string,double> ground_truth[] = {
|
||||
{"9355950000000000000.00000000000000000000000000000000001844674407370955161600000184467440737095516161844674407370955161407370955161618446744073709551616000184467440737095516166000001844674407370955161618446744073709551614073709551616184467440737095516160001844674407370955161601844674407370955674451616184467440737095516140737095516161844674407370955161600018446744073709551616018446744073709551611616000184467440737095001844674407370955161600184467440737095516160018446744073709551168164467440737095516160001844073709551616018446744073709551616184467440737095516160001844674407536910751601611616000184467440737095001844674407370955161600184467440737095516160018446744073709551616184467440737095516160001844955161618446744073709551616000184467440753691075160018446744073709",0x1.03ae05e8fca1cp+63},
|
||||
{"2.2250738585072013e-308",0x1p-1022},
|
||||
{"-92666518056446206563E3", -0x1.39f764644154dp+76},
|
||||
{"-92666518056446206563E3", -0x1.39f764644154dp+76},
|
||||
|
|
Loading…
Reference in New Issue