XMULT Function

XMULT (matrix1, matrix2) ;

The XMULT function computes a matrix product by using extended-precision calculations. For most matrices, the the XMULT function is numerically equivalent to the matrix multiplication operator (*). You should use the XMULT function on pathalogical examples for which extended-precision calculations are required to obtain an accurate product.

The following program demonstrates the use of the XMULT function:

a = 1e13;
b = 1e13;
c = 100*a;
a = a+1;
x = c || a || b || c;
y = c || a || (-b) || (-c);

z = xmult(x,y`);  /* correct answer */
print z [format=16.0];

wrong = x * y`;  /* loss of precision */
print wrong [format=16.0];

Figure 23.376: Extended-Precision Multiplication

z
20000000000001

wrong
0