erp5_web_renderjs_ui: try to get a more precise float value on all platforms
Mathematically, 1/(x^y) is the same as x^-y, and despite float caculation the results is usually precise enough : > Math.pow(10, -5) 0.00001 I tested this on few platforms : firefox 68.12, firefox 77.0, node v10.19.0 Unfortunately on (recent ?) chromes : > Math.pow(10, -5) 0.000009999999999999999 Which is a horrible value to use as step (and it prevents the form submission as most floats the user will enter won't match the init value * x * the step. For an unknown reason, I get a more consistent result using the formula "1 / Math.pow(10, 5)", which returns 0.00001 on all tested platforms. If we find more issues in the future, we maybe should try building the step using strings. Using strings for manipulating floats is in reality widespread, and many languages do so to round floats (ie: https://github.com/python/cpython/blob/4a97b1517a6b5ff22e2984b677a680b07ff0ce11/Objects/floatobject.c#L925) The precision of 5 is not random-picked, it is the minimum precision needed to manipulate prices for currencies with 2 digits, like euros.
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
passed |
#113898
external
|
ERP5.CodingStyleTest-Master |
01:00:38
|
||||||
passed |
#113924
external
|
ERP5.PerformanceTest-Master |
00:31:01
|
||||||
failed |
#113911
external
|
ERP5.UnitTest-Master |
01:44:01
|
||||||
failed |
#113901
external
|
ERP5.UnitTest-Master.Medusa |
01:51:35
|
||||||
passed |
#113916
external
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:12:54
|
||||||
passed |
#113904
external
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:14:36
|
||||||