mirror of https://github.com/apache/druid.git
docs: clarify Java precision (#13671)
Co-authored-by: Katya Macedo <38017980+ektravel@users.noreply.github.com> Co-authored-by: Victoria Lim <vtlim@users.noreply.github.com>
This commit is contained in:
parent
cee2dfd768
commit
65a663adbb
|
@ -37,6 +37,13 @@ sidebar_label: "Operators"
|
||||||
|
|
||||||
Operators in [Druid SQL](./sql.md) typically operate on one or two values and return a result based on the values. Types of operators in Druid SQL include arithmetic, comparison, logical, and more, as described here.
|
Operators in [Druid SQL](./sql.md) typically operate on one or two values and return a result based on the values. Types of operators in Druid SQL include arithmetic, comparison, logical, and more, as described here.
|
||||||
|
|
||||||
|
When performing math operations, Druid uses 64-bit integer (long) data type unless there are double or float values. If an operation uses float or double values, then the result is a double, which is a 64-bit float. The precision of float and double values is defined by [Java](https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html) and [the IEEE standard](https://en.wikipedia.org/wiki/IEEE_754).
|
||||||
|
|
||||||
|
Keep the following guidelines in mind to help you manage precision issues:
|
||||||
|
|
||||||
|
- Long values can store up to 2^63 accurately with an additional bit used for the sign.
|
||||||
|
- Float values use 32 bits, and doubles use 64 bits. Both types are impacted by floating point precision. If you need exact decimal values, consider storing the number in a non-decimal format as a long value (up to the limit for longs). For example, if you need three decimal places, store the number multiplied by 1000 and then divide by 1000 when querying.
|
||||||
|
|
||||||
## Arithmetic operators
|
## Arithmetic operators
|
||||||
|
|
||||||
|Operator|Description|
|
|Operator|Description|
|
||||||
|
|
Loading…
Reference in New Issue