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 |
|
blindnz
Starting Member
3 Posts |
Posted - 2011-04-07 : 16:41:45
|
| create table ##sc(score numeric)Insert into ##sc (score) Values (200)Insert into ##sc (score) Values (201)Insert into ##sc (score) Values (202)Insert into ##sc (score) Values (203)Insert into ##sc (score) Values (204)Insert into ##sc (score) Values (301)Insert into ##sc (score) Values (302)Select score, CAST(power(0.5,(((score-200)/20)+1)) as float) as PRfrom ##sc where score>181 -- To avoid div/0 and imaginary numbers order by score Select score, power(2,((score-200)/20)+1) as INVPRfrom ##sc where score>181 order by scoreSelect score, ((score-200)/20)+1 as blah from ##sc where score>181order by score--------------------------------------------------------------------So the code above shows my problem. I am trying to calculate the value, as you can see its differentatiated for each score, but as soon as I apply the power function the values become the same for score 200,201,202 ect.. where there 2^1, 2^1.05, 2^1.1 should all yield different INVPR's.I have a feeling for some readon the values are getting truncated to 1 when the power function is applied |
|
|
blindnz
Starting Member
3 Posts |
Posted - 2011-04-07 : 16:48:29
|
| Sorted... the value inside the power determines the precision, so power(0.5000000,.........) would work fine |
 |
|
|
|
|
|
|
|