0

I'm getting the errors

Col 60: binary operator '/' cannot be applied to two 'Float' operands

Expected an argument list of type '(Double, Double)' (line 62, col 60)

I don't see why I cannot divide the two numbers. I'm working on a project that requires me to run these calculations using single precision values, so I need to use Float here.

The code:

func logC(val: Double, forBase base: Double) -> Float {
    return Float(log(val)/log(base))
}

logC(val: abs((sum1(N: 12100)-sum3(N: 12100))/sum3(N: 12100) ), forBase: 10)

What I've tried:

  1. Casting the result to Float
  2. Casting each parameter in the calculation to Float
loltospoon
  • 239
  • 1
  • 9

0 Answers0