Added fix to cfloat_endf for length 11 endf floats (#2967)

Co-authored-by: aidancrilly <a.crilly16@imperial.ac.uk>
This commit is contained in:
Aidan Crilly 2024-04-18 17:46:18 +01:00 committed by GitHub
parent 2974d53b3c
commit d53155d234
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -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;

View file

@ -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():