
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(exp
(+
(+
(-
(- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v))
(/ 1.0 v))
0.6931)
(log (/ 1.0 (* 2.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0f / v)) + 0.6931f) + logf((1.0f / (2.0f * v)))));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = exp(((((((costheta_i * costheta_o) / v) - ((sintheta_i * sintheta_o) / v)) - (1.0e0 / v)) + 0.6931e0) + log((1.0e0 / (2.0e0 * v)))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(Float32(Float32(Float32(Float32(Float32(cosTheta_i * cosTheta_O) / v) - Float32(Float32(sinTheta_i * sinTheta_O) / v)) - Float32(Float32(1.0) / v)) + Float32(0.6931)) + log(Float32(Float32(1.0) / Float32(Float32(2.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)) - (single(1.0) / v)) + single(0.6931)) + log((single(1.0) / (single(2.0) * v))))); end
\begin{array}{l}
\\
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)}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(exp
(+
(+
(-
(- (/ (* cosTheta_i cosTheta_O) v) (/ (* sinTheta_i sinTheta_O) v))
(/ 1.0 v))
0.6931)
(log (/ 1.0 (* 2.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((((((cosTheta_i * cosTheta_O) / v) - ((sinTheta_i * sinTheta_O) / v)) - (1.0f / v)) + 0.6931f) + logf((1.0f / (2.0f * v)))));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = exp(((((((costheta_i * costheta_o) / v) - ((sintheta_i * sintheta_o) / v)) - (1.0e0 / v)) + 0.6931e0) + log((1.0e0 / (2.0e0 * v)))))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(Float32(Float32(Float32(Float32(Float32(cosTheta_i * cosTheta_O) / v) - Float32(Float32(sinTheta_i * sinTheta_O) / v)) - Float32(Float32(1.0) / v)) + Float32(0.6931)) + log(Float32(Float32(1.0) / Float32(Float32(2.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)) - (single(1.0) / v)) + single(0.6931)) + log((single(1.0) / (single(2.0) * v))))); end
\begin{array}{l}
\\
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)}
\end{array}
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (cbrt (log (/ 0.5 v)))))
(*
(pow (exp (+ (exp (log1p (pow t_0 2.0))) -1.0)) t_0)
(exp
(+
(-
(* cosTheta_i (/ cosTheta_O v))
(fma sinTheta_i (/ sinTheta_O v) (/ 1.0 v)))
0.6931)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = cbrtf(logf((0.5f / v)));
return powf(expf((expf(log1pf(powf(t_0, 2.0f))) + -1.0f)), t_0) * expf((((cosTheta_i * (cosTheta_O / v)) - fmaf(sinTheta_i, (sinTheta_O / v), (1.0f / v))) + 0.6931f));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = cbrt(log(Float32(Float32(0.5) / v))) return Float32((exp(Float32(exp(log1p((t_0 ^ Float32(2.0)))) + Float32(-1.0))) ^ t_0) * exp(Float32(Float32(Float32(cosTheta_i * Float32(cosTheta_O / v)) - fma(sinTheta_i, Float32(sinTheta_O / v), Float32(Float32(1.0) / v))) + Float32(0.6931)))) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\log \left(\frac{0.5}{v}\right)}\\
{\left(e^{e^{\mathsf{log1p}\left({t\_0}^{2}\right)} + -1}\right)}^{t\_0} \cdot e^{\left(cosTheta\_i \cdot \frac{cosTheta\_O}{v} - \mathsf{fma}\left(sinTheta\_i, \frac{sinTheta\_O}{v}, \frac{1}{v}\right)\right) + 0.6931}
\end{array}
\end{array}
Initial program 99.6%
+-commutative99.6%
exp-sum99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
add-exp-log99.6%
add-cube-cbrt99.7%
exp-prod99.7%
pow299.7%
Applied egg-rr99.7%
expm1-log1p-u99.7%
expm1-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (cbrt (log (/ 0.5 v)))))
(*
(pow (exp (pow t_0 2.0)) t_0)
(exp (+ (+ 0.6931 (/ (* cosTheta_i cosTheta_O) v)) (/ -1.0 v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = cbrtf(logf((0.5f / v)));
return powf(expf(powf(t_0, 2.0f)), t_0) * expf(((0.6931f + ((cosTheta_i * cosTheta_O) / v)) + (-1.0f / v)));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = cbrt(log(Float32(Float32(0.5) / v))) return Float32((exp((t_0 ^ Float32(2.0))) ^ t_0) * exp(Float32(Float32(Float32(0.6931) + Float32(Float32(cosTheta_i * cosTheta_O) / v)) + Float32(Float32(-1.0) / v)))) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\log \left(\frac{0.5}{v}\right)}\\
{\left(e^{{t\_0}^{2}}\right)}^{t\_0} \cdot e^{\left(0.6931 + \frac{cosTheta\_i \cdot cosTheta\_O}{v}\right) + \frac{-1}{v}}
\end{array}
\end{array}
Initial program 99.6%
+-commutative99.6%
exp-sum99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
add-exp-log99.6%
add-cube-cbrt99.7%
exp-prod99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in sinTheta_i around 0 99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (sqrt (/ 0.5 v))))
(*
t_0
(*
(exp
(+
0.6931
(+
(/ (- (* cosTheta_i cosTheta_O) (* sinTheta_i sinTheta_O)) v)
(/ -1.0 v))))
t_0))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = sqrtf((0.5f / v));
return t_0 * (expf((0.6931f + ((((cosTheta_i * cosTheta_O) - (sinTheta_i * sinTheta_O)) / v) + (-1.0f / v)))) * t_0);
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
real(4) :: t_0
t_0 = sqrt((0.5e0 / v))
code = t_0 * (exp((0.6931e0 + ((((costheta_i * costheta_o) - (sintheta_i * sintheta_o)) / v) + ((-1.0e0) / v)))) * t_0)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = sqrt(Float32(Float32(0.5) / v)) return Float32(t_0 * Float32(exp(Float32(Float32(0.6931) + Float32(Float32(Float32(Float32(cosTheta_i * cosTheta_O) - Float32(sinTheta_i * sinTheta_O)) / v) + Float32(Float32(-1.0) / v)))) * t_0)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = sqrt((single(0.5) / v)); tmp = t_0 * (exp((single(0.6931) + ((((cosTheta_i * cosTheta_O) - (sinTheta_i * sinTheta_O)) / v) + (single(-1.0) / v)))) * t_0); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{0.5}{v}}\\
t\_0 \cdot \left(e^{0.6931 + \left(\frac{cosTheta\_i \cdot cosTheta\_O - sinTheta\_i \cdot sinTheta\_O}{v} + \frac{-1}{v}\right)} \cdot t\_0\right)
\end{array}
\end{array}
Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-+r+99.6%
fma-define99.6%
prod-exp99.6%
add-exp-log99.6%
add-sqr-sqrt99.7%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (exp (+ (+ 0.6931 (/ (* cosTheta_i cosTheta_O) v)) (/ -1.0 v))) (* 0.5 (exp (- (log v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((0.6931f + ((cosTheta_i * cosTheta_O) / v)) + (-1.0f / v))) * (0.5f * expf(-logf(v)));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = exp(((0.6931e0 + ((costheta_i * costheta_o) / v)) + ((-1.0e0) / v))) * (0.5e0 * exp(-log(v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(exp(Float32(Float32(Float32(0.6931) + Float32(Float32(cosTheta_i * cosTheta_O) / v)) + Float32(Float32(-1.0) / v))) * Float32(Float32(0.5) * exp(Float32(-log(v))))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp(((single(0.6931) + ((cosTheta_i * cosTheta_O) / v)) + (single(-1.0) / v))) * (single(0.5) * exp(-log(v))); end
\begin{array}{l}
\\
e^{\left(0.6931 + \frac{cosTheta\_i \cdot cosTheta\_O}{v}\right) + \frac{-1}{v}} \cdot \left(0.5 \cdot e^{-\log v}\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
exp-sum99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
add-exp-log99.6%
add-cube-cbrt99.7%
exp-prod99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in v around 0 99.7%
mul-1-neg99.7%
log-rec99.7%
exp-sum99.7%
rem-exp-log99.7%
log-rec99.7%
associate--l+99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
associate-/l*99.7%
fma-undefine99.7%
+-commutative99.7%
associate-+l-99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around 0 99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (exp (+ (+ 0.6931 (/ (* cosTheta_i cosTheta_O) v)) (/ -1.0 v))) (expm1 (log1p (/ 0.5 v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((0.6931f + ((cosTheta_i * cosTheta_O) / v)) + (-1.0f / v))) * expm1f(log1pf((0.5f / v)));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(exp(Float32(Float32(Float32(0.6931) + Float32(Float32(cosTheta_i * cosTheta_O) / v)) + Float32(Float32(-1.0) / v))) * expm1(log1p(Float32(Float32(0.5) / v)))) end
\begin{array}{l}
\\
e^{\left(0.6931 + \frac{cosTheta\_i \cdot cosTheta\_O}{v}\right) + \frac{-1}{v}} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{0.5}{v}\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
exp-sum99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
add-exp-log99.6%
add-cube-cbrt99.7%
exp-prod99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in sinTheta_i around 0 99.7%
expm1-log1p-u99.7%
expm1-undefine99.7%
pow-exp99.7%
unpow299.7%
add-cube-cbrt99.6%
add-exp-log99.7%
Applied egg-rr99.7%
expm1-define99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ 0.5 v) (exp (+ (+ 0.6931 (/ (* cosTheta_i cosTheta_O) v)) (/ -1.0 v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (0.5f / v) * expf(((0.6931f + ((cosTheta_i * cosTheta_O) / v)) + (-1.0f / v)));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (0.5e0 / v) * exp(((0.6931e0 + ((costheta_i * costheta_o) / v)) + ((-1.0e0) / v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(0.5) / v) * exp(Float32(Float32(Float32(0.6931) + Float32(Float32(cosTheta_i * cosTheta_O) / v)) + Float32(Float32(-1.0) / v)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (single(0.5) / v) * exp(((single(0.6931) + ((cosTheta_i * cosTheta_O) / v)) + (single(-1.0) / v))); end
\begin{array}{l}
\\
\frac{0.5}{v} \cdot e^{\left(0.6931 + \frac{cosTheta\_i \cdot cosTheta\_O}{v}\right) + \frac{-1}{v}}
\end{array}
Initial program 99.6%
+-commutative99.6%
exp-sum99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around 0 99.6%
Final simplification99.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= cosTheta_O 8.499999924127398e-19) (pow E (/ (* sinTheta_i (- sinTheta_O)) v)) (exp (* cosTheta_O (/ cosTheta_i v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if (cosTheta_O <= 8.499999924127398e-19f) {
tmp = powf(((float) M_E), ((sinTheta_i * -sinTheta_O) / v));
} else {
tmp = expf((cosTheta_O * (cosTheta_i / v)));
}
return tmp;
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (cosTheta_O <= Float32(8.499999924127398e-19)) tmp = Float32(exp(1)) ^ Float32(Float32(sinTheta_i * Float32(-sinTheta_O)) / v); else tmp = exp(Float32(cosTheta_O * Float32(cosTheta_i / v))); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if (cosTheta_O <= single(8.499999924127398e-19)) tmp = single(2.71828182845904523536) ^ ((sinTheta_i * -sinTheta_O) / v); else tmp = exp((cosTheta_O * (cosTheta_i / v))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;cosTheta\_O \leq 8.499999924127398 \cdot 10^{-19}:\\
\;\;\;\;{e}^{\left(\frac{sinTheta\_i \cdot \left(-sinTheta\_O\right)}{v}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{cosTheta\_O \cdot \frac{cosTheta\_i}{v}}\\
\end{array}
\end{array}
if cosTheta_O < 8.49999992e-19Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 73.6%
associate--l+73.5%
associate-*r/73.5%
metadata-eval73.5%
Simplified73.5%
*-un-lft-identity73.5%
exp-prod73.5%
exp-1-e73.5%
associate--l+73.5%
+-commutative73.5%
times-frac94.2%
fma-define95.2%
associate-/r*95.4%
Applied egg-rr95.4%
Taylor expanded in sinTheta_O around inf 12.2%
associate-*r/12.2%
mul-1-neg12.2%
*-commutative12.2%
distribute-lft-neg-in12.2%
Simplified12.2%
if 8.49999992e-19 < cosTheta_O Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 92.1%
associate--l+92.1%
associate-*r/92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in cosTheta_O around inf 20.1%
Final simplification14.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= cosTheta_O 8.499999924127398e-19) (/ 1.0 (exp (/ (* sinTheta_i sinTheta_O) v))) (exp (* cosTheta_O (/ cosTheta_i v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if (cosTheta_O <= 8.499999924127398e-19f) {
tmp = 1.0f / expf(((sinTheta_i * sinTheta_O) / v));
} else {
tmp = expf((cosTheta_O * (cosTheta_i / v)));
}
return tmp;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
real(4) :: tmp
if (costheta_o <= 8.499999924127398e-19) then
tmp = 1.0e0 / exp(((sintheta_i * sintheta_o) / v))
else
tmp = exp((costheta_o * (costheta_i / v)))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (cosTheta_O <= Float32(8.499999924127398e-19)) tmp = Float32(Float32(1.0) / exp(Float32(Float32(sinTheta_i * sinTheta_O) / v))); else tmp = exp(Float32(cosTheta_O * Float32(cosTheta_i / v))); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if (cosTheta_O <= single(8.499999924127398e-19)) tmp = single(1.0) / exp(((sinTheta_i * sinTheta_O) / v)); else tmp = exp((cosTheta_O * (cosTheta_i / v))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;cosTheta\_O \leq 8.499999924127398 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{e^{\frac{sinTheta\_i \cdot sinTheta\_O}{v}}}\\
\mathbf{else}:\\
\;\;\;\;e^{cosTheta\_O \cdot \frac{cosTheta\_i}{v}}\\
\end{array}
\end{array}
if cosTheta_O < 8.49999992e-19Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-+r+99.6%
fma-define99.6%
prod-exp99.6%
add-exp-log99.7%
associate-*r/99.7%
*-commutative99.7%
clear-num99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
add-exp-log99.6%
associate-/r*99.6%
log-div99.6%
add-log-exp99.6%
+-commutative99.6%
sub-div99.6%
Applied egg-rr99.6%
Taylor expanded in sinTheta_i around inf 12.2%
if 8.49999992e-19 < cosTheta_O Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 92.1%
associate--l+92.1%
associate-*r/92.1%
metadata-eval92.1%
Simplified92.1%
Taylor expanded in cosTheta_O around inf 20.1%
Final simplification14.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* 0.5 (exp (+ 0.6931 (/ -1.0 v)))) v))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (0.5f * expf((0.6931f + (-1.0f / v)))) / v;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = (0.5e0 * exp((0.6931e0 + ((-1.0e0) / v)))) / v
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(Float32(0.5) * exp(Float32(Float32(0.6931) + Float32(Float32(-1.0) / v)))) / v) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (single(0.5) * exp((single(0.6931) + (single(-1.0) / v)))) / v; end
\begin{array}{l}
\\
\frac{0.5 \cdot e^{0.6931 + \frac{-1}{v}}}{v}
\end{array}
Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
associate-+r+99.6%
fma-define99.6%
prod-exp99.6%
add-exp-log99.6%
associate-*r/99.6%
*-commutative99.6%
clear-num99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
div-inv99.5%
+-commutative99.5%
sub-div99.5%
Applied egg-rr99.5%
associate-/r*99.5%
metadata-eval99.5%
sub-neg99.5%
*-commutative99.5%
*-commutative99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in cosTheta_O around inf 99.5%
Taylor expanded in cosTheta_O around 0 99.6%
associate-*r/99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (exp (/ (* cosTheta_O (- cosTheta_i (/ 1.0 cosTheta_O))) v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((cosTheta_O * (cosTheta_i - (1.0f / cosTheta_O))) / v));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = exp(((costheta_o * (costheta_i - (1.0e0 / costheta_o))) / v))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(Float32(cosTheta_O * Float32(cosTheta_i - Float32(Float32(1.0) / cosTheta_O))) / v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp(((cosTheta_O * (cosTheta_i - (single(1.0) / cosTheta_O))) / v)); end
\begin{array}{l}
\\
e^{\frac{cosTheta\_O \cdot \left(cosTheta\_i - \frac{1}{cosTheta\_O}\right)}{v}}
\end{array}
Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 78.5%
associate--l+78.4%
associate-*r/78.4%
metadata-eval78.4%
Simplified78.4%
Taylor expanded in sinTheta_O around 0 96.4%
associate--l+96.4%
associate-*r/96.4%
metadata-eval96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in v around 0 97.0%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (exp (* cosTheta_O (/ cosTheta_i v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf((cosTheta_O * (cosTheta_i / v)));
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = exp((costheta_o * (costheta_i / v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(cosTheta_O * Float32(cosTheta_i / v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp((cosTheta_O * (cosTheta_i / v))); end
\begin{array}{l}
\\
e^{cosTheta\_O \cdot \frac{cosTheta\_i}{v}}
\end{array}
Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 78.5%
associate--l+78.4%
associate-*r/78.4%
metadata-eval78.4%
Simplified78.4%
Taylor expanded in cosTheta_O around inf 13.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 1.0)
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 1.0f;
}
real(4) function code(costheta_i, costheta_o, sintheta_i, sintheta_o, v)
real(4), intent (in) :: costheta_i
real(4), intent (in) :: costheta_o
real(4), intent (in) :: sintheta_i
real(4), intent (in) :: sintheta_o
real(4), intent (in) :: v
code = 1.0e0
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(1.0) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(1.0); end
\begin{array}{l}
\\
1
\end{array}
Initial program 99.6%
associate-+l+99.6%
associate--l-99.6%
associate-/l*99.6%
associate-/l*99.6%
associate-/r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in cosTheta_O around inf 78.5%
associate--l+78.4%
associate-*r/78.4%
metadata-eval78.4%
Simplified78.4%
Taylor expanded in cosTheta_O around inf 13.2%
Taylor expanded in cosTheta_O around 0 6.5%
herbie shell --seed 2024146
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:name "HairBSDF, Mp, lower"
:precision binary32
: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))))))