Move some numeric trait logic to default implementations

There are a handful of functions we can move out of the macro and to the
numeric traits as default implementations; do that here.

Additionally, add some bounds that make sense for completeness.
This commit is contained in:
Trevor Gross
2024-11-03 20:52:28 -06:00
committed by Trevor Gross
parent fcf8670668
commit 9a2774a0ae
3 changed files with 67 additions and 48 deletions

View File

@@ -314,7 +314,7 @@ where
// Make sure that the signs are the same before checing ULP to avoid wraparound
let act_sig = actual.signum();
let exp_sig = expected.signum();
ensure!(act_sig == exp_sig, "mismatched signs {act_sig} {exp_sig}");
ensure!(act_sig == exp_sig, "mismatched signs {act_sig:?} {exp_sig:?}");
if actual.is_infinite() ^ expected.is_infinite() {
bail!("mismatched infinities");