Mathcad 14 calculation bug when evaluating 2^31

June 17th, 2008 | Categories: general math, math software, mathcad | Tags:

Some people collect stamps, some collect coins. I collect bugs in computer algebra systems and this is a particularly amusing one in my opinion. If you evaluate 2^31 using Mathcad’s symbolic engine in version 14 then you get a negative result! It comes up with the following

2^31-> -2147 483648

Note the negative sign! No computer algebra system is perfect but it is not often that you get a bug from such an elementary calculation – shame on you Mathcad! At least it gets the right result if you use its numerical engine

2^31 = 2.147 *10^9

Hopefully PTC will be releasing a bug fix soon.

  1. Ivan
    December 27th, 2008 at 13:53
    Reply | Quote | #1

    I found a problem in mathcad.
    I have a 2×2 matrix D(x) with elements depending on variable x
    Its determinant |D(x)| is a polynomial of 4-th order.
    I solved the determinant symbolically and got four roots ri.
    Two of them are complex conjugate.
    I denoted M=D(ri), and substituted in it one of the complex roots.
    Then I decided to find the determinant |M|. I found that it is not zero, but a complex number. I think it is a bug.
    If I first asked to collect in x the function |D(x)|, save resulting polynomial as a function, and substitute this root in it I get zero.
    I prefer to get the matrix, and I cannot trust mathcad!

  2. mike
    March 4th, 2009 at 03:28
    Reply | Quote | #2

    try this one.

    [u0*e0*ur*er]^1/2

    versus

    ([u0*e0]^1/2)*([ur*er]^1/2))

    where
    u0 = 4*pi*10^-7
    e0 = 8.854*10^-12
    ur = 10
    er = 10

    I was doing some velocity calculations and got a difference between these two expressions! only occurs when using certain numbers.