log.asciidoc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [discrete]
  2. [[esql-log]]
  3. === `LOG`
  4. *Syntax*
  5. [source,esql]
  6. ----
  7. LOG([base,] value)
  8. ----
  9. *Parameters*
  10. `base`::
  11. Numeric expression. If `null`, the function returns `null`. The base is an optional input parameter. If a base is not provided, this function returns the natural logarithm (base e) of a value.
  12. `value`::
  13. Numeric expression. If `null`, the function returns `null`.
  14. *Description*
  15. Returns the logarithm of a value to a base. The input can be any numeric value, the return value is always a double.
  16. Logs of zero, negative numbers, infinites and base of one return `null` as well as a warning.
  17. *Supported types*
  18. include::types/log.asciidoc[]
  19. *Example*
  20. [source.merge.styled,esql]
  21. ----
  22. include::{esql-specs}/math.csv-spec[tag=log]
  23. ----
  24. [%header.monospaced.styled,format=dsv,separator=|]
  25. |===
  26. include::{esql-specs}/math.csv-spec[tag=log-result]
  27. |===
  28. [source.merge.styled,esql]
  29. ----
  30. include::{esql-specs}/math.csv-spec[tag=logUnary]
  31. ----
  32. [%header.monospaced.styled,format=dsv,separator=|]
  33. |===
  34. include::{esql-specs}/math.csv-spec[tag=logUnary-result]
  35. |===