[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test failures
From: |
Gary V. Vaughan |
Subject: |
Re: test failures |
Date: |
Fri, 3 Nov 2006 16:50:11 -0600 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hallo Ralf,
On 27 Oct 2006, at 17:57, Ralf Wildenhues wrote:
int main (void)
{
- return fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (4.) - 2.) <
0.01;
+ /* The ! is to invert C true to shell true
+ * The function b should call our sin (that returns 0) and not
libm's
+ * (in the latter case, b returns approximately 1)
+ * the sqrt is to force linking against libm
+ * the variable four is to prevent most compiler optimizations
+ */
+ return !( fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (four) -
2.) < 0.01 );
}
Rather than `!', may I humbly suggest the self documenting alternative:
int main (void)
{
int status = EXIT_FAILURE;
if (fabs (b (3.1415 / 2.)) < 0.01 && fabs (sqrt (four) - 2.) <
0.01)
status = EXIT_SUCCESS;
return status;
}
Cheers,
Gary
- --
Gary V. Vaughan ())_. address@hidden
Research Scientist ( '/ http://blog.azazil.net
GNU Hacker / )= http://www.gnu.org/software/{libtool,m4}
Technical Author `(_~)_ http://sources.redhat.com/autobook
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
iD8DBQFFS8enFRMICSmD1gYRAloEAKCIsDAx/KoKjQwhj4p2YLZHb8Av7QCgstGv
gGs1gVO7lkFWfGWTm+B2uRE=
=e4L/
-----END PGP SIGNATURE-----
- Re: test failures,
Gary V. Vaughan <=