[Bug c/35523] Wrong result for constant float expression

2008-03-11 Thread martin dot apel at simpack dot de
--- Comment #10 from martin dot apel at simpack dot de 2008-03-11 07:58 --- You are right, tan(PI/2) is undefined. I had this contained in some sort of unit test comparing the results of my own formula evaluation code and the result of the compiler. This gave the same result with gcc 4.

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread rguenth at gcc dot gnu dot org
--- Comment #9 from rguenth at gcc dot gnu dot org 2008-03-10 17:07 --- Obviously PI/2 isn't representable exactly here (also not the result, after all the value is not defined, the value should approach -Inf / +Inf) Neither ISO C nor IEEE specifies the result for exactly PI/2 (it could

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread rguenth at gcc dot gnu dot org
--- Comment #8 from rguenth at gcc dot gnu dot org 2008-03-10 16:59 --- Are you sure your calculator isn't wrong? ;) Gcc 4.2 produces the same result for me (and only gcc 4.3 constant folds the result). Of course this might be a glibc issue as indeed the 32bit version produces ./t sin

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread pinskia at gcc dot gnu dot org
--- Comment #7 from pinskia at gcc dot gnu dot org 2008-03-10 16:53 --- (In reply to comment #6) > I also get: > [dandelion:~] pinskia% ./a.out > sin(cos(tan(PI/2))) = -0.280611 In fact this calls the functions: fmr f1,f0 bl L_tan$stub fmr f0,f1 fmr f1,f0

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread pinskia at gcc dot gnu dot org
--- Comment #6 from pinskia at gcc dot gnu dot org 2008-03-10 16:52 --- I also get: [dandelion:~] pinskia% ./a.out sin(cos(tan(PI/2))) = -0.280611 Get 4.0.1 on powerpc-darwin. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35523

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread pinskia at gcc dot gnu dot org
--- Comment #5 from pinskia at gcc dot gnu dot org 2008-03-10 16:48 --- On i686: [EMAIL PROTECTED] local]$ ~/gcc-local/bin/gcc t.c -fno-builtin -lm -O2 [EMAIL PROTECTED] local]$ !./ ./a.out sin(cos(tan(PI/2))) = -0.827351 [EMAIL PROTECTED] local]$ ~/gcc-local/bin/gcc t.c -lm -O2 [EMAIL

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread martin dot apel at simpack dot de
--- Comment #4 from martin dot apel at simpack dot de 2008-03-10 16:33 --- (In reply to comment #3) > gcc-4.3 -o t t.i > ./t > sin(cos(tan(PI/2))) = -0.280611 > > gcc-4.3 -o t t.i -fno-builtin -lm > ./t > sin(cos(tan(PI/2))) = -0.280611 > > works for me? > It compiles and runs, but

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread rguenth at gcc dot gnu dot org
--- Comment #3 from rguenth at gcc dot gnu dot org 2008-03-10 15:12 --- gcc-4.3 -o t t.i ./t sin(cos(tan(PI/2))) = -0.280611 gcc-4.3 -o t t.i -fno-builtin -lm ./t sin(cos(tan(PI/2))) = -0.280611 works for me? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35523

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread martin dot apel at simpack dot de
--- Comment #2 from martin dot apel at simpack dot de 2008-03-10 10:42 --- Version information for libgmp: 4.2.2, compiled with gcc-4.2.2 Version information for libmpfr: 2.3.1, compiled with gcc-4.2.2 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35523

[Bug c/35523] Wrong result for constant float expression

2008-03-10 Thread martin dot apel at simpack dot de
--- Comment #1 from martin dot apel at simpack dot de 2008-03-10 10:37 --- Created an attachment (id=15288) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15288&action=view) Preprocessed source file producing the bug -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35523