I’m using this code to try to convert Kelvin to RGB. Perhaps the math is too heavy? It’s causing a kernel panic.

```
//Algorithm from http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
int temp = tempInKelvin / 100;
if (temp <= 66) {
answer.red = 255;
answer.blue = 255;
answer.green = 99.4708025861 * log(answer.green) - 161.1195681661;
}
else
{
answer.red = 329.698727446 * pow((temp - 60),-0.1332047592);
answer.blue = 138.5177312231 * log(temp - 60) - 305.0447927307;
answer.green = 288.1221695283 * pow((temp - 60),-0.0755148492);
}
answer.red = (answer.red < 0) ? 0 : answer.red;
answer.red = (answer.red > 255) ? 255 : answer.red;
answer.blue = (answer.blue < 0) ? 0 : answer.blue;
answer.blue = (answer.blue > 255) ? 255 : answer.blue;
answer.green = (answer.green < 0) ? 0 : answer.green;
answer.green = (answer.green > 255) ? 255 : answer.green;
return answer;
```