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

Re: [MacPerl] pi, slightly off topic



In article <BB61526CDE70D2119D0F00805FBECA2F014C57BA@RED-MSG-55>, "Creede Lambard (Volt Computer)" <a-creela@microsoft.com> writes:
> Anyway, I tried the same program mentioned above on this computer running NT
> 4.0 with ActivePerl:

> C:\> perl -e "printf (qq(%.50f),atan2(1,1) * 4.0);"
> 3.14159265358979310000000000000000000000000000000000

> same degree of accuracy, 15 digits. On Linux 2.2.5 with Perl 5.005_02 (hm,
> time to upgrade):

> [08:55 creede:~]$ perl -e "printf (qq(%.50f),atan2(1,1) * 4.0); print
> qq(\n);"
> 3.14159265358979311599796346854418516159057617187500

> same as MacPerl.

You have to remember that nowadays, pretty much all microprocessors use IEEE
arithmetic, so Perl's doubles have exactly the same 64 bit representation (52
bit mantissa, 11 bit exponent, 1 bit sign) on most PC/workstation
platforms. Even the accuracy of most arithmetic operations is standardized. It
is hardly surprising, therefore, that you get the same number of accurate
digits everywhere.


Matthias

-- 
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "I'm set free to find a new illusion" -- Velvet Underground


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org