Closed RemDelaporteMathurin closed 3 months ago
I recently tried to convert a mesh and ran into an assertion error in _float_to_nastran_string.
_float_to_nastran_string
To reproduce the bug
from meshio.nastran._nastran import _float_to_nastran_string _float_to_nastran_string(-1.5614246689128802e-18)
Traceback (most recent call last): File "/home/remidm/festim-review/comparison/achlys/convert_mesh.py", line 27, in <module> _float_to_nastran_string(-1.5614246689128802e-18) File "/home/remidm/miniconda3/envs/festim/lib/python3.11/site-packages/meshio/nastran/_nastran.py", line 416, in _float_to_nastran_string assert len(out) <= 16 ^^^^^^^^^^^^^^ AssertionError
The value of out is -1.56142466891E-18 which is 18 characters long.
out
-1.56142466891E-18
This PR reduces the precision argument in format_float_scientific to 9 and fixes the bug.
format_float_scientific
ping @gabriele-ferrero
@nschloe I realise this may be a duplicate of https://github.com/nschloe/meshio/pull/1350
I recently tried to convert a mesh and ran into an assertion error in
_float_to_nastran_string
.To reproduce the bug
The value of
out
is-1.56142466891E-18
which is 18 characters long.This PR reduces the precision argument in
format_float_scientific
to 9 and fixes the bug.ping @gabriele-ferrero