Skip to main content
Kukurykus
Legend
April 12, 2020
Question

29.8 * 22.15 == 660.07 // false

  • April 12, 2020
  • 2 replies
  • 834 views

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
This topic has been closed for replies.

2 replies

Tom Ruark
Inspiring
August 26, 2020
Legend
April 19, 2020
var x = 29.8 * 22.15;
var y = 660.07;

alert(Number(x).toSource() == Number(y).toSource())
Kukurykus
KukurykusAuthor
Legend
April 19, 2020

You mean that's another a workaround?