Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with C++ endf float converter #7

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading