title: Function should return float, but it gets messed up!
body: <p>I'm going crazy here.</p>
  
  <p>I have a function that should return a float number:</p>
  
  <pre><code>- (float) getHue:(UIColor *)original
  {
      NSLog(@"getHue");
      const CGFloat *componentColors = CGColorGetComponents(original.CGColor);
  
      float red = componentColors[0];
      float green = componentColors[1];
      float blue = componentColors[2];
  
      float h = 0.0f;
      float maxChannel = fmax(red, fmax(green, blue));
      float minChannel = fmin(red, fmin(green, blue));
      if (maxChannel == minChannel)
          h = 0.0f;
      else if (maxChannel == red)
          h = 0.166667f * (green - blue) / (maxChannel - minChannel) + 0.000000f;
      else if (maxChannel == green)
          h = 0.166667f * (blue - red) / (maxChannel - minChannel) + 0.333333f;
      else if (maxChannel == blue)
          h = 0.166667f * (red - green) / (maxChannel - minChannel) + 0.666667f;
      else
          h = 0.0f;
  
      if (h &lt; 0.0f)
          h += 1.0f;
  
      NSLog(@"getHue results: %f", h);
  
      return h;
  }
  </code></pre>
  
  <p>The NSLog will trace it correctly (i.e: 0.005), but the actual return value of the function is NULL.</p>
  
  <p>I've tried getting that value in so many ways and it never works.</p>
  
  <pre><code>float originalHue = [self getHue:original];
  </code></pre>
  
  <p>results in a building error, as it says: "incompatible types in initialization"</p>
  
  <pre><code>float *originalHue = [self getHue:original];
  </code></pre>
  
  <p>results in a null return.</p>
  
  <p>I've tried other ways, but it never actually gets the value properly.</p>
  
  <p>Any thoughts?</p>
  
  <p>Cheers guys,
  Andre</p>