From 3e0342e816118fa9484d5b1922404fab47e6ebe0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 6 Nov 2024 19:14:24 +0100 Subject: [PATCH] Disallow `Scalar` value being infinite --- experiments/2024-10-30/src/math.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/experiments/2024-10-30/src/math.rs b/experiments/2024-10-30/src/math.rs index 33ce9d7f2..887458bf7 100644 --- a/experiments/2024-10-30/src/math.rs +++ b/experiments/2024-10-30/src/math.rs @@ -10,6 +10,9 @@ impl Scalar { if value.is_nan() { panic!("`Scalar` value must not be NaN"); } + if value.is_infinite() { + panic!("`Scalar` value must not be infinite. Value: `{value}`"); + } Self { value } }