This project is a proof of concept (PoC) that demonstrates how we can use the MPFR library as a āgold standardā to test the correctness of mathematical functions implemented in Mojo.
MPFR is an efficient C library for multiple-precision floating-point computations with correct rounding. It is used to test numerical routines in projects such as CORE-MATH, LLVM-libc, and RLIBM.
By comparing the outputs of our custom Mojo functions with MPFR, we can ensure our implementations are correctly rounded or, at least, as accurate as possible within the memory or latency requirements.
Main Features:
- Provides a routine to convert MPFR values into lower-precision floating-point types (like
float16
andbfloat16
), avoiding double rounding errors. - Supports correctness testing under multiple IEEE 754 rounding modes.
- Includes utilities to change and check rounding mode at runtime.