Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions stress-tests/number-theory/ModMulLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ int main() {

const ull lim = 7268172458553106874ULL; // floor((sqrt(177) - 7) / 16 * 2**64)
test(lim, true, false);
test((ull)(lim * 1.01L), false, false);
// The expected-failure tests below only make sense with x87 long double (64-bit mantissa).
// With a wider long double (e.g. binary128 on aarch64) modmul stays correct up to ~2^63,
// so they would never find a counterexample and loop forever.
if (LDBL_MANT_DIG == 64) test((ull)(lim * 1.01L), false, false);
// test((ull)(lim * 1.001L), false, false);

testSq(lim, true, false);
testSq(lim, false, false);
if (LDBL_MANT_DIG == 64) testSq(lim, false, false);
cout << "Tests passed!" << endl;
}
4 changes: 3 additions & 1 deletion stress-tests/utilities/bench.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma once
#if defined(__x86_64__) || defined(__i386__)
#include <x86intrin.h>

// (avoid using this)
// (avoid using this) x86 only
ll rdtsc() { return __rdtsc(); }
#endif

ll tick() {
struct timespec tp;
Expand Down