Repository navigation
Closed
flutter/packages
#13022Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to Reproduce
- Create a discrete Slider/RangeSlider with
min:0.0,max:35.0,divisions: 35(or see main.dart) - Build on Windows & run on a Pixel 2 or build on MacOS and run on an iPhone 7.
- Slide any of the thumbs to the 29th position.
- Expect the value to be 29.0, but instead receive 29.000000000000004
This also happens with:
| max/divisions | value |
|---|---|
| 22 | 14.999999999999998 |
| 23 | 12.999999999999998 |
| 25 | 7.000000000000001, 14.000000000000002 |
| ... | |
| 35 | 29.000000000000004 |
| 38 | 21.000000000000004 |
| 39 | 25.000000000000004, 30.999999999999996 |
| ... |
Current workaround is to insert .roundToDouble() methods in all of the onChange* callbacks to clean up the values before passing them out to the consumer.
Thanks for considering!
Logs
Analyzing flutter_range_slider_test...
No issues found! (ran in 1.2s)
[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.18362.327], locale en-US)
• Flutter version 1.7.8+hotfix.4 at C:\Users\deg\Development\flutter
• Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at C:\Users\deg\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.37.1)
• VS Code at C:\Users\deg\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.3.0
[√] Connected device (1 available)
• Pixel 2 • FA79E1A01225 • android-arm64 • Android 9 (API 28)
• No issues found!
Reacted by Tobbyte, apoleo88, point-source, mmazurovsky, Vilius Paliokas, Rydmike and pierre
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Type
Projects
- StatusShow more project fieldsDone

Activity
HansMuller commentedon Aug 30, 2019
CC @clocksmith - maybe we're missing a clamp?
jonans commentedon Apr 23, 2020
Seeing the same problem probably due to floating point error. Any plans on a fix ?
markusaksli-nc commentedon Jul 20, 2020
Reproducible on the latest master
1.21.0-2.0.pre.66.flutter doctor -v
thecalamiity commentedon Aug 24, 2020
You mentioned this issue in your merged PR @guidezpl . Should this be closed?
markusaksli-nc commentedon Aug 24, 2020
That PR was just a fix for #60715. This is still reproducible on
1.22.0-2.0.pre.36.flutter doctor -v
danielgomezrico commentedon Jul 31, 2021
This is still happening on flutter 2.2.0
apoleo88 commentedon Nov 18, 2021
It is, also if you use
and you slide to the last value you will get as value
42.00000000000001that is greater than max and get a bigger Exception:'package:flutter/src/material/slider.dart': Failed assertion: line 166 pos 15: 'value >= min && value <= max': is not true.And it won't render!
21 remaining items
J3Unknown commentedon Nov 1, 2025
is this issue still exist or has been solved?
[material_ui] Fix floating-point rounding errors for discrete Slider …
[material_ui] Fix floating-point rounding errors for discrete Slider …
[material_ui] Fix floating-point rounding errors for discrete Slider …
github-actions commentedon Oct 12, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.