Is there a way to create a Double
from an AlgebraicField
or Real
type?
I have a use case where a have a function like
func f<X: AlgebraicField>(_ x: X, minimum a: X, peak b: X, maximum c: X) -> Double {
switch x {
case a...b: return (x - a) / (b - a)
case b...c: return (c - u) / (x - b)
default: return 0
}
}
where I have constraint X: AlgebraicField
but at the same time I need to be sure that I return a Double
.