From d53155d234f681548534be5085383d423ecf88d6 Mon Sep 17 00:00:00 2001 From: Aidan Crilly <20111148+aidancrilly@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:46:18 +0100 Subject: [PATCH] Added fix to cfloat_endf for length 11 endf floats (#2967) Co-authored-by: aidancrilly --- openmc/data/endf.c | 2 +- tests/unit_tests/test_endf.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openmc/data/endf.c b/openmc/data/endf.c index 936fd3bbbe2..dd5eee54184 100644 --- a/openmc/data/endf.c +++ b/openmc/data/endf.c @@ -14,7 +14,7 @@ double cfloat_endf(const char* buffer, int n) { - char arr[12]; // 11 characters plus a null terminator + char arr[13]; // 11 characters plus e and a null terminator int j = 0; // current position in arr int found_significand = 0; int found_exponent = 0; diff --git a/tests/unit_tests/test_endf.py b/tests/unit_tests/test_endf.py index 9e69708673e..1d4982054c8 100644 --- a/tests/unit_tests/test_endf.py +++ b/tests/unit_tests/test_endf.py @@ -23,6 +23,7 @@ def test_float_endf(): assert endf.float_endf('-1.+2') == approx(-100.0) assert endf.float_endf(' ') == 0.0 assert endf.float_endf('9.876540000000000') == approx(9.87654) + assert endf.float_endf('-2.225002+6') == approx(-2.225002e+6) def test_int_endf():