1
0

pow.asciidoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. *Supported types*
  17. include::types/pow.asciidoc[]
  18. *Examples*
  19. [source.merge.styled,esql]
  20. ----
  21. include::{esql-specs}/math.csv-spec[tag=powDI]
  22. ----
  23. [%header.monospaced.styled,format=dsv,separator=|]
  24. |===
  25. include::{esql-specs}/math.csv-spec[tag=powDI-result]
  26. |===
  27. The exponent can be a fraction, which is similar to performing a root.
  28. For example, the exponent of `0.5` will give the square root of the base:
  29. [source.merge.styled,esql]
  30. ----
  31. include::{esql-specs}/math.csv-spec[tag=powID-sqrt]
  32. ----
  33. [%header.monospaced.styled,format=dsv,separator=|]
  34. |===
  35. include::{esql-specs}/math.csv-spec[tag=powID-sqrt-result]
  36. |===