Finally :-)
Leopold Toetsch wrote:
The opcode <neg_n_n> is currently implemented as $1 = 0.0 - $2; But this
is not the same as $1 = -$2 in the case of $2 being 0.0. The former
gives 0.0, the version with negate gives -0.0.
$ gcc -o neg -g neg.c && ./neg # [1] ppc, x86, amd64
0 - f = 0.000000
- f = -0.000000
It looks like JIT/ppc is the only one doing it right, but being in
minority the test result is considered as an error ;-) JIT/i386 has both
implementations (fchs, fsub 0,..) the latter being enabled.
To me this all looks like workarounds to hide the ugly -0.0 (which we
can't anyway). Therefore I'll change the opcode, the test, and JIT/i386
to just use negation, if no one has objections.
leo
[1]
$ cat neg.c
#include <stdio.h>
int main(int argc, char* argv[])
{
double f;
f = 0.0;
f = 0.0 - f;
printf("0 - f = %f\n", f);
f = 0.0;
f = - f;
printf(" - f = %f\n", f);
return 0;
}
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal