On Saturday, October 30, 2021 at 6:32:35 PM UTC-7, jfh wrote:
(snip, I wrote)
> > But otherwise, I/O library routines should save the flag state,
> > and set appropriate flags for their use. Then restore before
> > returning.
> But there may be situations where the user wants to know
> precision has been lost even in I/O library routines.
> (I don't know of any but that may just be my ignorance.)
In general, one knows what their own code does, but not what
library routines do. I suspect that is especially true in this case.
There isn't actually a "precision" exception, but "inexact", which
is raised by most floating point operations. But consider, more
likely, that you have underflow exception enabled. And it might
be that the I/O routines, in normal operation, generate underflow
exceptions. In most cases, you wouldn't want to know that.
If the I/O routines did something that you would want to know
about, you should be able to ask specifically for them, and the
routines should specifically test for them.
I almost wrote "library routines" without the I/O in front, and
probably also mean that. In many cases, library routines
should specifically test for things, and give the appropriate
exception, instead of just letting them happen.
For example, CABS should not generate an overflow when
the result doesn't overflow, (and is correct), even if
intermediate values overflow.
But as well as I know it, you likely never want inexact enabled.