This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug math/688] Math error on a null sum operation: a =a + 0. !!
- From: "laurent dot dagnac at atosorigin dot com" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 21 Jan 2005 15:01:50 -0000
- Subject: [Bug math/688] Math error on a null sum operation: a =a + 0. !!
- References: <20050121134619.688.laurent.dagnac@atosorigin.com>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From laurent dot dagnac at atosorigin dot com 2005-01-21 15:01 -------
Subject: Re: *** SPAM scored: Low *** Math error on a null
sum operation: a =a + 0. !!
thank you for you help,
I modified my testcase in order to avoid the mentioned voilation, but
without resolving the problem.
double val;
char *c;
c = (char *) &val;
val = 100.00000005;
printf ("%2d %2d %2d %2d %2d %2d %2d %2d \n",
*c, *(c+1), *(c+2),*(c+3),*(c+4),*(c+5),*(c+6),*(c+7));
val = val + 0.;
printf ("%2d %2d %2d %2d %2d %2d %2d %2d \n",
*c, *(c+1), *(c+2),*(c+3),*(c+4),*(c+5),*(c+6),*(c+7));
Results...
> -27 -81 53 0 0 0 89 64
> 0 0 0 0 0 0 89 64
The fractional part (lower word of the double) has been avoided by the
sum. !!
Can you help me again
jakub at redhat dot com a écrit :
> ------- Additional Comments From jakub at redhat dot com 2005-01-21 13:56 -------
> This has nothing to do with glibc FYI.
> Your testcase is invalid.
> Please study GCC manual about -fstrict-aliasing option (enabled at -O2 and above
> by default), you are violating that. Furthermore, you really shouldn't overwrite
> random memory at ((char*)&val) - 1.
>
--
---
=======================================================================
Ce message electronique est confidentiel. Il peut contenir des
informations protegees par le secret professionnel, le secret de
fabrication ou autres regles legales. Si vous recevez ce message par
erreur, il vous est interdit de le reproduire ou de le distribuer en
tout ou en partie, ou de le divulguer de quelque maniere que ce soit a
quelque personne que ce soit. Nous vous prions de bien vouloir en
informer Atos Origin, par telephone ou par retour d'e-mail puis de
detruire le message et toutes copies de votre systeme informatique. Le
contenu de ce message ne reflete pas necessairement ni les opinions
d'Atos Origin ni celle des membres de son groupe. Bien que l'emetteur
de ce message ait fait tout son possible pour maintenir son systeme
informatique sans virus, il ne peut garantir que cette transmission ne
comporte aucun virus et il ne pourra etre tenu pour responsable de
quelque dommage que ce soit resultant de la transmission d'un virus.
=======================================================================
This electronic transmission is confidential. It may contain
information that is covered by legal professional privilege, work
product immunity or other legal rules. If you have received this
transmission in error, you must not copy or distribute this message or
any part of it or otherwise disclose its contents to anyone. Please
notify Atos Origin Legal Services by telephone or return E-mail, and
then delete this transmission and any copies of it from your computer
system. The views expressed in this electronic transmission do not
necessarily reflect those of Atos Origin SA or any member of its group.
Although the sender endeavours to maintain a computer virus free
network, the sender does not warrant that this transmission is virus
free and will not be liable for any damages resulting from any virus
transmitted.
=======================================================================
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=688
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.