?
Solved

POWER function

Posted on 2001-07-26
8
Medium Priority
?
362 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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 200 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

762 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