[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: [Pcc] Small difference in floating point for exprtk
From:       Anders Magnusson <ragge () ludd ! ltu ! se>
Date:       2022-11-20 14:12:52
Message-ID: 6be6b221-78d7-1bcb-6ec3-5a1cd046a75f () ludd ! ltu ! se
[Download RAW message or body]

Interesting!

Which target did you use? (x86 or x64?)  They have a different way of 
doing floating point calculations.
Also, using c99 parsing gives different result for gcc compared to the 
default gnu-style.

I tried with your test program, and the problem seems to be that there 
is a rounding difference whether 64- or 80-bit floating point is used.
On x86 all floating point runtime calculations should be evaluated using 
80-bit floating point, therefore I use that also for constant evaluation.
But; that gives a difference compared to both runtime and how gcc does it.

Example on differences.  pcc always use c99 for floating point.

% gcc x1.c && ./a.out
const: 0x1.fff8dd616f86bp+3
eval : 0x1.fff8dd616f86bp+3

% gcc -std=c99 x1.c && ./a.out
const: 0x1.fff8dd616f86ap+3
eval : 0x1.fff8dd616f86bp+3

% pcc x1.c && ./a.out
const: 0x1.fff8dd616f86ap+3
eval : 0x1.fff8dd616f86bp+3

-- R

Den 2022-11-18 kl. 11:23, skrev Domingo Alvarez Duarte:
> When testing "pcc" with exprtk test attached 
> (https://github.com/ArashPartow/exprtk) there is a small difference in 
> the floating point results compared to "gcc/clang/tinycc" that all 
> gives the same output.
>
> ====
>
> ./exprtk-(gcc/clang/tcc)
>
> ...
>
> 7364    7285
>
> ====
>
> ====
>
> ./exprtk-pcc
>
> ...
>
> 7364    7284
>
> ====
>
>
> _______________________________________________
> Pcc mailing list
> Pcc@lists.ludd.ltu.se
> https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc


_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic