pow.asciidoc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. [discrete]
  2. [[esql-pow]]
  3. === `POW`
  4. [.text-center]
  5. image::esql/functions/signature/pow.svg[Embedded,opts=inline]
  6. Returns the value of a base (first argument) raised to the power of an exponent (second argument).
  7. Both arguments must be numeric. The output is always a double. Note that it is still possible to overflow
  8. a double result here; in that case, null will be returned.
  9. [source.merge.styled,esql]
  10. ----
  11. include::{esql-specs}/math.csv-spec[tag=powDI]
  12. ----
  13. [%header.monospaced.styled,format=dsv,separator=|]
  14. |===
  15. include::{esql-specs}/math.csv-spec[tag=powDI-result]
  16. |===
  17. [discrete]
  18. ==== Fractional exponents
  19. The exponent can be a fraction, which is similar to performing a root.
  20. For example, the exponent of `0.5` will give the square root of the base:
  21. [source.merge.styled,esql]
  22. ----
  23. include::{esql-specs}/math.csv-spec[tag=powID-sqrt]
  24. ----
  25. [%header.monospaced.styled,format=dsv,separator=|]
  26. |===
  27. include::{esql-specs}/math.csv-spec[tag=powID-sqrt-result]
  28. |===
  29. [discrete]
  30. ==== Table of supported input and output types
  31. For clarity, the following table describes the output result type for all combinations of numeric input types:
  32. include::types/pow.asciidoc[]