Branch: Tag:

2001-01-15

2001-01-15 11:14:46 by Mirar (Pontus Hagland) <pike@sort.mirar.org>

use sprintf to avoid double-precision addition errors

Rev: src/testsuite.in:1.369

1: - test_true([["$Id: testsuite.in,v 1.368 2001/01/15 00:28:34 mast Exp $"]]); + test_true([["$Id: testsuite.in,v 1.369 2001/01/15 11:14:46 mirar Exp $"]]);      cond([[all_constants()->_verify_internals]],   [[
4304:   test_switch4(this_object(),"",0,4.0,1)      test_any(int e;string t=""; for(e=0;e<10;e++) switch(e) { default: t+=e; case 4..8: } return t,"01239") - test_any([[float e,q; q=0.0; for(e=0.1;e<10.0;e+=1.0) switch(e) { default: q+=e; case 4.0..8.0: } return q]],0.1+1.1+2.1+3.1+8.1+9.1) +     -  + // use sprintf here; the sums aren't totally equal for doubles (error~=1e-16) + test_any([[float e,q; q=0.0; for(e=0.1;e<10.0;e+=1.0) switch(e) { default: q+=e; case 4.0..8.0: } return sprintf("%.6f",q)]],[[sprintf("%.6f",0.1+1.1+2.1+3.1+8.1+9.1)]]) +    // Breaks and continues with labels   test_compile_error([[break;]])   test_compile_error([[continue;]])