Given the type Tv <: FloatingPoint how can I automatically convert
variable x::FloatingPoint to Tv?

For me the most intuitive way is to write Tv(x), but this doesn't
work. Currently I perform the check:

y = Tv == Float32 ? float32(x) : float64(x)

but are there any options? In general case I may not now that the
parent type (FloatingPoint in this case) has only two implementations
and that they have particular converting functions like float32 or
float64.

Reply via email to