MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Floor problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8401] RE: [mg8194] Floor problems
  • From: Ersek_Ted%PAX1A at mr.nawcad.navy.mil
  • Date: Tue, 26 Aug 1997 20:41:41 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Recall the earlier problem reporting different results for
Floor[0.7*67*10]
Floor[67*10*0.7]

This problem has created a lot of discussion !
Some members of the group reported that using Mma Version 2.2.
they got the same results regardless of what order the numbers were in.

It turns out Version 2.2.1 ( probably earlier versions as well )
Sorted the numbers before doing the multiplication !
The following was done with Version 2.2.1

In[1]:=  Trace[67*10*0.7]

Out[1]= {67 10 0.7,  0.7 10 67,  469.}


Sorting the elements is an important step when symbolic expression are
involved.  Mma Version 3.0.1 still sorts symbolic entries before they are
multiplied.   In the next line Version 3.0.1 Sorts symbolic elements before
they are multiplied.

In[1]:=  Trace[q*e*w*q*r*q]

Out[1]=  {q e q w q r q,  e q q q q r w, e q^4 r w}

I think the developers at WRI realized numerical multiplication was wasting 
time
sorting the numbers for little if any benefit.  In Version 3.0.1 numbers are 
not sorted before they are multiplied.  This is demonstrated by the 
following lines using
Version 3.0.1.

In[1]:=  Trace[67*10*0.7]

Out[1]=  {67  10  0.7,   469.}


In[2]:=  Trace[0.7*67*10]

Out[2]= {0.7  67  10,   469.}

Under Version 2.2.1 machine precision multiplication is commutative!
Using this version the results are no more correct, but you get the same
result (possibly a wrong result ) regardless of what order you enter the
data in.

As others have pointed out machine precision multiplication is not
commutative using Version 3.0.1.  Everything said about machine precision
multiplication above applies to machine precision addition as well.

     Ted Ersek



  • Prev by Date: Re: Goofy text behavior
  • Next by Date: MathLink Question
  • Previous by thread: Re: floor problems
  • Next by thread: Limit a^n / n!