# A\_mul\_B! deviates from C = A\*B with complex numbers

**URL:** <https://discourse.julialang.org/t/a-mul-b-deviates-from-c-a-b-with-complex-numbers/10165>\
**Category:** New to Julia\
**Tags:** linearalgebra, complex-numbers\
**Created:** [April 4, 2018, 10:56pm UTC](https://discourse.julialang.org/t/a-mul-b-deviates-from-c-a-b-with-complex-numbers/10165 "2018-04-04T22:56:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [April 5, 2018, 12:24am UTC](https://discourse.julialang.org/t/a-mul-b-deviates-from-c-a-b-with-complex-numbers/10165/2 "2018-04-05T00:24:01Z")

</div>

The order of operations matters in floating point world.

```julia
julia> result3 = H * (-im*Δt*v);

julia> norm(result3 - result2)
0.0

```

Edit: as an extreme example:

```julia
julia> 1e16 + 1.0 - 1e16
0.0

julia> 1e16 - 1e16 + 1.0
1.0

```

and see [PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678).

By the way, you may want to consider using OrdinaryDiffEq.jl (part of [DifferentialEquations.jl](https://github.com/JuliaDiffEq/DifferentialEquations.jl)) if you’re solving ODEs, for a vast array of integrators that are highly optimized and tested for accuracy.

---

_[View the full topic](https://discourse.julialang.org/t/a-mul-b-deviates-from-c-a-b-with-complex-numbers/10165)._
