• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

29.8 * 22.15 == 660.07 // false

LEGEND ,
Apr 11, 2020 Apr 11, 2020

Copy link to clipboard

Copied

29.8 * 22.15 == 660.07 // false

 

Extendscript:

29.8 * 22.15 // 660.07
29.8 * 22.15 == 660.07 // false

 

Chrome Browser Console (F12):

29.8 * 22.15 // 660.0699999999999


Extendscript:

29.8 * 22.15 == 660.0699999999999 // true

 

minimal equality:

29.8 * 22.15 == 660.06999999999988 // true

maximal equality:

29.8 * 22.15 == 660.069999999999993 // true

so the range is: 993 - 88 = 905

 

Workarounds:

(29.8 * 22.15).toString() == 660.07; // true
(29.8 * 22.15).toFixed(2) == 660.07; // true
(29.8 * 22.15).toPrecision(5) == 660.07; // true
TOPICS
Actions and scripting

Views

701

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
People's Champ ,
Apr 19, 2020 Apr 19, 2020

Copy link to clipboard

Copied

var x = 29.8 * 22.15;
var y = 660.07;

alert(Number(x).toSource() == Number(y).toSource())

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2020 Apr 19, 2020

Copy link to clipboard

Copied

You mean that's another a workaround?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 25, 2020 Aug 25, 2020

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines