Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]RangeSlider does not handle integer precision #9012

Open
harmbuisman opened this issue Jun 18, 2019 · 0 comments · May be fixed by #13551
Open

[BUG]RangeSlider does not handle integer precision #9012

harmbuisman opened this issue Jun 18, 2019 · 0 comments · May be fixed by #13551

Comments

@harmbuisman
Copy link
Contributor

ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

bokeh.version = 1.1.0
python: 3.7.3
OS: Windows 10
browser: all

Description of expected behavior and the observed behavior

The value of slider does not have integer precision when I use step=1

E.g. I get values that are 8.99999999999 instead of expected 9

I understand that float precision may not be the exact integer, but I do see 9 in the UI, so I expect to get 9 or at least 9.0 as the result.

Potentially this needs an argument to set the slider as integer instead of float?

Complete, minimal, self-contained example code that reproduces the issue

# run the following
from bokeh.models.widgets import RangeSlider
from bokeh.layouts import layout
from bokeh.plotting import curdoc

slider = RangeSlider(title="Value",start=0, end=95, step=1, value=(0, 95))

def print_slider(attr, old, new):
    print(attr, old, new)

slider.on_change('value', print_slider)

curdoc().add_root(slider)

Stack traceback and/or browser JavaScript console output

value (0, 95) (1, 95)
value (1, 95) (4, 95)
value (4, 95) (6, 95)
value (6, 95) (7, 95)
value (7, 95) (8, 95)
value (8, 95) (8.999999999999998, 95)
value (8.999999999999998, 95) (9.999999999999998, 95)
value (9.999999999999998, 95) (10.999999999999998, 95)
value (10.999999999999998, 95) (12, 95)

Screenshots or screencasts of the bug in action

bokeh_range_slider_precision

@bryevdv bryevdv added type: bug and removed TRIAGE labels Jun 19, 2019
@bryevdv bryevdv added this to the short-term milestone Jun 19, 2019
@mattpap mattpap linked a pull request Nov 26, 2023 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants