New issue
Advanced search Search tips

Issue 820517 link

Starred by 2 users

Issue metadata

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



Sign in to add a comment

show double when cycle a for with decimal distinct .5

Reported by angel.ol...@gmail.com, Mar 9 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36

Steps to reproduce the problem:
         this.stepsSize = []
                for (i = 0.5; i <= 2; i = i + 0.2) {
                    console.log(i);
                    var size_name = i + " em"
                    console.log(size_name);
                    this.stepsSize.push({ name: size_name, value: i });
                }

What is the expected behavior?
0.5
0.5 em
0.7
0.7 em
0.8999999999999999
0.8999999999999999 em
1.0999999999999999
1.0999999999999999 em
1.2999999999999998
1.2999999999999998 em
1.4999999999999998
1.4999999999999998 em
1.6999999999999997
1.6999999999999997 em
1.8999999999999997
1.8999999999999997 em

What went wrong?
0.5
0.5 em
0.7
0.7 em
0.9
0.9 em
1.11
1.11 em
1.13
1.13 em
1.15
1.15 em
1.17
1.17 em
1.19
1.19 em

Did this work before? N/A 

Chrome version: 64.0.3282.186  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
the wrong  is the expected behavior
the expected behavior is the wrong

Comment 2 by kochi@chromium.org, Mar 10 2018

Components: -Blink Blink>JavaScript

Comment 3 by kochi@chromium.org, Mar 10 2018

I guess this is working as expected or intended as JavaScript number (which is a
"double" floating point) cannot represent some numbers exactly as in decimal,
but I'll defer this to experts in v8 team.
Labels: Needs-Triage-M64
Cc: susan.boorgula@chromium.org
Labels: Triaged-ET M-67 Target-67 FoundIn-67 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
angel.oliver.cv@ Thanks for the issue.

Able to reproduce the issue on Windows 10, Mac OS 10.12.6 and Ubuntu 14.04 on the latest Canary 67.0.3368.0 and Stable 65.0.3325.146 by following the steps given above.

From comment #1, we can understand that the output given under the Expected behavior is the wrong behavior and output given under wrong behavior is the expected behavior.

On executing the give code in Devtools -> Console, can see the output as the wrong behavior.
Attached is the screen shot for reference.

This is a Non-Regression issue as this behavior is observed from M60 Chrome builds. 
Hence marking this as Untriaged for further updates from Dev.

Thanks..
820517.PNG
62.8 KB View Download
Components: -Blink>JavaScript Blink>JavaScript>Language
Status: WontFix (was: Untriaged)
This is AFAIK working is intended. See #3. The real expected values are wrong btw.

Sign in to add a comment