SQL Server/T-SQL/Math Functions/Log10

Материал из SQL эксперт
Перейти к: навигация, поиск

LOG10: returns the base 10 logarithm of this parameter as a float value

45> -- LOG10: returns the base 10 logarithm of this parameter as a float value.
46>
47> SELECT LOG10(5.67)
48> GO
------------------------
     0.75358305889290655
(1 rows affected)



Use Log10

12>
13> SET NOCOUNT ON
14> DECLARE @float1 float
15> SET @float1 = CAST(POWER(10,9) as float)
16> SELECT @float1 * @float1 * @float1 * @float1 * 100 AS "Large Float value",
17>     FLOOR(LOG10(@float1 * @float1 * @float1 * @float1 * 100)
18>     + 1) AS "Number of digits"
19> GO
Large Float value        Number of digits
------------------------ ------------------------
  9.9999999999999998E+37                       39
1>
2>