Feature Request: Double Atomic Ops

Currently, FDB does not support ADD or other atomic ops on double values. A fixed point or IEEE_754 ops like ADD_IEEE_754 could be a good feature to have.

1 Like

One of the advantages of having this feature is to save retries in case of conflicts.

In order to introduce double aggregation in FoundationDb, a fixed point algorithm can be implemented for deterministic and associative results.

Below are a couple of algorithms that can be used to implement Double aggregation

Method 1. Representing a double value as two independent unsigned integers. One representing the integral and other representing the fractional part.

For example :
6.75 → uint64_t integer = 6, uint32_t fraction = 75, a scale factor can be used to determine number of bits out of 32 to be used for the fraction.
Integral and Fractional parts can be summed up individually and combined for the result.

Method 2. This method is an extension of the method above. It involves representing a double value as a collection of N uint64_t. It also overcomes the limitations of Method 1 and works on a wider range of double.

Reference 1: https://sites.usc.edu/cacs/files/2020/12/Small-OrderInvariantSum-IPDPS16.pdf
Reference 2: An Order-invariant Real-to-Integer Conversion Sum | Request PDF