From 6b017df71b7ad107cdcb6d6ef85c8b4c539d8c8e Mon Sep 17 00:00:00 2001 From: Douwe Schulte Date: Tue, 7 Nov 2023 15:42:21 +0100 Subject: [PATCH] Fixed ppm calculation for negative numbers --- src/system.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system.rs b/src/system.rs index e3a7674..2b9d7a3 100644 --- a/src/system.rs +++ b/src/system.rs @@ -142,6 +142,6 @@ impl MassOverCharge { impl Mass { /// Absolute ppm error between this number and the given other pub fn ppm(self, b: Self) -> f64 { - ((self - b).abs() / self).value * 1e6 + ((self - b).abs() / self.abs()).value * 1e6 } }