Hi Leopold Toetsch,

>> PI is (very) approximately:
>   3.141590653589694692726652647252194583415985107421875000000000
>          ^^^^^
>   3.141592653589793238462643383279502884197169399375105820974944
> 
> You might probably want to run more iterations ;) And you'll never get
> 60 digits out of long doubles.

I appreciate that Leopold. I thought the zeros indicated where the stored
value cuts off. But with 52 significant figures at ~3.3 bits per figure
that's about 172 bits, which indicates they would have to be 256 bit
floats when including the exponent (my mistake in calling them 128 bit)!

In other words sprintf is printing trailing garbage:

.sub _main
        set     N1, 2.0
        set     N2, 3.0
        div     N1, N1, N2
        new     P0, .PerlArray
        set     P0, 1
        set     P0[0], N1
        sprintf S0, "%.60f\n", P0
        print   S0
        end
.end

On the CVS version I compiled this prints:
0.666666666666666629659232512494781985878944396972656250000000

On this win32 release (running on a different machine):
http://www.jwcs.net/developers/perl/pow/download/pow-0.1.1-release.zip
parrot prints:
0.666666666666666630000000000000000000000000000000000000000000

Regards,
Adam

Reply via email to