mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
This is what it was before 71afa3e0
. This is the largest power of
ten that fits in an int64.
This commit is contained in:
parent
369b0855ff
commit
6bdaa161eb
@ -42,7 +42,7 @@
|
||||
|
||||
static QofLogModule log_module = "qof";
|
||||
|
||||
static const uint8_t max_leg_digits{17};
|
||||
static const uint8_t max_leg_digits{18};
|
||||
static const int64_t pten[] = { 1, 10, 100, 1000, 10000, 100000, 1000000,
|
||||
10000000, 100000000, 1000000000,
|
||||
INT64_C(10000000000), INT64_C(100000000000),
|
||||
@ -50,7 +50,8 @@ static const int64_t pten[] = { 1, 10, 100, 1000, 10000, 100000, 1000000,
|
||||
INT64_C(100000000000000),
|
||||
INT64_C(1000000000000000),
|
||||
INT64_C(10000000000000000),
|
||||
INT64_C(100000000000000000)};
|
||||
INT64_C(100000000000000000),
|
||||
INT64_C(1000000000000000000)};
|
||||
#define POWTEN_OVERFLOW -5
|
||||
|
||||
int64_t
|
||||
@ -79,7 +80,7 @@ GncNumeric::GncNumeric(GncRational rr)
|
||||
|
||||
GncNumeric::GncNumeric(double d) : m_num(0), m_den(1)
|
||||
{
|
||||
static uint64_t max_leg_value{INT64_C(100000000000000000)};
|
||||
static uint64_t max_leg_value{INT64_C(1000000000000000000)};
|
||||
if (std::isnan(d) || fabs(d) > max_leg_value)
|
||||
{
|
||||
std::ostringstream msg;
|
||||
|
@ -185,12 +185,12 @@ TEST(gncnumeric_constructors, test_string_constructor)
|
||||
GncNumeric neg_decimal_frac_nozero("-.12345");
|
||||
EXPECT_EQ(-12345, neg_decimal_frac_nozero.num());
|
||||
EXPECT_EQ(100000, neg_decimal_frac_nozero.denom());
|
||||
GncNumeric big_denom(".12345678901234567");
|
||||
EXPECT_EQ(12345678901234567, big_denom.num());
|
||||
EXPECT_EQ(100000000000000000, big_denom.denom());
|
||||
GncNumeric too_big_denom(".123456789012345678");
|
||||
EXPECT_EQ(12345678901234567, too_big_denom.num());
|
||||
EXPECT_EQ(100000000000000000, too_big_denom.denom());
|
||||
GncNumeric big_denom(".123456789012345678");
|
||||
EXPECT_EQ(123456789012345678, big_denom.num());
|
||||
EXPECT_EQ(1000000000000000000, big_denom.denom());
|
||||
GncNumeric too_big_denom(".1234567890123456789");
|
||||
EXPECT_EQ(123456789012345678, too_big_denom.num());
|
||||
EXPECT_EQ(1000000000000000000, too_big_denom.denom());
|
||||
}
|
||||
|
||||
TEST(gncnumeric_output, string_output)
|
||||
|
Loading…
Reference in New Issue
Block a user