From 4d2020fe57a316d63fae2d4053852a5fc8f532e1 Mon Sep 17 00:00:00 2001 From: vidsinghal Date: Wed, 17 Jan 2024 22:53:37 -0500 Subject: [PATCH] Change itertimes in iterate to print in scientific format for high precision. --- gibbon-compiler/src/Gibbon/Passes/Codegen.hs | 2 +- gibbon-rts/rts-c/gibbon_rts.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/Codegen.hs b/gibbon-compiler/src/Gibbon/Passes/Codegen.hs index c6d03fec1..8e4606042 100644 --- a/gibbon-compiler/src/Gibbon/Passes/Codegen.hs +++ b/gibbon-compiler/src/Gibbon/Passes/Codegen.hs @@ -658,7 +658,7 @@ codegenTail venv fenv sort_fns (LetTimedT flg bnds rhs body) ty sync_deps = gib_ptr_bumpalloc_restore_state(); } |] , C.BlockDecl [cdecl| double $id:itertime = gib_difftimespecs(&$(cid (toVar begn)), &$(cid (toVar end))); |] - , C.BlockStm [cstm| printf("itertime: %lf\n", $id:itertime); |] + , C.BlockStm [cstm| printf("itertime: %e\n", $id:itertime); |] , C.BlockStm [cstm| gib_vector_inplace_update($id:times, $id:iters, &($id:itertime)); |] ] in [ C.BlockStm [cstm| for (long long $id:iters = 0; $id:iters < gib_get_iters_param(); $id:iters ++) { $items:body } |] diff --git a/gibbon-rts/rts-c/gibbon_rts.c b/gibbon-rts/rts-c/gibbon_rts.c index 8fcc6c989..729ad24d9 100644 --- a/gibbon-rts/rts-c/gibbon_rts.c +++ b/gibbon-rts/rts-c/gibbon_rts.c @@ -677,10 +677,10 @@ void gib_print_timing_array(GibVector *times) { for(GibInt i = 0; i < n; i++) { d = gib_vector_nth(times, i); if (i == (n-1)) { - printf("%f",*d); + printf("%e",*d); } else { - printf("%f, ",*d); + printf("%e, ",*d); } } printf("]\n");