Solved

POWER function

Posted on 2001-07-26
8
356 Views
Last Modified: 2007-12-19
I am trying to execute the following and I'm receiving an error:

SELECT POWER(-192427.50013516, -.33333 )

The error is "A domain error occurred"

Anybody know a way around this? I know that usually when you get this error, it means that the arguments are outside the valid range, but, I can't find what the valid range might be.
0
Comment
Question by:songstre
  • 4
  • 4
8 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 6321784
Domain errors occur when the value provided in the mathematical function is not a valid value.

SET ARITHIGNORE ON, which causes no warning message to be displayed. Both the SET ARITHABORT and SET ANSI_WARNINGS settings override the SET ARITHIGNORE setting.
0
 
LVL 1

Author Comment

by:songstre
ID: 6321822
OK, but I still don't get a value. If the values provided are outside the valid values of the function, then what are the valid values of the function? Then I can check them and provide defaults.
0
 
LVL 1

Author Comment

by:songstre
ID: 6321839
OK, but I still don't get a value. If the values provided are outside the valid values of the function, then what are the valid values of the function? Then I can check them and provide defaults.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 6321961
I think that you run into problems when you try to raise a negative number to a negative number less then zero:

power(-1, -.1)

You could check to make sure that the second number is not less than zero when the first number is negative. Or you could just treat these errors as zero's. I'm not sure if your application permits this or not.

SET ARITHIGNORE ON

select isnull(power(-.1, .1), 0)
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 1

Author Comment

by:songstre
ID: 6322029
I tried using isnull. It's not returning null. There's just nothing. Also, power(-1, .1) doesn't work either and the second arg is not negative.
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 6322506
Sorry for the typo... So this doesn't print zero?

SET ARITHIGNORE ON

select isnull(power(-.1, -.1), 0)

Is that what you are saying? I'm running SQL 7 here --- what are you using?

0
 
LVL 1

Author Comment

by:songstre
ID: 6322610
SQL 2000

select isnull(power(-.1, -.1), 0)

gives me nothing, not 0.

And I found out that it is not mathematically possible. If you do the above calculation in Calculator, you get 'Invalid Input for function.'

I'll give you the points for trying, though.
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 50 total points
ID: 6322829
>>And I found out that it is not mathematically possible.
>>If you do the above calculation in Calculator, uyou >>get 'Invalid Input for function.'

I believe my first message stated this fact...

"Domain errors occur when the value provided in the mathematical function is not a valid value."

That's odd that SQL doesn't print anything. Well thanks :)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now