This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PPL-devel] More floating point problems on the Alpha
- From: Abramo Bagnara <abramobagnara at tin dot it>
- To: Roberto Bagnara <bagnara at cs dot unipr dot it>
- Cc: gcc at gcc dot gnu dot org, The Parma Polyhedra Library developers' list <ppl-devel at cs dot unipr dot it>
- Date: Mon, 22 Sep 2008 21:56:30 +0200
- Subject: Re: [PPL-devel] More floating point problems on the Alpha
- References: <48D7DBAE.6000704@cs.unipr.it>
Roberto Bagnara ha scritto:
> [Thanks to all those who responded to my previous problem-report
> wrt to the IEEE inexact-flag on the Alpha. We have filed a bug
> report for that one.]
>
> Hi there,
>
> we keep finding problems on the Alpha, and we are unsure about
> what is going on. I anticipate that the present problem does
> not seem to be a compiler issue (except that the -mieee-with-inexact
> option promises full compliance with the IEEE floating point
> standard). However, I hope some Alpha expert can advise about
> how to investigate the issue further.
>
> Here are the details:
>
> $ cat bug.c
> #include <stdio.h>
>
> float f = 1.4e-45;
> double d = 1e-300;
>
> int
> main() {
> if (1.4e-45f > 1e-300)
> printf("compile-time test says 1.4e-45f > 1e-300\n");
> if (f < d)
> printf(" run-time test says 1.4e-45f < 1e-300\n");
> return 0;
> }
>
The problem come from the fact that for astonishing reasons 1.4e-45f is
not seen as 1.4e-45.
So, adding
printf("%g\n", f);
before
return 0;
we get
$ ./a.out
compile-time test says 1.4e-45f > 1e-300
run-time test says 1.4e-45f < 1e-300
2.65249e-315
Note that 2.65249e-315 is not representable in ieee754/iec559 32 bit
floating point.
32 bit floats are emulated on Alpha? There is an huge bug in FP emulation?
--
Abramo Bagnara
Opera Unica Phone: +39.0546.656023
Via Borghesi, 16
48014 Castel Bolognese (RA) - Italy