Skip to content

Commit

Permalink
Fix issue with C++ endf float converter (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: aidancrilly <[email protected]>
  • Loading branch information
aidancrilly and aidancrilly authored Apr 18, 2024
1 parent 745bbb5 commit 24075e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/endf/_records.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

double cfloat_endf(const char* buffer)
{
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;
Expand All @@ -25,6 +25,7 @@ double cfloat_endf(const char* buffer)
int n = std::strlen(buffer);

int i;

for (i = 0; i < n; ++i) {
char c = buffer[i];

Expand All @@ -51,6 +52,7 @@ double cfloat_endf(const char* buffer)

// Copy character
arr[j++] = c;

}

// Done copying. Add null terminator and convert to double
Expand Down

0 comments on commit 24075e2

Please sign in to comment.