From 85123c32ae2f91ae4e14ba831691d9df21110926 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 19 Dec 2024 18:39:38 +0530 Subject: [PATCH] fix: rounding method is not typically specified! --- caffeine/microbenchmarks/bench_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caffeine/microbenchmarks/bench_utils.py b/caffeine/microbenchmarks/bench_utils.py index 4166838..b949749 100644 --- a/caffeine/microbenchmarks/bench_utils.py +++ b/caffeine/microbenchmarks/bench_utils.py @@ -58,6 +58,14 @@ def cache_in_redis(num): bench_flt_typical = NanoBenchmark( + """flt(x, 2)""", + setup="x = random.uniform(1, 10000)", + globals={"flt": flt, "random": random}, +) + +# Rarely this is specified in code. +# But certain hot loops can benefit from this. +bench_flt_explicit_rounding = NanoBenchmark( """flt(x, 2, rounding_method="Banker's Rounding")""", setup="x = random.uniform(1, 10000)", globals={"flt": flt, "random": random},