On Fri, Jul 25, 2008 at 2:50 PM, Andreas Jaeger <aj@xxxxxxxxxx> wrote: > "Michael Kerrisk" <mtk.manpages@xxxxxxxxxxxxxx> writes: > >> On Fri, Jul 25, 2008 at 12:36 PM, Andreas Jaeger <aj@xxxxxxxxxx> wrote: >>> "Michael Kerrisk" <mtk.manpages@xxxxxxxxxxxxxx> writes: >>> >>>> Well, for example, according to my tests, cos(3) does not set errno. >>>> Is that what you would have expected? >>> >>> No, I wouldn't. >> >> (Slightly confused here, since you seem to contradict my result, but >> then the text below seems to agree with my result. But maybe I'm just >> misreading your text.) > > I was confused as well ;) > >>> And double checking, it's the other way round :-(. We >>> test the exception handling, not the error handling, so tests like >>> (libc/math/libm-test.inc) these >>> >>> TEST_f_f (cos, plus_infty, nan_value, INVALID_EXCEPTION); >>> TEST_f_f (cos, minus_infty, nan_value, INVALID_EXCEPTION); >>> >>> test that cos with input plus/minus infinity returns a NaN and raises >>> and invalid exception which is tested with fetestexcept. And if you >>> have different results, please tell me, >> >> When I run the program belwo, this is what I see for a domain error from cos(): >> >> $ ./a.out inf >> errno == 0 >> fetestexcept() says: 1 FE_INVALID >> cos(inf)=nan > > Which is the correct behaviour for the exception AFAIK. Yes. I think all of the functions that I tested gave the right exception (except a very few that don't give an exception, but do set errno). > Setting of > errno is indeed missing - if math_errhandling has the right value which > is unfortunately missing, Yes. My point is that there is no consistency across the math functions. (And math_errhandling only tells about error reporting behavior across all functions, so it's presence or absence isn't really relevant to this inconsistency.) Some set errno and give an exception, while some do one, but not the other. -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html