-2

Considering this topic in JS(and in other languages) can we guarantee that fractions that can be simplified to the same number will be always the same in JS? For example expressions like

1/3 === 3/9; 3/9 === 6/18; 6/18 === 9/27; 9/27 === 27/81; // etc should they always return true?

Ginger Bread
  • 576
  • 3
  • 12
  • 29

1 Answers1

0

Yes considering that you can't guarantee because there's a limit to the accuracy. Example:

var factor = 283763287462387;
var x = 15 / 7
var y = 15 * factor / 7 * factor;
console.log(x === y)
IT goldman
  • 14,885
  • 2
  • 14
  • 28