# Why is this a method ambiguity?

**URL:** <https://discourse.julialang.org/t/why-is-this-a-method-ambiguity/1502>\
**Category:** General Usage\
**Created:** [January 16, 2017, 12:12am UTC](https://discourse.julialang.org/t/why-is-this-a-method-ambiguity/1502 "2017-01-16T00:12:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [January 16, 2017, 12:12am UTC](https://discourse.julialang.org/t/why-is-this-a-method-ambiguity/1502/1 "2017-01-16T00:12:26Z")

</div>

I have this type and scaffolding:

```
import Base: convert, promote_rule, show, (*)

immutable FP64 <: AbstractFloat
    fp::Float64
end

show(io::IO, a::FP64) = show(io, a.fp)
promote_rule{T<:AbstractFloat}(::Type{FP64}, ::Type{T}) = FP64

```

When I specify `*` this way, it works.

```
(*)(x::FP64, y::FP64) = (FP64)(x.fp * y.fp)
(*){T<:AbstractFloat}(x::FP64, y::T) = (*)(promote(x, y)...)
(*){T<:AbstractFloat}(x::T, y::FP64) = (*)(promote(x, y)...)

FP64(5.0) * FP64(5.0)
25.0f0

```

When I specify `*` this way , it does not work.  
&nbsp;&nbsp;&nbsp; `(*){T<:FP64}(x::T, y::T) = (T)(*)(x.fp, y.fp)`

```
(*){T<:FP64}(x::T, y::T) = (T)(*)(x.fp, y.fp)        
(*){T<:AbstractFloat}(x::FP64, y::T) = (*)(promote(x, y)...)
(*){T<:AbstractFloat}(x::T, y::FP64) = (*)(promote(x, y)...)

FP64(5.0) * FP64(5.0)
ERROR: MethodError: *(::FP64, ::FP64) is ambiguous. Candidates:
    *{T<:FP64}(x::T, y::T) in Main
    *{T<:AbstractFloat}(x::FP64, y::T) in Main
    *{T<:AbstractFloat}(x::T, y::FP64) in Main

```

What is happening here (v"0.6-dev.2059")?

---

<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:** [January 16, 2017, 12:54am UTC](https://discourse.julialang.org/t/why-is-this-a-method-ambiguity/1502/3 "2017-01-16T00:54:13Z")

</div>

Bug that should be fixed by `jb/subtype` (although it seems like there’s still a different issue there.)

---

<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:** [January 16, 2017, 1:16am UTC](https://discourse.julialang.org/t/why-is-this-a-method-ambiguity/1502/4 "2017-01-16T01:16:45Z")

</div>

Actually seems to be a method table issue and not a type system issue. Reported at [https://github.com/JuliaLang/julia/issues/20056](https://github.com/JuliaLang/julia/issues/20056)
