Skip to content

Commit

Permalink
Another fix in string -> decimal (ydb-platform#11054)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitstn authored Oct 29, 2024
1 parent c3167d3 commit c00aee2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ydb/library/yql/public/decimal/ut/yql_decimal_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ Y_UNIT_TEST_SUITE(TYqlDecimalTest) {
UNIT_ASSERT(IsError(FromStringEx("-infe-5", 35, 15))); // inf with exp
UNIT_ASSERT(IsError(FromStringEx("2.1E0X", 35, 2))); // not fully parsed exp
UNIT_ASSERT(IsError(FromStringEx("2.1E+-1", 35, 2))); // two signs
UNIT_ASSERT(IsError(FromStringEx("ae30", 10, 0))); // bad mantissa
}

Y_UNIT_TEST(TestSpecialAsString) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/library/yql/public/decimal/yql_decimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ TInt128 FromStringEx(const TStringBuf& str, ui8 precision, ui8 scale) {
FromString(str.Head(len), precision, std::min(s, p)):
FromString(str.Head(len), std::min(p - exp, int(MaxPrecision)), std::max(s, 0));

if (IsNan(r)) {
if (IsError(r) || IsNan(r)) {
return Err();
}

Expand Down

0 comments on commit c00aee2

Please sign in to comment.