?

Average Error: 0.0 → 0.4
Time: 1.2min
Precision: binary64
Cost: 6848

?

\[\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)} \]
\[e^{\frac{cosTheta_i \cdot cosTheta_O - 1}{v}} \]
(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 (/ (- (* cosTheta_i cosTheta_O) 1.0) v)))
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((((cosTheta_i * cosTheta_O) - 1.0) / v));
}
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((((costheta_i * costheta_o) - 1.0d0) / v))
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((((cosTheta_i * cosTheta_O) - 1.0) / v));
}
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((((cosTheta_i * cosTheta_O) - 1.0) / v))
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 exp(Float64(Float64(Float64(cosTheta_i * cosTheta_O) - 1.0) / v))
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((((cosTheta_i * cosTheta_O) - 1.0) / v));
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[Exp[N[(N[(N[(cosTheta$95$i * cosTheta$95$O), $MachinePrecision] - 1.0), $MachinePrecision] / v), $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)}
e^{\frac{cosTheta_i \cdot cosTheta_O - 1}{v}}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.0

    \[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. Simplified0.0

    \[\leadsto \color{blue}{e^{\left(0.6931 + \frac{\left(cosTheta_O \cdot cosTheta_i - sinTheta_O \cdot sinTheta_i\right) - 1}{v}\right) + \log \left(\frac{0.5}{v}\right)}} \]
    Proof
  3. Taylor expanded in cosTheta_O around inf 0.0

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

    \[\leadsto e^{\color{blue}{\frac{cosTheta_i \cdot cosTheta_O - 1}{v}} + \log \left(\frac{0.5}{v}\right)} \]
  5. Taylor expanded in v around 0 0.4

    \[\leadsto e^{\color{blue}{\frac{cosTheta_i \cdot cosTheta_O - 1}{v}}} \]

Alternatives

Alternative 1
Error29.0
Cost6980
\[\begin{array}{l} t_0 := \frac{cosTheta_i \cdot cosTheta_O}{v}\\ \mathbf{if}\;cosTheta_i \cdot cosTheta_O \leq -8.6 \cdot 10^{-283}:\\ \;\;\;\;e^{t_0}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error33.9
Cost320
\[\frac{cosTheta_i \cdot cosTheta_O}{v} \]
Alternative 3
Error62.0
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023033 
(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))))))