]> git.lizzy.rs Git - rust.git/commitdiff
Fix test floating point comparison to tolerate imprecise FPUs.
authorElliott Slaughter <eslaughter@mozilla.com>
Tue, 24 Jul 2012 22:48:18 +0000 (15:48 -0700)
committerElliott Slaughter <eslaughter@mozilla.com>
Tue, 24 Jul 2012 23:15:30 +0000 (16:15 -0700)
src/test/run-pass/utf8_idents.rs

index e017673602a238c5a733793f8ecef08a10bc6658..993a6c9aa4291595dcdb2be64c3ee8cfbf834a5a 100644 (file)
@@ -1,7 +1,8 @@
 fn main() {
+    let ε = 0.00001;
     let Π = 3.14;
     let लंच = Π * Π + 1.54;
-    assert लंच - 1.54 == Π * Π;
+    assert float::abs((लंच - 1.54) - (Π * Π)) < ε;
     assert საჭმელად_გემრიელი_სადილი() == 0;
 }