Closed eriknw closed 1 year ago
Good find.
Fixing this brought to light overflow handling in general. Integer overflow is now handled more explicitly.
Floating point under/overflow is a trickier issue as there are two valid interpretations. Consider 1e9999 or 1e-9999 being read into a double
or Python float
. Some would say those should throw an error, others insist that those should be inf
or 0
, respectively. Python (and SciPy) take the latter approach, as do JavaScript, Swift, and any code that ignores the ERANGE error from strtod()
(which is how Python gets its behavior).
So I added a switch to choose best match or throw behavior for floating point overflow. That required contributing to some floating-point library dependencies :)
This is yet another (small) difference between
fmm.mmread
andscipy.io.mmread
, which I think you may like to know if you wantfmm.mmread
to be more-or-less be a drop-in replacement forscipy.io.mmread
:See: https://github.com/scipy/scipy/blob/69e0c474f886990a85a88521cffb8b3978bdfd66/scipy/io/tests/test_mmio.py#L321-L335