Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Crotalus
Starting Member
16 Posts |
Posted - 2008-01-09 : 12:44:18
|
I use this formula in access, vb and excel to calculate the antilog of a number, but it doesn't work at all in SQL.10^(Y/10)=ZFor example in access, 10^(22/10) = 158.489319246111in SQL, 10^(22/10) = 8any ideas on how to make it work in SQL?Thanks,Ron |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-01-09 : 12:51:50
|
select power(10.0,(22.0/10.0)) elsasoft.org |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-09 : 12:53:54
|
Try POWER(10.0,(22.0/10.0)) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-10 : 02:08:07
|
This would explain the reasonselect 22/10 as only_integer_part, 22.0/10 as exact_valueand if you used variables then you need to multiply it by 1.0Declare @n1 int, @n2 intselect @n1=22,@n2=10select @n1/@n2 as only_integer_part, @n1*1.0/@n2 as exact_valueMadhivananFailing to plan is Planning to fail |
 |
|
Crotalus
Starting Member
16 Posts |
Posted - 2008-01-10 : 10:03:58
|
Thanks for the replies. I did try that "power" formula once before and it didn't work either. But I did get it to work with this:EXP(Convert(real,Y)/10*LOG(10))I don't know why that works, but it seems that it is very important for "Y" to be a real number.The "power" formula might work as well, once I convert Y to real.Ron |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-01-11 : 01:28:54
|
<<but it seems that it is very important for "Y" to be a real number.>>Yes as I explainedMadhivananFailing to plan is Planning to fail |
 |
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2008-01-12 : 21:38:52
|
The symbol "^" does NOT mean raise to a power in SQL Server... it means XOR--Jeff Moden |
 |
|
|
|
|
|
|