Skip to content

Truncate denormalized floating point values to 0 when writing ASCII

Steffen Müthing requested to merge bug/do-not-crash-paraview-on-macos into master

Paraview (well, probably VTK) on macOS crashes when reading ASCII files with denormalized float values. This seems to be due to libc++'s IO stream implementation, which sets the fail bit when reading a denormalized value. On top of that, Paraview just segfaults when encountering a fail bit while loading VTK files.

libstdc++ does not set the failt bit, and I don't know what is the correct behavior, but having Paraview mysteriously crash on DUNE output files is not good.

So this patch truncates subnormal floating point values to 0 when writing ASCII. This should not seriously influence any visualization results, but it might trip up people who use exact floating point comparisons for tests (but then you shouldn't do that anyway...).

Merge request reports