https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370

--- Comment #1 from jacob navia <jacob at jacob dot remcomp.fr> ---
This program produces correct results:
#include <stdio.h>
#include <math.h>
long double nsqrt(long double x)
{
        double m = sqrt(x);
        long double r = m;

        r = (r+x/r)/2.0L;

        r = (r+x/r)/2.0L;
        r = (r+x/r)/2.0L;
        r = (r+x/r)/2.0L;
        r = (r+x/r)/2.0L;
        return r;
}

int main(void) { printf("%.30Lg \n",nsqrt(2.0L)); }
produces:
1.41421356237309504880168872421 
All digits que OK.

jacob

Reply via email to