string - number transformations should allow for specifying decimal precision
Description
Due to floating point precision, if a number includes a decimal point, the rendered output is not always what you'd expect. While implementing the textfield steppers in the prefs framework, 1.2 was being displayed as 1.2000000000000002 instead.
Due to floating point precision, if a number includes a decimal point, the rendered output is not always what you'd expect. While implementing the textfield steppers in the prefs framework, 1.2 was being displayed as 1.2000000000000002 instead.
See channel conversation: https://botbot.me/freenode/fluid-design/2017-02-07/?msg=80593842&page=1
To work around this, the numberToString transformation should take in options to specify how many decimal places to display.
A potential implementation can be seen on stack overflow ( http://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places/12830454#12830454 )