Average Error: 0.1 → 0.1
Time: 26.5s
Precision: binary64
Cost: 32640
\[\left(\left(\left(\left(-1 \leq cosTheta_i \land cosTheta_i \leq 1\right) \land \left(-1 \leq cosTheta_O \land cosTheta_O \leq 1\right)\right) \land \left(-1 \leq sinTheta_i \land sinTheta_i \leq 1\right)\right) \land \left(-1 \leq sinTheta_O \land sinTheta_O \leq 1\right)\right) \land \left(-1.5707964 \leq v \land v \leq 0.1\right)\]
\[e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)} \]
\[\frac{e^{0.6931}}{{\left(\sqrt{e^{\frac{1}{v} - \log \left(\frac{0.5}{v}\right)}}\right)}^{2}} \]
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
 :precision binary64
 (exp
  (+
   (+
    (-
     (- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v))
     (/ 1.0 v))
    0.6931)
   (log (/ 1.0 (* 2.0 v))))))
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
 :precision binary64
 (/ (exp 0.6931) (pow (sqrt (exp (- (/ 1.0 v) (log (/ 0.5 v))))) 2.0)))
double code(double cosTheta_i, double cosTheta_O, double sinTheta_i, double sinTheta_O, double v) {
	return exp(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0 / v)) + 0.6931) + log((1.0 / (2.0 * v)))));
}
double code(double cosTheta_i, double cosTheta_O, double sinTheta_i, double sinTheta_O, double v) {
	return exp(0.6931) / pow(sqrt(exp(((1.0 / v) - log((0.5 / v))))), 2.0);
}
real(8) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
    real(8), intent (in) :: costheta_i
    real(8), intent (in) :: costheta_o
    real(8), intent (in) :: sintheta_i
    real(8), intent (in) :: sintheta_o
    real(8), intent (in) :: v
    code = exp(((((((costheta_i * costheta_o) / v) - ((sintheta_i * sintheta_o) / v)) - (1.0d0 / v)) + 0.6931d0) + log((1.0d0 / (2.0d0 * v)))))
end function
real(8) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
    real(8), intent (in) :: costheta_i
    real(8), intent (in) :: costheta_o
    real(8), intent (in) :: sintheta_i
    real(8), intent (in) :: sintheta_o
    real(8), intent (in) :: v
    code = exp(0.6931d0) / (sqrt(exp(((1.0d0 / v) - log((0.5d0 / v))))) ** 2.0d0)
end function
public static double code(double cosTheta_i, double cosTheta_O, double sinTheta_i, double sinTheta_O, double v) {
	return Math.exp(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0 / v)) + 0.6931) + Math.log((1.0 / (2.0 * v)))));
}
public static double code(double cosTheta_i, double cosTheta_O, double sinTheta_i, double sinTheta_O, double v) {
	return Math.exp(0.6931) / Math.pow(Math.sqrt(Math.exp(((1.0 / v) - Math.log((0.5 / v))))), 2.0);
}
def code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v):
	return math.exp(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0 / v)) + 0.6931) + math.log((1.0 / (2.0 * v)))))
def code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v):
	return math.exp(0.6931) / math.pow(math.sqrt(math.exp(((1.0 / v) - math.log((0.5 / v))))), 2.0)
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	return exp(Float64(Float64(Float64(Float64(Float64(Float64(cosTheta_i * cosTheta_O) / v) - Float64(Float64(sinTheta_i * sinTheta_O) / v)) - Float64(1.0 / v)) + 0.6931) + log(Float64(1.0 / Float64(2.0 * v)))))
end
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	return Float64(exp(0.6931) / (sqrt(exp(Float64(Float64(1.0 / v) - log(Float64(0.5 / v))))) ^ 2.0))
end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	tmp = exp(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0 / v)) + 0.6931) + log((1.0 / (2.0 * v)))));
end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v)
	tmp = exp(0.6931) / (sqrt(exp(((1.0 / v) - log((0.5 / v))))) ^ 2.0);
end
code[cosTheta$95$i_, cosTheta$95$O_, sinTheta$95$i_, sinTheta$95$O_, v_] := N[Exp[N[(N[(N[(N[(N[(N[(cosTheta$95$i * cosTheta$95$O), $MachinePrecision] / v), $MachinePrecision] - N[(N[(sinTheta$95$i * sinTheta$95$O), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision] - N[(1.0 / v), $MachinePrecision]), $MachinePrecision] + 0.6931), $MachinePrecision] + N[Log[N[(1.0 / N[(2.0 * v), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[cosTheta$95$i_, cosTheta$95$O_, sinTheta$95$i_, sinTheta$95$O_, v_] := N[(N[Exp[0.6931], $MachinePrecision] / N[Power[N[Sqrt[N[Exp[N[(N[(1.0 / v), $MachinePrecision] - N[Log[N[(0.5 / v), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)}
\frac{e^{0.6931}}{{\left(\sqrt{e^{\frac{1}{v} - \log \left(\frac{0.5}{v}\right)}}\right)}^{2}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[e^{\left(\left(\left(\frac{cosTheta_i \cdot cosTheta_O}{v} - \frac{sinTheta_i \cdot sinTheta_O}{v}\right) - \frac{1}{v}\right) + 0.6931\right) + \log \left(\frac{1}{2 \cdot v}\right)} \]
  2. Taylor expanded in sinTheta_i around 0 0.1

    \[\leadsto \color{blue}{e^{\left(0.6931 + \left(\log \left(\frac{0.5}{v}\right) + \frac{cosTheta_i \cdot cosTheta_O}{v}\right)\right) - \frac{1}{v}}} \]
  3. Simplified0.1

    \[\leadsto \color{blue}{e^{\left(\left(0.6931 + \log \left(\frac{0.5}{v}\right)\right) + \frac{cosTheta_i \cdot cosTheta_O}{v}\right) - \frac{1}{v}}} \]
    Proof
  4. Applied egg-rr5.2

    \[\leadsto \color{blue}{\frac{e^{0.6931}}{\frac{e^{\frac{1}{v}}}{e^{\mathsf{fma}\left(cosTheta_O, \frac{cosTheta_i}{v}, \log \left(\frac{0.5}{v}\right)\right)}}}} \]
  5. Simplified0.1

    \[\leadsto \color{blue}{\frac{e^{0.6931}}{e^{\frac{1}{v} - \mathsf{fma}\left(cosTheta_O, \frac{cosTheta_i}{v}, \log \left(\frac{0.5}{v}\right)\right)}}} \]
    Proof
  6. Applied egg-rr0.1

    \[\leadsto \frac{e^{0.6931}}{\color{blue}{{\left(\sqrt{e^{\frac{1 - cosTheta_O \cdot cosTheta_i}{v} - \log \left(\frac{0.5}{v}\right)}}\right)}^{2}}} \]
  7. Taylor expanded in cosTheta_O around 0 0.1

    \[\leadsto \frac{e^{0.6931}}{{\left(\sqrt{e^{\color{blue}{\frac{1}{v} - \log \left(\frac{0.5}{v}\right)}}}\right)}^{2}} \]

Alternatives

Alternative 1
Error0.1
Cost19776
\[\frac{e^{0.6931}}{e^{\frac{1}{v} - \log \left(\frac{0.5}{v}\right)}} \]
Alternative 2
Error0.1
Cost13376
\[e^{\left(0.6931 + \log \left(\frac{0.5}{v}\right)\right) - \frac{1}{v}} \]
Alternative 3
Error0.5
Cost7104
\[e^{\frac{\left(cosTheta_i \cdot cosTheta_O\right) \cdot v - v}{v \cdot v}} \]
Alternative 4
Error0.5
Cost6592
\[e^{\frac{-1}{v}} \]
Alternative 5
Error62.0
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
  :name "HairBSDF, Mp, lower"
  :precision binary64
  :pre (and (and (and (and (and (<= -1.0 cosTheta_i) (<= cosTheta_i 1.0)) (and (<= -1.0 cosTheta_O) (<= cosTheta_O 1.0))) (and (<= -1.0 sinTheta_i) (<= sinTheta_i 1.0))) (and (<= -1.0 sinTheta_O) (<= sinTheta_O 1.0))) (and (<= -1.5707964 v) (<= v 0.1)))
  (exp (+ (+ (- (- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v)) (/ 1.0 v)) 0.6931) (log (/ 1.0 (* 2.0 v))))))