New issue
Advanced search Search tips

Issue 778669 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

toFixed() does not properly rounds a number

Reported by kochelor...@gmail.com, Oct 26 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. Run the following code in dev console: `4.755.toFixed(2)`

What is the expected behavior?
I expect the result to be: "4.76"

What went wrong?
The actual result is "4.75"

Did this work before? N/A 

Chrome version: 61.0.3163.100  Channel: n/a
OS Version: OS X 10.12.6
Flash Version: 

Same issue with `47.55.toFixed(1)` and `0.4755.toFixed(3)`
 
I believe it is a JS engine issue, since I can reproduce it in NodeJS.
Components: -Blink Blink>JavaScript
Cc: pnangunoori@chromium.org
Labels: Needs-Milestone OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
Tested on latest Chrome Stable #62.0.3202.75, Canary #64.0.3251.0 and Chrome #50.0.2624.0 on Windows 10, Mac 10.12.6 and Ubuntu 14.04 and able to reproduce the issue.

This is a non-regression issue and able to reproduce from M-50 #50.0.2624.0. Marking it as untriaged so that issue gets addressed.

Attached the screenshot for reference.

Thanks.

778669.PNG
90.6 KB View Download
Status: WontFix (was: Untriaged)
This is probably due to imprecision of the floating point representation. Firefox behaves the same.

Sign in to add a comment