Skip to content
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

Built-in function POWER(X, Y) does not work when the X argument is negative and the Y value is scaled numeric but integral [CORE3091] #3470

Closed
firebird-issue-importer opened this issue Jul 31, 2010 · 17 comments

Comments

@firebird-issue-importer

Submitted by: @livius2

Is related to QA280

this work
select power(3, 2) from RDB$DATABASE
select power(-3.0, 2) from RDB$DATABASE
select power(3.0, 2.0) from RDB$DATABASE

but this not work
select power(-3, 2.0) from RDB$DATABASE

SQL message -833
expression evaluation not supported
engine code 335544606

Commits: 94c8d72 b2861fb e664de5

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 31, 2010

Modified by: @livius2

Version: 2.1.3 [ 10302 ]

description: tis work

select power(3, 2) from RDB$DATABASE
select power(-3.0, 2) from RDB$DATABASE
select power(3.0, 2.0) from RDB$DATABASE

but tis not
select power(-3, 2.0) from RDB$DATABASE

=>

tis work

select power(3, 2) from RDB$DATABASE
select power(-3.0, 2) from RDB$DATABASE
select power(3.0, 2.0) from RDB$DATABASE

but this not work
select power(-3, 2.0) from RDB$DATABASE

SQL message -833
expression evaluation not supported
engine code 335544606

environment: Windows XP

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 31, 2010

Modified by: @livius2

summary: Build in function Power not work when x argument i negative and y value is double - "expression evaluation not supported" error => Build in function Power not work when x argument is negative and y value is double - "expression evaluation not supported" error

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 31, 2010

Modified by: @livius2

description: tis work

select power(3, 2) from RDB$DATABASE
select power(-3.0, 2) from RDB$DATABASE
select power(3.0, 2.0) from RDB$DATABASE

but this not work
select power(-3, 2.0) from RDB$DATABASE

SQL message -833
expression evaluation not supported
engine code 335544606

=>

this work
select power(3, 2) from RDB$DATABASE
select power(-3.0, 2) from RDB$DATABASE
select power(3.0, 2.0) from RDB$DATABASE

but this not work
select power(-3, 2.0) from RDB$DATABASE

SQL message -833
expression evaluation not supported
engine code 335544606

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 31, 2010

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 31, 2010

Modified by: @asfernandes

Version: 2.5 RC2 [ 10372 ]

Version: 2.5 RC1 [ 10362 ]

Version: 3.0 Initial [ 10301 ]

Version: 2.5 RC3 [ 10381 ]

summary: Build in function Power not work when x argument is negative and y value is double - "expression evaluation not supported" error => Built-in function POWER(X, Y) does not work when the X argument is negative and the Y value is scaled numeric but integral

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Aug 3, 2010

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.1.4 [ 10361 ]

Fix Version: 2.5.0 [ 10221 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Sep 2, 2010

Modified by: @dyemanov

Fix Version: 2.5.1 [ 10333 ]

Fix Version: 2.5.0 [ 10221 ] =>

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 21, 2010

Commented by: GR (gr)

In 2.1.4.18358 it is still not fixed:

select 'power( 2, 2 )', power( 2, 2 ) from RDB$DATABASE
union all
select 'power(3, 2)', power(3, 2) from RDB$DATABASE
union all
select 'power(-3.0, 2)', power(-3.0, 2) from RDB$DATABASE
union all
select 'power(3.0, 2.0)', power(3.0, 2.0) from RDB$DATABASE
union all
select 'power(-3, 2.0)', power(-3, 2.0) from RDB$DATABASE

returns

power( 2, 2 ) 0
power( 3, 2 ) 0
power(-3.0, 2 ) 0
power(3.0, 2.0) 0
power(-3, 2.0) 9

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 27, 2010

Commented by: @livius2

I confirm this
patch fix problem only with this
select power(-3, 2.0) from RDB$DATABASE

but brake all others

select 'power( 3, 2 )', power( 3, 2 ) from RDB$DATABASE
union all
select 'power( -3, 2 )', power( -3, 2 ) from RDB$DATABASE
union all
select 'power( 3, -2 )', power( 3, -2 ) from RDB$DATABASE
union all
select 'power( -3, -2 )', power( -3, -2 ) from RDB$DATABASE
union all

select 'power( 3, 2.0 )', power( 3, 2.0 ) from RDB$DATABASE
union all
select 'power( 3, -2.0 )', power( 3, -2.0 ) from RDB$DATABASE
union all
select 'power( -3, 2.0 )', power( -3, 2.0 ) from RDB$DATABASE
union all
select 'power( -3, -2.0 )', power( -3, -2.0 ) from RDB$DATABASE
union all
select 'power( -3.0, 2 )', power( -3.0, 2 ) from RDB$DATABASE
union all
select 'power( -3.0, 2.0 )', power( -3.0, 2.0 ) from RDB$DATABASE
union all
select 'power( -3.0, -2.0 )', power( -3.0, -2.0 ) from RDB$DATABASE
union all
select 'power( 3.0, -2.0 )', power( 3.0, -2.0 ) from RDB$DATABASE
union all
select 'power( 3.0, 2.0 )', power( 3.0, 2.0 ) from RDB$DATABASE
union all
select 'power( 3.0, 2 )', power( 3.0, 2 ) from RDB$DATABASE
union all
select 'power( 3.0, -2 )', power( 3.0, -2 ) from RDB$DATABASE

power( 3, 2 ) 0.000000
power( -3, 2 ) 0.000000
power( 3, -2 ) 0.000000
power( -3, -2 ) 0.000000
power( 3, 2.0 ) 0.000000
power( 3, -2.0 ) 0.000000
power( -3, 2.0 ) 9.000000
power( -3, -2.0 ) 0.111111
power( -3.0, 2 ) 0.000000
power( -3.0, 2.0 ) 9.000000
power( -3.0, -2.0 ) 0.111111
power( 3.0, -2.0 ) 0.000000
power( 3.0, 2.0 ) 0.000000
power( 3.0, 2 ) 0.000000
power( 3.0, -2 ) 0.000000

return wrong values as GR show

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 27, 2010

Commented by: @asfernandes

Just works for me. And I see no way my change to alter the result. It was all about exceptions.

SQL> select 'power( 2, 2 )', power( 2, 2 ) from RDB$DATABASE
CON> union all
CON> select 'power(3, 2)', power(3, 2) from RDB$DATABASE
CON> union all
CON> select 'power(-3.0, 2)', power(-3.0, 2) from RDB$DATABASE
CON> union all
CON> select 'power(3.0, 2.0)', power(3.0, 2.0) from RDB$DATABASE
CON> union all
CON> select 'power(-3, 2.0)', power(-3, 2.0) from RDB$DATABASE
CON> ;

=============== =======================
power( 2, 2 ) 4.000000000000000
power(3, 2) 9.000000000000000
power(-3.0, 2) 9.000000000000000
power(3.0, 2.0) 9.000000000000000
power(-3, 2.0) 9.000000000000000

==========================

SQL> select 'power( 3, 2 )', power( 3, 2 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3, 2 )', power( -3, 2 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3, -2 )', power( 3, -2 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3, -2 )', power( -3, -2 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3, 2.0 )', power( 3, 2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3, -2.0 )', power( 3, -2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3, 2.0 )', power( -3, 2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3, -2.0 )', power( -3, -2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3.0, 2 )', power( -3.0, 2 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3.0, 2.0 )', power( -3.0, 2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( -3.0, -2.0 )', power( -3.0, -2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3.0, -2.0 )', power( 3.0, -2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3.0, 2.0 )', power( 3.0, 2.0 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3.0, 2 )', power( 3.0, 2 ) from RDB$DATABASE
CON> union all
CON> select 'power( 3.0, -2 )', power( 3.0, -2 ) from RDB$DATABASE;

=================== =======================
power( 3, 2 ) 9.000000000000000
power( -3, 2 ) 9.000000000000000
power( 3, -2 ) 0.1111111111111111
power( -3, -2 ) 0.1111111111111111
power( 3, 2.0 ) 9.000000000000000
power( 3, -2.0 ) 0.1111111111111111
power( -3, 2.0 ) 9.000000000000000
power( -3, -2.0 ) 0.1111111111111111
power( -3.0, 2 ) 9.000000000000000
power( -3.0, 2.0 ) 9.000000000000000
power( -3.0, -2.0 ) 0.1111111111111111
power( 3.0, -2.0 ) 0.1111111111111111
power( 3.0, 2.0 ) 9.000000000000000
power( 3.0, 2 ) 9.000000000000000
power( 3.0, -2 ) 0.1111111111111111

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 27, 2010

Commented by: Dzirt (dzirt)

In Firebird version 2.1.4.18358? It's impossible...

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 27, 2010

Commented by: @asfernandes

Now I see, I was testing 3.0 and 2.5 only.

It was an error in the 2.1 backport.

I committed a fix and will test later. I'm having problems to build 2.1 in any environments, due to theyr build not supporting new compilers supported in 2.5.

Thanks.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Oct 29, 2010

Commented by: @livius2

I test this under this snapshot 2.1.4.18359 and now all is ok

power( 3, 2 ) 9.000000
power( -3, 2 ) 9.000000
power( 3, -2 ) 0.111111
power( -3, -2 ) 0.111111
power( 3, 2.0 ) 9.000000
power( 3, -2.0 ) 0.111111
power( -3, 2.0 ) 9.000000
power( -3, -2.0 ) 0.111111
power( -3.0, 2 ) 9.000000
power( -3.0, 2.0 ) 9.000000
power( -3.0, -2.0 ) 0.111111
power( 3.0, -2.0 ) 0.111111
power( 3.0, 2.0 ) 9.000000
power( 3.0, 2 ) 9.000000
power( 3.0, -2 ) 0.111111

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 23, 2011

Modified by: @pcisar

Link: This issue is related to QA280 [ QA280 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 3, 2011

Commented by: @pmakowski

Q/A test made

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 3, 2011

Modified by: @pmakowski

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jul 20, 2015

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment