# Fastmath and forwarddiff

**URL:** <https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934>\
**Category:** General Usage\
**Tags:** forwarddiff, fast-math\
**Created:** [March 24, 2018, 1:40am UTC](https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934 "2018-03-24T01:40:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Post date:** [March 24, 2018, 1:40am UTC](https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934/1 "2018-03-24T01:40:27Z")

</div>

Is there a straightforward way to combine `@fastmath` with `ForwardDiff`? The idea is that I might define a function f(x) using `@fastmath` and I then want to evaluate `f'(x)` using `ForwardDiff`. My naive attempt generates an error.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 24, 2018, 1:43am UTC](https://discourse.julialang.org/t/fastmath-and-forwarddiff/9934/2 "2018-03-24T01:43:00Z")

</div>

Can you post your code and the error?
