alugowski / fast_matrix_market

Fast and full-featured Matrix Market I/O library for C++, Python, and R
BSD 2-Clause "Simplified" License
75 stars 7 forks source link

Add out-of-range testing for ints and floats #14

Closed alugowski closed 1 year ago

alugowski commented 1 year ago

Strings with out-of-range integer values now throw an out_of_range exception. Floats optionally throw the same exception or return the closest match (+/-inf for overflow, +/-0 for underflow) as is the default behavior for strtod if one ignores errno==ERANGE. The latter is Python and SciPy behavior.

Fixes https://github.com/alugowski/fast_matrix_market/issues/11

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 93.25% and project coverage change: -0.25 :warning:

Comparison is base (b4ee033) 96.49% compared to head (71a3134) 96.24%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #14 +/- ## ========================================== - Coverage 96.49% 96.24% -0.25% ========================================== Files 18 18 Lines 1255 1332 +77 Branches 130 151 +21 ========================================== + Hits 1211 1282 +71 - Misses 44 50 +6 ``` | [Impacted Files](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski) | Coverage Δ | | |---|---|---| | [include/fast\_matrix\_market/read\_body\_threads.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvcmVhZF9ib2R5X3RocmVhZHMuaHBw) | `100.00% <ø> (ø)` | | | [include/fast\_matrix\_market/types.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvdHlwZXMuaHBw) | `100.00% <ø> (ø)` | | | [include/fast\_matrix\_market/field\_conv.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvZmllbGRfY29udi5ocHA=) | `95.65% <92.85%> (-1.52%)` | :arrow_down: | | [include/fast\_matrix\_market/header.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvaGVhZGVyLmhwcA==) | `96.22% <92.85%> (-0.65%)` | :arrow_down: | | [include/fast\_matrix\_market/fast\_matrix\_market.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvZmFzdF9tYXRyaXhfbWFya2V0LmhwcA==) | `97.29% <100.00%> (+0.07%)` | :arrow_up: | | [include/fast\_matrix\_market/read\_body.hpp](https://codecov.io/gh/alugowski/fast_matrix_market/pull/14?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski#diff-aW5jbHVkZS9mYXN0X21hdHJpeF9tYXJrZXQvcmVhZF9ib2R5LmhwcA==) | `98.83% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Adam+Lugowski)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.