From 794e6426e586c7ec7f894ed599b9bf865941b34e Mon Sep 17 00:00:00 2001
From: Andre <upwli@student.kit.edu>
Date: Sun, 12 Dec 2021 10:19:12 +0100
Subject: [PATCH] small corrections

---
 corsika/detail/media/GeomagneticModel.inl | 4 ++--
 tests/media/testMagneticField.cpp         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/corsika/detail/media/GeomagneticModel.inl b/corsika/detail/media/GeomagneticModel.inl
index 1747f9513..fc3f0711d 100644
--- a/corsika/detail/media/GeomagneticModel.inl
+++ b/corsika/detail/media/GeomagneticModel.inl
@@ -149,8 +149,8 @@ namespace corsika {
       p.h = p.h + (year - epoch) * p.dh;
       if (next_Epoch != 0) {
         ParameterLine next_p = parameters_[next_Epoch][j];
-        p.g = p.g + (next_p.g - p.g) * (year - epoch) / (next_Epoch - epoch);
-        p.h = p.h + (next_p.h - p.h) * (year - epoch) / (next_Epoch - epoch);
+        p.g = p.g + (next_p.g - p.g) * (year - epoch) / (double(next_Epoch) - epoch);
+        p.h = p.h + (next_p.h - p.h) * (year - epoch) / (double(next_Epoch) - epoch);
       }
 
       legendre = pow(-1, p.m) * std::assoc_legendre(p.n, p.m, sin(lat_sph));
diff --git a/tests/media/testMagneticField.cpp b/tests/media/testMagneticField.cpp
index de8b12fab..f46297fa6 100644
--- a/tests/media/testMagneticField.cpp
+++ b/tests/media/testMagneticField.cpp
@@ -104,7 +104,7 @@ TEST_CASE("UniformMagneticField w/ Homogeneous Medium") {
       MagneticFieldVector Earth_B_4 = igrf.getField(2012, 0_km, 0, -120);
       CHECK(Earth_B_1.getX(gCS) / 1_nT == Approx(5821).margin(0.5));
       CHECK(Earth_B_1.getY(gCS) / 1_nT == Approx(-14796).margin(0.5));
-      CHECK(Earth_B_1.getZ(gCS) / 1_nT == Approx(497756).margin(0.5));
+      CHECK(Earth_B_1.getZ(gCS) / 1_nT == Approx(49776).margin(0.5));
       CHECK(Earth_B_2.getX(gCS) / 1_nT == Approx(2957).margin(0.5));
       CHECK(Earth_B_2.getY(gCS) / 1_nT == Approx(-1014).margin(0.5));
       CHECK(Earth_B_2.getZ(gCS) / 1_nT == Approx(-57610).margin(0.5));
-- 
GitLab