pow.asciidoc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. [discrete]
  2. [[esql-pow]]
  3. === `POW`
  4. *Syntax*
  5. [.text-center]
  6. image::esql/functions/signature/pow.svg[Embedded,opts=inline]
  7. *Parameters*
  8. `base`::
  9. Numeric expression. If `null`, the function returns `null`.
  10. `exponent`::
  11. Numeric expression. If `null`, the function returns `null`.
  12. *Description*
  13. Returns the value of `base` raised to the power of `exponent`. Both arguments
  14. must be numeric. The output is always a double. Note that it is still possible
  15. to overflow a double result here; in that case, null will be returned.
  16. include::types/pow.asciidoc[]
  17. *Examples*
  18. [source.merge.styled,esql]
  19. ----
  20. include::{esql-specs}/math.csv-spec[tag=powDI]
  21. ----
  22. [%header.monospaced.styled,format=dsv,separator=|]
  23. |===
  24. include::{esql-specs}/math.csv-spec[tag=powDI-result]
  25. |===
  26. The exponent can be a fraction, which is similar to performing a root.
  27. For example, the exponent of `0.5` will give the square root of the base:
  28. [source.merge.styled,esql]
  29. ----
  30. include::{esql-specs}/math.csv-spec[tag=powID-sqrt]
  31. ----
  32. [%header.monospaced.styled,format=dsv,separator=|]
  33. |===
  34. include::{esql-specs}/math.csv-spec[tag=powID-sqrt-result]
  35. |===