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

slider decimal point #2511

Closed
phmello opened this issue Jan 4, 2017 · 2 comments · Fixed by #2527
Closed

slider decimal point #2511

phmello opened this issue Jan 4, 2017 · 2 comments · Fixed by #2527
Assignees

Comments

@phmello
Copy link

phmello commented Jan 4, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

when the step attribute is set to 0.1 it should increment the value accordingly
13.9
23.2

What is the current behavior?

the component is displaying huge fractions such as
13.900000000000006
23.299999999999997

What are the steps to reproduce?

<md-slider [min]="-50" [max]="50" [step]="0.1" thumbLabel [(ngModel)]="annualReturn">

Providing a Plunker (or similar) is the best way to get the team to see your issue.
http://plnkr.co/edit/oeToNQlCIT3WZebLDAg5?p=preview

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

"@angular/material": "^2.0.0-alpha.11-3",

Is there anything else we should know?

@crisbeto crisbeto self-assigned this Jan 4, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 4, 2017
Rounds down the thumb label value to a maximum of one decimal place, in order to avoid displaying weird rounding errors.

Fixes angular#2511.
@crisbeto crisbeto added the has pr label Jan 4, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 19, 2017
Rounds down the thumb label value to a maximum of one decimal place, in order to avoid displaying weird rounding errors.

Fixes angular#2511.
@anandsummer28
Copy link

anandsummer28 commented Feb 20, 2019

It is still not working correctly.

For a step size of 0.005 it sometimes generates huge fractions like the prior case.
image

  <span class="small-text">0</span>
  <mat-slider
    min="0"
    [max]="updatedMax"
    step="0.005"
    thumbLabel
    tickInterval="10"
    #slider
  >
  </mat-slider>
  <span class="small-text">{{ updatedMax }}+</span>

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants