Blackbody curve to floating RGB
The Open Shading Language has a complete implementation which is based on this source code from Color Rendering of Spectra by John Walker, according to the comments. I can't vouch for its theoretical correctness but I have used it and it appears to work reasonably well.