[libc-commits] [libc] [libc] DRAFT: Add Generic and NVPTX Sin Benchmark (PR #99795)

via libc-commits libc-commits at lists.llvm.org
Sat Jul 27 19:33:07 PDT 2024


================
@@ -105,6 +109,56 @@ class Benchmark {
     return benchmark(options, func);
   }
 };
+
+// We want our random values to be approximately
+// |real value| <= 2^(max_exponent) * (1 + (random 52 bits) * 2^-52) <
+// 2^(max_exponent + 1)
+// The largest integer that can be stored in a double is 2^53
+static constexpr int MAX_EXPONENT = 52;
+
+static double get_rand_double() {
----------------
jameshu15869 wrote:

Since floats should have a different MAX_EXPONENT, how would you suggest we template this? Is there a nice way to switch the value of `MAX_EXPONENT`when using floats and doubles?

https://github.com/llvm/llvm-project/pull/99795


More information about the libc-commits mailing list