"bugs" in Mathematica?

• To: mathgroup at yoda.physics.unc.edu
• Subject: "bugs" in Mathematica?
• From: J.Wilson at cc.uq.oz.au
• Date: Tue, 1 Jun 1993 08:23:53 +1000

```I am using Mathematica for Windows 2.2 Student Edition, and I have
encountered what might be considered "bugs":

In[1]:=
2^32
Out[1]=
4294991158                   <-- 2^32 is in fact 4294967296!!
In[2]:=
1048576 4096                 <-- 2^20 2^12
Out[2]=
4294967296                   <-- This is the correct answer for 2^32
In[3]:=
65536 65536                  <-- 2^16 2^16
Out[3]=
4295003988                   <-- Huh?
In[4]:=
N[2^32, 10]
Out[4]=
9
4.295003988 10               <-- Not equal to 2^32!!
In[5]:=
Precision[ % ]
Out[5]=
10                           <-- More like 3!

I suspect that this problem may be caused by insufficient memory
(I am running on a 386SX-20 with 4M of RAM and 8M swap disk), however
I wrote a short program to calculate pi using 20,000 digit numbers and
I know at least the first 10,000 are correct!  Surely accurate integer
operations are trivial compared to 20,000-digit floating point!

Speaking of pi, I was somewhat surprised to see that, according to
Mathematica:

In[6]:=
pi = N[Pi, 100]
Out[6]=
3.14159265358979323847726475672949236948651245467951244082474929\
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57180162869915824851952128135649755605
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This number only has 20 correct digits of pi in it!  (incorrect digits
labelled with ^).  The actual figures (you can check this in
countless places) are:

3.1415926535897932384626433832795028841971693993751058209749445923\

07816406286208998628034825342117067982148 etc.

This in itself is not particularly important (who would use 100-digit
values of pi in a computation?) but I'm surprised that Mathematica
gives an inaccurate value for this and for the 2^32 calculations above!

Further evidence:

In[7]:=
3^100                        <-- The Mathematica book, p. 2
Out[7]=
515375413085732364763604855061513610239342074529

The Mathematica Book itself gives the answer as:
515377520732011331036461129765621272702107522001

It is interesting to note that N[EulerGamma, 40] agrees 100% with
the Mathematica book example, p.566.

Am I doing something wrong?  Is something wrong with my hardware
setup (386SX-20, 4M RAM, 8M swap disk, Win 3.1, 500MB hard disk,
running Stacker 2.01, DOS 6)?  Is Mathematica 2.2 Student Ed. to
blame?  I think Mathematica is a great program, especially with
functions and graphics etc. (the symbolic stuff is elegant and
reminds me of C++...)

________________________________________
|                D a v i d   W i l s o n |
|                                        |
|  Contact via jane at brolga.cc.uq.edu.au  |
|                                        |
| "The concept of number is the obvious  |
| distinction between the beast and man" |
|        --Joseph de Maistre (1753-1821) |
|________________________________________|

```

• Prev by Date: Re:FlatStrings
• Next by Date: Mma for Windows and C++