1. 03 Sep, 2020 1 commit
    • Nicolas Wavrant's avatar
      erp5_web_renderjs_ui: try to get a more precise float value on all platforms · ce233f79
      Nicolas Wavrant authored
      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.
      ce233f79
  2. 02 Sep, 2020 15 commits
  3. 01 Sep, 2020 9 commits
  4. 31 Aug, 2020 8 commits
  5. 27 Aug, 2020 1 commit
  6. 26 Aug, 2020 1 commit
  7. 25 Aug, 2020 3 commits
  8. 24 Aug, 2020 2 commits