Quellcode durchsuchen

fix rare infinite loop with floating point inaccuracies in Fraction.ts (#880)

In certain cases, b becomes very small (2.0e-14) and never converges to 0.
Dathan vor 4 Jahren
Ursprung
Commit
669400125b
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      src/Common/DataObjects/Fraction.ts

+ 1 - 1
src/Common/DataObjects/Fraction.ts

@@ -64,7 +64,7 @@ export class Fraction {
       return 1;
     }
 
-    while (b !== 0) {
+    while (Math.abs(b) > 0.0000001) {
       if (a > b) {
         a -= b;
       } else {