SQL Server: Math expression

power

The result is the same data type as the specified numeric expression. Therefore, if the result has three decimal places, the number to raise to a specific power must have three decimals, too.
[sql]
— 10^0.813
select power(10, 0.813) — 6
select power(10.0, 0.813) — 6.5
select power(10.00, 0.813) — 6.50
select power(10.000, 0.813) — 6.501
select power(10.0000, 0.813) — 6.5013
[/sql]

Use exp instead of power

[sql]
— 10^0.813
select exp(0.813 * log(10)) — 6.50129690343091
[/sql]

exp

The EXP function returns the exponential value in scientific notation of the specific float expression. Therefore, with a value of 198.1938327, the EXP function returns a value of 1.18710159597953e+086
[sql]
SELECT EXP(198.1938327); — 1.18710159597953E+86
[/sql]

Be the first to comment

Leave a Reply

Your email address will not be published.


*