log.asciidoc 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. include::types/log.asciidoc[]
  18. *Example*
  19. [source.merge.styled,esql]
  20. ----
  21. include::{esql-specs}/math.csv-spec[tag=log]
  22. ----
  23. [%header.monospaced.styled,format=dsv,separator=|]
  24. |===
  25. include::{esql-specs}/math.csv-spec[tag=log-result]
  26. |===
  27. [source.merge.styled,esql]
  28. ----
  29. include::{esql-specs}/math.csv-spec[tag=logUnary]
  30. ----
  31. [%header.monospaced.styled,format=dsv,separator=|]
  32. |===
  33. include::{esql-specs}/math.csv-spec[tag=logUnary-result]
  34. |===