Hi,

I think this does what you want:

function sum{T<:FloatingPoint}(x::Array{T,1})
  println("hi")
end

Cheers,

Rene






Am 18.08.2015 um 11:22 schrieb Uwe Fechner <uwe.fechner....@gmail.com>:

> Ok, the following definition works on Julia 0.4, but not with 0.3:
> 
> FloatArray = Union{Array{Float32, 1}, Array{Float64, 1}}
> 
> function sum(x::FloatArray).
> 
> Any idea?
> 
> Am Dienstag, 18. August 2015 11:07:16 UTC+2 schrieb Uwe Fechner:
> Hello,
> 
> I want to write a function, that can operate on any one dimensional array of 
> floating point numbers.
> 
> The following works, but only for Float64:
> 
> function sum(x::Array{Float64,1})
> 
> The following does not work:
> 
> function sum(x::Array{AbstractFloat,1})
> 
> Any idea?
> 
> Uwe

Reply via email to