mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Issue number: Resolves #21968 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When using fractional values for `min`, `max`, or `step`, it is possible for floating point rounding errors to cause unexpected values to be emitted. For example, `step="0.05" min="0.1" max="1"` emits a value of `0.150000000004` after moving one step. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> Values are rounded to the max number of decimal places between the three props. Note that it isn't mathematically possible to arrive at a value with more decimal places than the props*, since addition (i.e. starting at `min` and adding multiples of `step`) can't increase the precision of a number. \* Unless the `value` is set manually, but in that case, `ion-range` currently snaps to a multiple of `step` as soon as the slider is moved, resuming normal behavior. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->