3 ms·
Hi, I thought that this is not the most interesting part of all the benchmarks, for example, all we need to test that with the quotient and the remainder: divid
by danlark1 6y ago
Hi, I thought that this is not the most interesting part of all the benchmarks, for example, all we need to test that with the quotient and the remainder: dividend = quotient * divisor + remainder, remainder < divisor and multiplication does not overflow which is free of division operations.
Yet, I added several tests like dividend < divisor, close to zero remainders, a lot of random stuff just to make sure each time I add a new approach, it is correct.
- specialist 6y agoNicely done. FWIW, I dimly recall a numeric library, maybe a float to string, which tested everything for verification. Took a few days to run. Then maybe use the spot checks to test for regressions. Weird compiler, toolchain, processor combos. That sort of thing.
- lifthrasiir 6y ago> FWIW, I dimly recall a numeric library, maybe a float to string, which tested everything for verification. Took a few days to run. You can definitely test against all ~2^31 IEEE 754 binary32 values to make sure that float-to-decimal conversion is correct; that's what I've done with the Rust standard library (took 2 hours per test). I believe testing all ~2^63 binary64 values are also feasible by now, but only with dedicated hardwares. For that reason I believe the library had only tested with binary32.
- saagarjha 6y agoWhat kind of hardware can crank through the 2^64 space in reasonable time?
- grandmczeb 6y agoIt’s actually surprisingly feasible. 1,000 cores running at 3GHz for a week do ~2^64 cycles.
- bloak 6y agoDon't you mean 10,000 cores?
- grandmczeb 6y agoWhoops, yes! Too late to edit.