docs.intersystems.com
Home / InterSystems SQL Reference / SQL Functions / LOG10

InterSystems SQL Reference
LOG10
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


A scalar numeric function that returns the base-10 logarithm of a given numeric expression.
Synopsis
{fn LOG10(expression)}
Arguments
expression A numeric expression.
LOG10 returns either the NUMERIC or DOUBLE data type. If expression is data type DOUBLE, LOG10 returns DOUBLE; otherwise, it returns NUMERIC.
Description
LOG10 returns the base-10 logarithm value of expression.LOG10 returns a value with a precision of 21 and a scale of 18.
LOG10 can only be used as an ODBC scalar function (with the curly brace syntax).
Examples
The following example returns the base-10 logarithm of an integer:
SELECT {fn LOG10(5)} AS Log10
returns .69897000433...
The following Embedded SQL example returns the base-10 logarithm values for the integers 1 through 10:
   SET a=1
   WHILE a<11 {
   &sql(SELECT {fn LOG10(:a)} INTO :b)
   IF SQLCODE'=0 {
     WRITE !,"Error code ",SQLCODE 
     QUIT }
   ELSE {
     WRITE !,"Log-10 of ",a," = ",b
     SET a=a+1 }
   }
See Also


Previous section           Next section
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-05-14 07:37:13