| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19776 |
\[\frac{e^{0.6931}}{e^{\frac{1}{v} - \log \left(\frac{0.5}{v}\right)}}
\]
(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}}
Results
Initial program 0.1
Taylor expanded in sinTheta_i around 0 0.1
Simplified0.1
Applied egg-rr5.2
Simplified0.1
Applied egg-rr0.1
Taylor expanded in cosTheta_O around 0 0.1
| Alternative 1 | |
|---|---|
| Error | 0.1 |
| Cost | 19776 |
| Alternative 2 | |
|---|---|
| Error | 0.1 |
| Cost | 13376 |
| Alternative 3 | |
|---|---|
| Error | 0.5 |
| Cost | 7104 |
| Alternative 4 | |
|---|---|
| Error | 0.5 |
| Cost | 6592 |
| Alternative 5 | |
|---|---|
| Error | 62.0 |
| Cost | 64 |
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))))))