-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nmparser: guard against NaN for all incoming floats
NONMEM output may contain NaN values for floats. Since fc3af5b (nmparser: map NaN's to DefaultFloat64 too, 2022-06-23), the nmparser code has guarded against NaNs in spots that use the strToFloat helper. However, that doesn't cover the places that invoke strconv.ParseFloat directly. That's a problem because the summary command will error when trying to encode an NaN to JSON. Adjust all the remaining strconv.ParseFloat calls to guard against NaN. Simply using strToFloat in all these spots isn't a good option because that silently replaces errors with DefaultFloat64. Add a new helper that maps NaN to DefaultFloat64 but, unlike strToFloat, relays any errors. If a spot does something with the error [*], use the new helper. On the other hand, if a spot ignores the error, use strToFloat. For testing, piggyback on top of summary's existing acop-nan test case by setting many values in its ext file to NaN. Thanks to @callistosp for reporting the original failure case. [*] Unfortunately the spots that process the error panic, while ideally they would bubble up the error as a return value. Still, using strToFloat is a step in the wrong direction.
- Loading branch information
Showing
11 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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