[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] tcc doesn't set the inexact flag on inexact compile-time
From: |
Vincent Lefevre |
Subject: |
[Tinycc-devel] tcc doesn't set the inexact flag on inexact compile-time int-to-float conversion |
Date: |
Mon, 22 Apr 2013 15:58:13 +0200 |
User-agent: |
Mutt/1.5.21-6305-vl-r59709 (2013-04-16) |
tcc doesn't set the inexact flag on inexact compile-time int-to-float
conversion:
#include <stdio.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON
void test1 (void)
{
volatile float c;
c = 0x7fffffbf;
printf ("c = %a, inexact = %d\n", c, fetestexcept (FE_INEXACT));
}
void test2 (void)
{
volatile float c;
volatile int i = 0x7fffffbf;
c = i;
printf ("c = %a, inexact = %d\n", c, fetestexcept (FE_INEXACT));
}
int main (void)
{
test1 ();
test2 ();
return 0;
}
With tin 0.9.25 under Linux/x86_64 (Debian):
$ tcc -Wall -O2 conv-int-flt-inex.c -o conv-int-flt-inex -lm
$ ./conv-int-flt-inex
c = 0x1.fffffep+30, inexact = 0
c = 0x1.fffffep+30, inexact = 32
FYI, GCC has the same problem:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57029
--
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] tcc doesn't set the inexact flag on inexact compile-time int-to-float conversion,
Vincent Lefevre <=