소스 검색

ESQL: Warn about division (#109716)

When you divide two integers or two longs we round towards 0. Like
Postgres or Java or Rust or C. Other systems, like MySQL or SPL or
Javascript or Python always produce a floating point number. We should
warn folks about this. It's genuinely unexpected for some folks. OTOH,
converting into a floating point number would be unexpected for other
folks. Oh well, let's document what we've got.
Nik Everett 1 년 전
부모
커밋
2aade9dd66
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      docs/reference/esql/functions/binary.asciidoc

+ 3 - 0
docs/reference/esql/functions/binary.asciidoc

@@ -65,6 +65,9 @@ include::types/mul.asciidoc[]
 [.text-center]
 image::esql/functions/signature/div.svg[Embedded,opts=inline]
 
+NOTE: Division of two integer types will yield an integer result, rounding towards 0.
+      If you need floating point division, <<esql-cast-operator>> one of the arguments to a `DOUBLE`.
+
 include::types/div.asciidoc[]
 
 ==== Modulus `%`