Average Error: 14.5 → 4.0
Time: 19.8s
Precision: 64
$\frac{{\alpha}^{2}}{\pi \cdot {\left({NdotH}^{2} \cdot \left({\alpha}^{2} - 1\right) + 1\right)}^{2}}$
$\frac{\frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)} \cdot \frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)}}{\pi}$
\frac{{\alpha}^{2}}{\pi \cdot {\left({NdotH}^{2} \cdot \left({\alpha}^{2} - 1\right) + 1\right)}^{2}}
\frac{\frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)} \cdot \frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)}}{\pi}
double f(double alpha, double NdotH) {
double r15188354 = alpha;
double r15188355 = 2.0;
double r15188356 = pow(r15188354, r15188355);
double r15188357 = atan2(1.0, 0.0);
double r15188358 = NdotH;
double r15188359 = pow(r15188358, r15188355);
double r15188360 = 1.0;
double r15188361 = r15188356 - r15188360;
double r15188362 = r15188359 * r15188361;
double r15188363 = r15188362 + r15188360;
double r15188364 = pow(r15188363, r15188355);
double r15188365 = r15188357 * r15188364;
double r15188366 = r15188356 / r15188365;
return r15188366;
}


double f(double alpha, double NdotH) {
double r15188367 = alpha;
double r15188368 = 1.0;
double r15188369 = r15188367 * r15188367;
double r15188370 = r15188369 - r15188368;
double r15188371 = NdotH;
double r15188372 = r15188371 * r15188371;
double r15188373 = r15188370 * r15188372;
double r15188374 = r15188368 + r15188373;
double r15188375 = r15188367 / r15188374;
double r15188376 = r15188375 * r15188375;
double r15188377 = atan2(1.0, 0.0);
double r15188378 = r15188376 / r15188377;
return r15188378;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 14.5

$\frac{{\alpha}^{2}}{\pi \cdot {\left({NdotH}^{2} \cdot \left({\alpha}^{2} - 1\right) + 1\right)}^{2}}$
2. Simplified13.5

$\leadsto \color{blue}{\frac{\frac{\alpha \cdot \alpha}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}{\pi \cdot \left(\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1\right)}}$
3. Using strategy rm
4. Applied *-un-lft-identity13.5

$\leadsto \frac{\frac{\alpha \cdot \alpha}{\color{blue}{1 \cdot \left(\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1\right)}}}{\pi \cdot \left(\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1\right)}$
5. Applied times-frac4.0

$\leadsto \frac{\color{blue}{\frac{\alpha}{1} \cdot \frac{\alpha}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}}{\pi \cdot \left(\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1\right)}$
6. Applied times-frac4.6

$\leadsto \color{blue}{\frac{\frac{\alpha}{1}}{\pi} \cdot \frac{\frac{\alpha}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}$
7. Simplified4.6

$\leadsto \color{blue}{\frac{\alpha}{\pi}} \cdot \frac{\frac{\alpha}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}$
8. Using strategy rm
9. Applied associate-*l/4.6

$\leadsto \color{blue}{\frac{\alpha \cdot \frac{\frac{\alpha}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}{\left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right) + 1}}{\pi}}$
10. Simplified4.0

$\leadsto \frac{\color{blue}{\frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)} \cdot \frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)}}}{\pi}$
11. Final simplification4.0

$\leadsto \frac{\frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)} \cdot \frac{\alpha}{1 + \left(\alpha \cdot \alpha - 1\right) \cdot \left(NdotH \cdot NdotH\right)}}{\pi}$

# Reproduce

herbie shell --seed 1
(FPCore (alpha NdotH)
:name "pow(alpha,2)/(PI*pow(pow(NdotH, 2)*(pow(alpha,2)-1)+1,2))"
(/ (pow alpha 2) (* PI (pow (+ (* (pow NdotH 2) (- (pow alpha 2) 1)) 1) 2))))