Float values got cropped

Report a Dgraph Bug

What version of Dgraph are you using?

Dgraph Version

$ dgraph version

Dgraph version : v21.03.0
Dgraph codename : rocket
Dgraph SHA-256 : b4e4c77011e2938e9da197395dbce91d0c6ebb83d383b190f5b70201836a773f
Commit SHA-1 : a77bbe8ae
Commit timestamp : 2021-04-07 21:36:38 +0530
Branch : HEAD
Go version : go1.16.2
jemalloc enabled : true

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

Docker on Windows

Steps to reproduce the issue (command/config used to run Dgraph).

We are trying to save the double-precision float value ‘0.8104214076001297’ to the database using both JSON and RDF mutations. The value will be saved, but queries using Ratel only show six decimal places (regarding this testcase the result shown is ‘0.810421’) and it seems like, that there is rounding happening (tried with ‘0.8104217676001297’ where the result is ‘0.810422’). The predicate type is set to float.

Expected behaviour and actual result.

Dgraph should return the most precise representation of the actual decimal value with regards to the IEEE 754 specification and should not only return 6 decimal places nor apply implicit rounding.