There Are Only Four Billion Floats–So Test Them All (2014)
I used a similar idea the other day, while implementing in Rust the CRC algorithm that a device required, but the vendor didn't document 100% clearly.<p>Fortunately, I had some device vendor sample code in C (of varying quality and provenance), which I believed was probably correct, but I wasn't 100% certain which (if any) of numerous CRC standard variants it was actually implementing (so I couldn't just use an off-the-shelf Rust library).<p>So, the fastest/best way to get a perfectly compatible Rust implementation seemed to be:<p>1. Write idiomatic Rust code to try to mimic the behavior of the C code.<p>2. Write some C code to generate a text file of exhaustive results from the known-good C implementation, for all possible inputs up to length N.<p>3. Exhaustively check the Rust implementation against that text file of inputs and outputs.