Return _exception::retval on math errors from math functions #1364
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the back of the Open Watcom C Library reference, appendix A.4 Domain Errors, there's a list of error results for math functions. Trouble is, it doesn't seem to match reality.
Here's a program:
But the results are all zero: (on Linux, from
owcc -Wall temp.c -o temp && ./temp
)And if I uncomment the
_set_matherr
, I get (almost) all123
:The patch in this PR gets almost to what the manual says things should be:
...with the only difference being the
pow(0, -1)
.A few things:
builder test
fails on my end inopen-watcom-v2/bld
, but it does pass inopen-watcom-v2/bld/mathlib
...for what that's worth, since themathlib
test shows no output._set_matherr(_no_matherr)
, the123
returned from_no_matherr
is completely ignored.struct _exception::retval
to override the default error result, even though that should work. (One problem at a time!)