Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl.y:
+static bool write_cosh_or_sinh(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc, bool sinh_mode)
+{
- struct hlsl_ir_function_decl *func;
- struct hlsl_type *type;
- const char *fn_name, *combiner;
- char *body;
- static const char template[] =
"%s %s(%s x)\n"
"{\n"
" %s expPos, expNeg, combined;"
" expPos = exp(x);\n"
" expNeg = exp(-x);\n"
" combined = %s;\n"
" return combined / 2;\n"
Let's avoid camel case please. That said, though, the function seems simple enough that I'd just write "return (exp(x) ± exp(-x)) / 2"?