From 613003653554348e8f9c9a76c6b36323903adc0c Mon Sep 17 00:00:00 2001 From: Bandhav Veluri Date: Sun, 23 Jun 2019 11:18:40 -0700 Subject: [PATCH 1/2] Corrected crc32 result --- src/crc32/crc_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crc32/crc_32.c b/src/crc32/crc_32.c index ad53ddd6..31cb80cc 100644 --- a/src/crc32/crc_32.c +++ b/src/crc32/crc_32.c @@ -200,7 +200,7 @@ int benchmark() int verify_benchmark(int r) { - int expected = 1207487004; + int expected = 171698305; if (r != expected) return 0; From c3ba9ad7aa30171dc8fc70e1059d602f05b022cf Mon Sep 17 00:00:00 2001 From: Bandhav Veluri Date: Sun, 23 Jun 2019 11:20:35 -0700 Subject: [PATCH 2/2] Added epsilon based double comparison --- src/st/libst.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/st/libst.c b/src/st/libst.c index 208530ac..fe32978c 100644 --- a/src/st/libst.c +++ b/src/st/libst.c @@ -195,18 +195,20 @@ int RandomInteger() } int verify_benchmark(int unused) { + double epsilon = 0.00000000001; double expSumA = 4999.002470660901963128708302974700927734375; double expSumB = 4996.843113032735345768742263317108154296875; double expCoef = 0.99990005485361932446863875156850554049015045166016; - if (expSumA != SumA) { + + if (fabs(expSumA-SumA) > epsilon) { //printf("%.50f\n, %.50f\n\n", SumA, expSumA); return 0; } - if(expSumB != SumB) { + if(fabs(expSumB-SumB) > epsilon) { //printf("%.50f\n, %.50f\n\n", SumB, expSumB); return 0; } - if(expCoef != Coef) { + if(fabs(expCoef-Coef) > epsilon) { //printf("%.50f\n, %.50f\n\n", Coef, expCoef); return 0; }