Open stephanegigandet opened 4 years ago
Those values are bogus, due to how they store numbers internally. We should remove non significant digits. (and make sure 0.359999990463256 becomes 0.36)
But that's just one app that's sending decimals as floats with low precision (or something like that). Other apps might use slower but more precise data types for these values. Also, the website allows entering arbitrary strings, and that kind of truncation might be unexpected.
Other apps might use slower but more precise data types for these values. Also, the website allows entering arbitrary strings, and that kind of truncation might be unexpected.
Any value with 0000 or 9999 in the decimals in it is not an actual nutrient value that comes from a product label, there is never such a precision in values.
Has this been fixed by #3489? @stephanegigandet
@VaiTon : not yet, I made a function to remove the non-significant digits, but it has not been plugged to the API, and we have not run it against existing products.
This issue has been open 90 days with no activity. Can you give it a little love by linking it to a parent issue, adding relevant labels and projets, creating a mockup if applicable, adding code pointers from https://github.com/openfoodfacts/openfoodfacts-server/blob/main/.github/labeler.yml, giving it a priority, editing the original issue to have a more comprehensive description… Thank you very much for your contribution to 🍊 Open Food Facts
Yuka seems now to pass floating point values with non significant digits.
e.g. https://fr.openfoodfacts.org/api/v0/produit/2227153013512/terrine-de-campagne
carbohydrates: 2.9000000953674, sugars: 1.6000000238419,
https://fr.openfoodfacts.org/api/v0/produit/8001420001624/riso-arborio-gallo-1-kg
saturated-fat: 0.89999997615814, sodium_100g: 0.359999990463256, sugars_value: 2.5999999046326,
Those values are bogus, due to how they store numbers internally. We should remove non significant digits. (and make sure 0.359999990463256 becomes 0.36)
We also need to fix existing products with that kind of values.