Repository navigation
Conversation
Author
|
Hi @nschloe, could you take a look at this when you get a chance? It fixes the Nastran writer crashing on values with three digit exponents. Tests pass locally. Thanks! |
Author
|
closing this one, no traction. thanks anyway |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1539.
_float_to_nastran_stringformatted every value with a fixed precision of 11 and asserted the result fits the 16-character field. For values with a three-digit exponent and a full mantissa, e.g.-1.234567890123e-100or1.500000000001e308, the string is longer than 16 characters and writing the mesh died with anAssertionError.The formatter now lowers the precision step by step until the string fits the requested field length, so extreme values lose a few digits instead of crashing the write. Output for ordinary values is unchanged. The
lengthargument is also honored now (the assert hardcoded 16).Added parametrized tests covering zero, ordinary values, and three-digit-exponent values, plus a short-field case.
tests/test_nastran.py: 23 passed; the twotest_reference_filefailures are pre-existing on upstream main.