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.

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 )

Environment

None

Activity

Cindy LiMarch 6, 2017 at 2:41 PM

The infusion pull request https://github.com/fluid-project/infusion/pull/807 has been merged at 94997916acd56b4073eec50b8e4266c5ddfc9bac

The corresponding infusion-docs pull request https://github.com/fluid-project/infusion-docs/pull/116 has been merged at 03b14860fdfd8286accb3a4d7ca982fda8511642

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created February 7, 2017 at 8:19 PM
Updated March 6, 2017 at 2:41 PM
Resolved March 6, 2017 at 2:41 PM