# Specifying argument types: Array{Float64, Integer}

**URL:** <https://discourse.julialang.org/t/specifying-argument-types-array-float64-integer/14711>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [September 8, 2018, 7:33pm UTC](https://discourse.julialang.org/t/specifying-argument-types-array-float64-integer/14711 "2018-09-08T19:33:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacob-roth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jacob-roth/32/1862_2.png) [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Post date:** [September 8, 2018, 7:33pm UTC](https://discourse.julialang.org/t/specifying-argument-types-array-float64-integer/14711/1 "2018-09-08T19:33:16Z")

</div>

I want to pass a `test` function an array of which can be either `Float64` or `Float32` data and have `1,2, ...` dimensions. I tried specifying the input argument as an array of type `Array{Float64, Integer}` but this didn’t work. What am I missing? Thanks!

```julia
x = Array{Float64, 1}([1, 2])
X = Array{Float64, 2}([1.0 1.0; 2.0 2.0])

isa(x, Array{Float64, Integer}) # false
isa(X, Array{Float64, Integer}) # false
isa(x, Array{Float64, 1}) # true
isa(X, Array{Float64, 2}) # true

const FloatData = Union{Float32, Float64}
function test(A :: Array{T, Ti}) where {T <: FloatData, Ti <: Integer}
    println(typeof(A))
end

test(x)
test(X)

```

---

<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:** [September 8, 2018, 8:02pm UTC](https://discourse.julialang.org/t/specifying-argument-types-array-float64-integer/14711/2 "2018-09-08T20:02:06Z")

</div>

`1` and `2` are values, not types, and `1 <: Integer` is not true, nor is `2 <: Integer`, so your `where {..., Ti <: Integer}` isn’t doing what you want.

What you are trying to specify is something like `where {T <: FloatData, Ti::Integer}`. That’s not possible in the language currently. Fortunately, it’s also completely unnecessary in this case, as you can just leave that parameter free with no performance impact. All of the following will work:

```julia
julia> function test1(A::Array{T, N}) where {T <: FloatData, N}
         typeof(A)
       end
test1 (generic function with 1 method)

julia> function test2(A::Array{T}) where {T <: FloatData}
         typeof(A)
       end
test2 (generic function with 1 method)

julia> function test3(A::Array{<:FloatData})
         typeof(A)
       end

```
