New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid return type for functions with INT128 /Numeric(38)/ argument [CORE6344] #6585
Comments
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: @asfernandes Because this change will make existing code (not updated with any direct usage of the new types) use them, I think it requires a compatibility option for client libraries not supporting the new types returned. |
Commented by: @AlexPeshkoff It exists in B2, DataTypeCompatibility in firebird.conf |
Commented by: @pavel-zotov SQL> set heading off;
But: -- shows: PS All fine for values up to 2^32 and even more: SQL> select cos(2147483648) from rdb$database;
SQL> select cos(2147499999) from rdb$database;
SQL> select cos(4294967296) from rdb$database;
SQL> select cos(5000000000) from rdb$database;
|
Commented by: @pavel-zotov 1) select round(170141183460469231731687303715884105727,0) from rdb$database; Second statement issues:Statement failed, SQLSTATE = 22003
|
Modified by: @pavel-zotovstatus: Open [ 1 ] => Open [ 1 ] QA Status: No test => Covered by another test(s) Test Details: See: functional\datatypes\int128-math-functions.fbt NOTE: currently (06-jul-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details. |
Modified by: @pavel-zotovstatus: Open [ 1 ] => Open [ 1 ] Test Details: See: functional\datatypes\int128-math-functions.fbt NOTE: currently (06-jul-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details. => See: NOTE: currently (06-jul-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details. |
Modified by: @pavel-zotovstatus: Open [ 1 ] => Open [ 1 ] Test Details: See: NOTE: currently (06-jul-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details. => See: NOTE-1: currently (06-jun-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details. NOTE-2: |
Commented by: @AlexPeshkoff A cos() function always converts it's argument to double precision - therefore it's OK as long as argument's precision does not overflow double's precision. With values larger than it cos() as implemented in firebird becomes a kind of random generator, which is bad, but absolutely not related with this ticket. |
Commented by: @pavel-zotov > A cos() function always converts it's argument to double precision - therefore it's OK as long as argument's precision does not overflow double's precision COS() is periodical function, its full period 2*pi(). Using DECFLOAT34 datatype it is easy to get values for such numbers as 2^63 by emulating MOD() and substitute literal value for PI (first 39 digits) instead of call FB math function PI(). set sqlda_display on; select Output:SOURCE_ANGLE_IN_RADIANS 9223372036854775807 PS. 0xFF. |
Commented by: @AlexPeshkoff I slightly remember school trigonometry :) 0xff. MOD is also not supported for double precision, can you explain what means mod for *floating point* values? |
Modified by: @AlexPeshkoffstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 RC 1 [ 10930 ] |
Submitted by: @AlexPeshkoff
Some builtin functions, using int128 argument, should return same type value (CEIL, FLOOR). Others (like SQRT, LOG, EXP) should return decfloat(34) and use it for internal calculations. Currently all of them return and use internally double precision.
Commits: fd9600f 17b287f 57551c3 3192818 b728ff3 22d9194 3e8d810 FirebirdSQL/fbt-repository@2f69435
====== Test Details ======
See:
functional\datatypes\int128-math-functions.fbt
functional\datatypes\int128-agregate-functions.fbt
NOTE-1: currently (06-jun-2020) there are several issues related to TRUNC() and ROUND() results. See .fbt for details.
Test can be adjusted later after additional fixes.
NOTE-2:
Test for windowed functions deferred, see CORE6357
The text was updated successfully, but these errors were encountered: