Average Error: 0.2 → 0.2
Time: 20.9s
Precision: 64
\[\left(0 \le ndoth \land ndoth \le 1\right) \land \left(0.0 \le roughness \land roughness \le 1\right)\]
\[\frac{{roughness}^{2}}{\pi \cdot {\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2}}\]
\[\frac{{roughness}^{2}}{{\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2} \cdot \pi}\]
\frac{{roughness}^{2}}{\pi \cdot {\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2}}
\frac{{roughness}^{2}}{{\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2} \cdot \pi}
double f(double roughness, double ndoth) {
        double r12307989 = roughness;
        double r12307990 = 2.0;
        double r12307991 = pow(r12307989, r12307990);
        double r12307992 = atan2(1.0, 0.0);
        double r12307993 = ndoth;
        double r12307994 = r12307993 * r12307991;
        double r12307995 = r12307994 - r12307993;
        double r12307996 = r12307995 * r12307993;
        double r12307997 = 1.0;
        double r12307998 = r12307996 + r12307997;
        double r12307999 = pow(r12307998, r12307990);
        double r12308000 = r12307992 * r12307999;
        double r12308001 = r12307991 / r12308000;
        return r12308001;
}

double f(double roughness, double ndoth) {
        double r12308002 = roughness;
        double r12308003 = 2.0;
        double r12308004 = pow(r12308002, r12308003);
        double r12308005 = ndoth;
        double r12308006 = r12308005 * r12308004;
        double r12308007 = r12308006 - r12308005;
        double r12308008 = r12308007 * r12308005;
        double r12308009 = 1.0;
        double r12308010 = r12308008 + r12308009;
        double r12308011 = pow(r12308010, r12308003);
        double r12308012 = atan2(1.0, 0.0);
        double r12308013 = r12308011 * r12308012;
        double r12308014 = r12308004 / r12308013;
        return r12308014;
}

Error

Bits error versus roughness

Bits error versus ndoth

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

    \[\frac{{roughness}^{2}}{\pi \cdot {\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2}}\]
  2. Final simplification0.2

    \[\leadsto \frac{{roughness}^{2}}{{\left(\left(ndoth \cdot {roughness}^{2} - ndoth\right) \cdot ndoth + 1\right)}^{2} \cdot \pi}\]

Reproduce

herbie shell --seed 1 
(FPCore (roughness ndoth)
  :name "pow(roughness, 2) / (PI * pow((ndoth * pow(roughness, 2) - ndoth) * ndoth + 1, 2))"
  :pre (and (and (<= 0 ndoth) (<= ndoth 1)) (and (<= 0.0 roughness) (<= roughness 1)))
  (/ (pow roughness 2) (* PI (pow (+ (* (- (* ndoth (pow roughness 2)) ndoth) ndoth) 1) 2))))