# Use different methods depending on presence of FMA

**URL:** <https://discourse.julialang.org/t/use-different-methods-depending-on-presence-of-fma/4533>\
**Category:** Internals & Design\
**Created:** [June 29, 2017, 5:01am UTC](https://discourse.julialang.org/t/use-different-methods-depending-on-presence-of-fma/4533 "2017-06-29T05:01:51Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [June 30, 2017, 3:49pm UTC](https://discourse.julialang.org/t/use-different-methods-depending-on-presence-of-fma/4533/21 "2017-06-30T15:49:29Z")

</div>

There’s nothing in principle stopping it from inlining.

---

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [July 1, 2017, 8:43am UTC](https://discourse.julialang.org/t/use-different-methods-depending-on-presence-of-fma/4533/22 "2017-07-01T08:43:28Z")

</div>

OK. Thanks!

Then I guess I’ll do something like this:

```julia
@noinline muladd_test(e) = muladd(one(e)+e,-one(e)+e,one(e)) == e*e
for T in [Float16, Float32, Float64, BigFloat]
  @eval has_fast_fma(::Type{$T}) = $(muladd_test(eps(T)))
end

```

(But I will probably name the function `muladd_is_fma` rather than `has_fast_fma` as the two concepts are somewhat disjoint.)

[Previous page](https://discourse.julialang.org/t/use-different-methods-depending-on-presence-of-fma/4533.md?page=1)
