# ForwardDiff & mul!()

**URL:** https://discourse.julialang.org/t/forwarddiff-mul/28144
**Category:** Numerics
**Created:** [August 28, 2019, 11:47pm UTC](https://discourse.julialang.org/t/forwarddiff-mul/28144 "2019-08-28T23:47:29Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [August 29, 2019, 10:16am UTC](https://discourse.julialang.org/t/forwarddiff-mul/28144/6 "2019-08-29T10:16:33Z")

</div>

ForwardDiff works by operating on dual numbers:

[http://www.juliadiff.org/ForwardDiff.jl/latest/dev/how\_it\_works.html](http://www.juliadiff.org/ForwardDiff.jl/latest/dev/how_it_works.html)

As I said, you should either consider using non-modifying versions of these functions, or (if you are feeling adventurous) pre-allocate buffers of the correct type. It is better to do this for an inner loop only, where the outer part will know the type (`Dual` has a type tag).

To help with the latter, it would be great to have a full MWE.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

_[View the full topic](https://discourse.julialang.org/t/forwarddiff-mul/28144)._
