Solved

POWER function

Posted on 2001-07-26
8
361 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

719 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