+ /* ln(10) / ln(2) */ + if (!(coeff = hlsl_new_float_constant(ctx, 0.301029995664f, loc))) + return false;
That's ln(2) / ln(10), right? (Or 1 / log2(10), if you prefer.) I think the constant is a few digits beyond what a float can actually represent, but I suppose that's not a problem.