Skip to content

Conversation

@TreeHunter9
Copy link
Contributor

The value I128_MIN_dbl was not represented precisely, as it didn't utilize all 16 decimal digits (52 bits of mantissa) available in a double-precision number. As a result, the value was rounded down to the closest representable number in the double format.

This inaccuracy led to an error in the following query:

SELECT CAST(-POWER(2, 127) AS INT128) FROM RDB$DATABASE;
=======================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

@dyemanov dyemanov requested a review from AlexPeshkoff June 27, 2025 13:48
static const double I128_MAX_dbl = 1.7014118346046921e+38;
static const CDecimal128 I128_MIN_dcft("-1.701411834604692317316873037158841E+38", decSt);
static const CDecimal128 I128_MAX_dcft("1.701411834604692317316873037158841E+38", decSt);
static const CDecimal128 I128_MAX_dcft( "1.701411834604692317316873037158841E+38", decSt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why whitespace?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To look in line with I128_MIN_dcft, like it's done with I128_MIN_dbl and I128_MAX_dbl

@AlexPeshkoff AlexPeshkoff merged commit 253f0f4 into FirebirdSQL:master Jul 1, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants