tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Major bug in the pow function resulting in: 0.993013 = 0.


From: BastaPrint
Subject: [Tinycc-devel] Major bug in the pow function resulting in: 0.993013 = 0.860892
Date: Fri, 5 Jan 2024 13:47:25 +0100 (CET)

Hello,
I discovered that TCC and GCC gave different results in a long algorithm.
I focused on the bug, and I could reduce the code to the following lines. If I reduce further the code, the bug disappears.

I think the code does not require further comments...  I'm using  tcc version 0.9.27 (x86_64 Windows)

The same calculation gives me 2 different values : 0.993013   0.860892 wheras it should give  0.993013  only (tells GCC).

#include <stdio.h>
#include <math.h>
int main(){
    double s = .7;
    double a = (1. - .1 * s) / (1. + .1 * s);
    double b = pow(a, .05);
    double c = pow( ((1. - .1 * s) / (1. + .1 * s)), .05);

    printf("%f   %f \n", b, c);
}

==> can anyone reproduce this?
==> any clue about the cause?

Thanks a lot !

reply via email to

[Prev in Thread] Current Thread [Next in Thread]