On Sun, 4 Jan 2015, Garrett Cooper wrote:

On Jan 2, 2015, at 0:03, Bruce Evans <b...@optusnet.com.au> wrote:
                rv = scalbnf(tests[i].inval, tests[i].exp);
                ATF_CHECK_EQ_MSG(errno, tests[i].error,
                    "test %zu: errno %d instead of %d", i, errno,

The tests might set errno elsewhere, but scalbnf() obviously doesn't
in FreeBSD (and shouldn't unless MATH_ERRNO), so the ATF_CHECK_EQ_MSG()
test can have no effect.  It is surprising that it doesn't sometimes
fail if errno is always 0.  If it always succeeds, then tests[i].error
must be dead data (always 0) and the ATF_CHECK_EQ_MSG() test dead code
(always pass).

Hmmm? How is MATH_ERRNO supposed to work in FreeBSD. Based on documentation I 
found ? http://en.cppreference.com/w/cpp/numeric/math/math_errhandling ? it?s 
supposed to be used for reporting errors with errno since c++11, but that 
doesn?t seem to be implemented in libc++/libstdc++ (at least not based on my 
limited grep)? FWIW it seems like this value should be 0, not 1...

It works by never being set in math_errhandling, since its form of
error handling is an implementation option that is only supported by
bad implementations.  The implementations that need it are mainly ones
whose hardware doesn't support Infs and NaNs.  IEEE754 made such
hardware uncommon, and FreeBSD never supported such hardware. fdlibm
has some support for errno, but this was never attached to
math_errhandling and was removed in FreeBSD in 2005.

math_errhandling is a macro in FreeBSD, with value always MATH_ERREXCEPT.

Not supporting MATH_ERRNO only requires a single Inf (to replace ERANGE)
and a single NaN (to replace EDOM).  MATH_ERREXCEPT requires much more of
IEEE754 to be useful.


Bruce
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to