I am trying to find the polynomial value from pr. Here is my code:
let x = Double(pr)
let x2 : Double = pow(x, 2.0)
let x3 : Double = pow(x, 3.0)
let x4 : Double = pow(x, 4.0)
let r = CGFloat( 4.8 * x4 - 10.4 * x3 + 5.7 * x2 + 1.05 * x + 0.95 )
let g = CGFloat( 4.8 * x4 - 8.8 * x3 + 3.3 * x2 + 1.65 * x + 0.0 )
let b = CGFloat(0.0)
let color = UIColor(red: r, green: g, blue: b, alpha: 1.0)
return color.CGColor
Not much to explain, it just gives an error compliers: "Could not find an overload for the" - "that receives the provided arguments I also tried to use. powf(x, 2)The types float everywhere. pr- a function CGFloatHere is a screenshot:.
.
Thank!
source
share