From da731a6d4fb0c45c4144a52fc5501665607e3c42 Mon Sep 17 00:00:00 2001 From: TTLC198 <41226242+TTLC198@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:34:46 +0300 Subject: [PATCH] Added special converter from float to correct float number --- HSMonitor/Utils/NumberExtensions.cs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 HSMonitor/Utils/NumberExtensions.cs diff --git a/HSMonitor/Utils/NumberExtensions.cs b/HSMonitor/Utils/NumberExtensions.cs new file mode 100644 index 0000000..6dad539 --- /dev/null +++ b/HSMonitor/Utils/NumberExtensions.cs @@ -0,0 +1,7 @@ +namespace HSMonitor.Utils; + +public static class NumberExtensions +{ + public static float GetFloatAsCorrectNumber(this float? value) + => float.IsNaN(value ?? 0) ? 0 : value ?? 0; +} \ No newline at end of file