Michael Warmuth-Uhl wrote:
> Hello,
> 
> On 2015-09-07, Otto Moerbeek wrote:
> > The game is to fix the bugs
> 
> Below is my attempt to play this game.
> 
> It seems to fix the issues on amd64, but I'm not sure if the accuracy of
> long double and sqrtl is guaranteed to be enough in general.

using floating point seems suspect. i think what's needed is an integer sqrt
function.

> 
> Regards,
> 
> Michael
> 
> --- /usr/src/games/factor/factor.c      Wed Oct 28 00:59:24 2009
> +++ factor.c    Mon Sep  7 21:05:59 2015
> @@ -208,7 +208,7 @@ pr_bigfact(u_int64_t val)   /* Factor this value. */
>         char table[TABSIZE];    /* Eratosthenes sieve of odd numbers */
> 
>         start = *pr_limit + 2;
> -       stop  = (ubig)sqrt((double)val);
> +       stop  = (ubig)sqrtl((long double)val);
>         if ((stop & 0x1) == 0)
>                 stop++;
>         /*

Reply via email to