# [petsc-users] Round-off / Machine Zero with MatMult

Paul Urbanczyk gomer at stanford.edu
Fri Jun 17 19:05:37 CDT 2016

```Sure... I understand that floating point calculations will not always
yield exact zero for a number of reasons.

The question I have is why some of the results are exactly zero and
others are not. I.e. why aren't the numbers all the same? What is
different about the calculation in rows 0, 1, 8, and 9 from the other
rows (2, 3, 4, 5, 6, 7)?

Thanks,

Paul

On 06/17/2016 01:06 PM, Matthew Knepley wrote:
> On Fri, Jun 17, 2016 at 2:47 PM, Paul Urbanczyk <gomer at stanford.edu
> <mailto:gomer at stanford.edu>> wrote:
>
>     Hello all,
>
>     I'm using PETSc's "MatMult" function - MatMult(Mat A, Vec x, Vec
>     y) - to do a matrix-vector multiply. The Matrix, A, is
>     anti-symmetric, and the vector, x, is uniform. Thus, the resulting
>     vector, y, should be all zeros.
>
>     The output I'm seeing typically looks like the following:
>
>     Vec Object: Vec_0x20b2000_2 1 MPI processes
>       type: mpi
>     Process [0]
>     0.
>     0.
>     -2.08167e-17
>     -2.08167e-17
>     -2.08167e-17
>     -2.08167e-17
>     -2.08167e-17
>     -2.08167e-17
>     0.
>     0.
>
>     Now, I know that -2.08167e-17 is machine zero, but I'm a bit
>     confused why a few of the entries would be exactly zero while
>     others are "machine zero." I would expect them all to be either
>     exactly zero, or machine zero, but not a mixture. Do you have any
>     idea why this might be?
>
>
> The order of addition matter for roundoff errors.
>
>   Thanks,
>
>     Matt
>
>
>     -Paul
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which