
(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 10 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 (/ 0.5 v)))) (* t_0 (* (exp (- 0.6931 (/ 1.0 v))) (pow t_0 2.0)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = cbrtf((0.5f / v));
return t_0 * (expf((0.6931f - (1.0f / v))) * powf(t_0, 2.0f));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = cbrt(Float32(Float32(0.5) / v)) return Float32(t_0 * Float32(exp(Float32(Float32(0.6931) - Float32(Float32(1.0) / v))) * (t_0 ^ Float32(2.0)))) end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\frac{0.5}{v}}\\
t\_0 \cdot \left(e^{0.6931 - \frac{1}{v}} \cdot {t\_0}^{2}\right)
\end{array}
\end{array}
Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
associate-+r+99.7%
fma-define99.7%
prod-exp99.7%
add-exp-log99.7%
add-cube-cbrt99.7%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in sinTheta_i around 0 99.8%
Taylor expanded in cosTheta_O around 0 99.8%
Final simplification99.8%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (exp (+ (+ 0.6931 (log (/ 0.5 v))) (/ -1.0 v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf(((0.6931f + logf((0.5f / 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 = exp(((0.6931e0 + log((0.5e0 / v))) + ((-1.0e0) / v)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(Float32(Float32(0.6931) + log(Float32(Float32(0.5) / v))) + Float32(Float32(-1.0) / v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp(((single(0.6931) + log((single(0.5) / v))) + (single(-1.0) / v))); end
\begin{array}{l}
\\
e^{\left(0.6931 + \log \left(\frac{0.5}{v}\right)\right) + \frac{-1}{v}}
\end{array}
Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around 0 99.7%
Taylor expanded in cosTheta_O around 0 99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(if (<= sinTheta_O -5.999999778285218e-28)
(exp (* sinTheta_O (/ sinTheta_i (- v))))
(if (<= sinTheta_O 3.000000106112566e-6)
(/ (* sinTheta_O (- sinTheta_i)) v)
(exp (/ (* sinTheta_O sinTheta_i) v)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if (sinTheta_O <= -5.999999778285218e-28f) {
tmp = expf((sinTheta_O * (sinTheta_i / -v)));
} else if (sinTheta_O <= 3.000000106112566e-6f) {
tmp = (sinTheta_O * -sinTheta_i) / v;
} else {
tmp = expf(((sinTheta_O * sinTheta_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 (sintheta_o <= (-5.999999778285218e-28)) then
tmp = exp((sintheta_o * (sintheta_i / -v)))
else if (sintheta_o <= 3.000000106112566e-6) then
tmp = (sintheta_o * -sintheta_i) / v
else
tmp = exp(((sintheta_o * sintheta_i) / v))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (sinTheta_O <= Float32(-5.999999778285218e-28)) tmp = exp(Float32(sinTheta_O * Float32(sinTheta_i / Float32(-v)))); elseif (sinTheta_O <= Float32(3.000000106112566e-6)) tmp = Float32(Float32(sinTheta_O * Float32(-sinTheta_i)) / v); else tmp = exp(Float32(Float32(sinTheta_O * sinTheta_i) / v)); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if (sinTheta_O <= single(-5.999999778285218e-28)) tmp = exp((sinTheta_O * (sinTheta_i / -v))); elseif (sinTheta_O <= single(3.000000106112566e-6)) tmp = (sinTheta_O * -sinTheta_i) / v; else tmp = exp(((sinTheta_O * sinTheta_i) / v)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sinTheta\_O \leq -5.999999778285218 \cdot 10^{-28}:\\
\;\;\;\;e^{sinTheta\_O \cdot \frac{sinTheta\_i}{-v}}\\
\mathbf{elif}\;sinTheta\_O \leq 3.000000106112566 \cdot 10^{-6}:\\
\;\;\;\;\frac{sinTheta\_O \cdot \left(-sinTheta\_i\right)}{v}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{sinTheta\_O \cdot sinTheta\_i}{v}}\\
\end{array}
\end{array}
if sinTheta_O < -5.99999978e-28Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 16.9%
mul-1-neg16.9%
associate-/l*16.9%
distribute-rgt-neg-in16.9%
distribute-frac-neg216.9%
Simplified16.9%
if -5.99999978e-28 < sinTheta_O < 3.00000011e-6Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 11.0%
associate-*r/11.0%
mul-1-neg11.0%
distribute-lft-neg-out11.0%
*-commutative11.0%
Simplified11.0%
Taylor expanded in sinTheta_i around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
associate-*r/6.4%
unsub-neg6.4%
associate-*r/6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 57.5%
if 3.00000011e-6 < sinTheta_O Initial program 100.0%
associate-+l+100.0%
associate--l-100.0%
associate-/l*100.0%
associate-/l*100.0%
associate-/r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in sinTheta_i around inf 17.0%
associate-*r/17.0%
mul-1-neg17.0%
distribute-lft-neg-out17.0%
*-commutative17.0%
Simplified17.0%
add-log-exp17.0%
*-un-lft-identity17.0%
log-prod17.0%
metadata-eval17.0%
add-log-exp17.0%
associate-/l*17.0%
add-sqr-sqrt-0.0%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod37.1%
add-sqr-sqrt37.1%
Applied egg-rr37.1%
+-lft-identity37.1%
associate-*r/37.1%
*-commutative37.1%
Simplified37.1%
Final simplification41.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (/ (* sinTheta_O (- sinTheta_i)) v)))
(if (<= sinTheta_O -5.999999778285218e-28)
(exp t_0)
(if (<= sinTheta_O 3.000000106112566e-6)
t_0
(exp (/ (* sinTheta_O sinTheta_i) v))))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = (sinTheta_O * -sinTheta_i) / v;
float tmp;
if (sinTheta_O <= -5.999999778285218e-28f) {
tmp = expf(t_0);
} else if (sinTheta_O <= 3.000000106112566e-6f) {
tmp = t_0;
} else {
tmp = expf(((sinTheta_O * sinTheta_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) :: t_0
real(4) :: tmp
t_0 = (sintheta_o * -sintheta_i) / v
if (sintheta_o <= (-5.999999778285218e-28)) then
tmp = exp(t_0)
else if (sintheta_o <= 3.000000106112566e-6) then
tmp = t_0
else
tmp = exp(((sintheta_o * sintheta_i) / v))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = Float32(Float32(sinTheta_O * Float32(-sinTheta_i)) / v) tmp = Float32(0.0) if (sinTheta_O <= Float32(-5.999999778285218e-28)) tmp = exp(t_0); elseif (sinTheta_O <= Float32(3.000000106112566e-6)) tmp = t_0; else tmp = exp(Float32(Float32(sinTheta_O * sinTheta_i) / v)); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = (sinTheta_O * -sinTheta_i) / v; tmp = single(0.0); if (sinTheta_O <= single(-5.999999778285218e-28)) tmp = exp(t_0); elseif (sinTheta_O <= single(3.000000106112566e-6)) tmp = t_0; else tmp = exp(((sinTheta_O * sinTheta_i) / v)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sinTheta\_O \cdot \left(-sinTheta\_i\right)}{v}\\
\mathbf{if}\;sinTheta\_O \leq -5.999999778285218 \cdot 10^{-28}:\\
\;\;\;\;e^{t\_0}\\
\mathbf{elif}\;sinTheta\_O \leq 3.000000106112566 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{sinTheta\_O \cdot sinTheta\_i}{v}}\\
\end{array}
\end{array}
if sinTheta_O < -5.99999978e-28Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 16.9%
associate-*r/16.9%
mul-1-neg16.9%
distribute-lft-neg-out16.9%
*-commutative16.9%
Simplified16.9%
if -5.99999978e-28 < sinTheta_O < 3.00000011e-6Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 11.0%
associate-*r/11.0%
mul-1-neg11.0%
distribute-lft-neg-out11.0%
*-commutative11.0%
Simplified11.0%
Taylor expanded in sinTheta_i around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
associate-*r/6.4%
unsub-neg6.4%
associate-*r/6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 57.5%
if 3.00000011e-6 < sinTheta_O Initial program 100.0%
associate-+l+100.0%
associate--l-100.0%
associate-/l*100.0%
associate-/l*100.0%
associate-/r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in sinTheta_i around inf 17.0%
associate-*r/17.0%
mul-1-neg17.0%
distribute-lft-neg-out17.0%
*-commutative17.0%
Simplified17.0%
add-log-exp17.0%
*-un-lft-identity17.0%
log-prod17.0%
metadata-eval17.0%
add-log-exp17.0%
associate-/l*17.0%
add-sqr-sqrt-0.0%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod37.1%
add-sqr-sqrt37.1%
Applied egg-rr37.1%
+-lft-identity37.1%
associate-*r/37.1%
*-commutative37.1%
Simplified37.1%
Final simplification41.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= sinTheta_O 3.000000106112566e-6) (/ (* sinTheta_O (- sinTheta_i)) v) (exp (/ (* sinTheta_O sinTheta_i) v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if (sinTheta_O <= 3.000000106112566e-6f) {
tmp = (sinTheta_O * -sinTheta_i) / v;
} else {
tmp = expf(((sinTheta_O * sinTheta_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 (sintheta_o <= 3.000000106112566e-6) then
tmp = (sintheta_o * -sintheta_i) / v
else
tmp = exp(((sintheta_o * sintheta_i) / v))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (sinTheta_O <= Float32(3.000000106112566e-6)) tmp = Float32(Float32(sinTheta_O * Float32(-sinTheta_i)) / v); else tmp = exp(Float32(Float32(sinTheta_O * sinTheta_i) / v)); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if (sinTheta_O <= single(3.000000106112566e-6)) tmp = (sinTheta_O * -sinTheta_i) / v; else tmp = exp(((sinTheta_O * sinTheta_i) / v)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sinTheta\_O \leq 3.000000106112566 \cdot 10^{-6}:\\
\;\;\;\;\frac{sinTheta\_O \cdot \left(-sinTheta\_i\right)}{v}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{sinTheta\_O \cdot sinTheta\_i}{v}}\\
\end{array}
\end{array}
if sinTheta_O < 3.00000011e-6Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 13.3%
associate-*r/13.3%
mul-1-neg13.3%
distribute-lft-neg-out13.3%
*-commutative13.3%
Simplified13.3%
Taylor expanded in sinTheta_i around 0 6.4%
mul-1-neg6.4%
*-commutative6.4%
associate-*r/6.4%
unsub-neg6.4%
associate-*r/6.4%
*-commutative6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 45.1%
if 3.00000011e-6 < sinTheta_O Initial program 100.0%
associate-+l+100.0%
associate--l-100.0%
associate-/l*100.0%
associate-/l*100.0%
associate-/r*100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in sinTheta_i around inf 17.0%
associate-*r/17.0%
mul-1-neg17.0%
distribute-lft-neg-out17.0%
*-commutative17.0%
Simplified17.0%
add-log-exp17.0%
*-un-lft-identity17.0%
log-prod17.0%
metadata-eval17.0%
add-log-exp17.0%
associate-/l*17.0%
add-sqr-sqrt-0.0%
sqrt-unprod37.1%
sqr-neg37.1%
sqrt-unprod37.1%
add-sqr-sqrt37.1%
Applied egg-rr37.1%
+-lft-identity37.1%
associate-*r/37.1%
*-commutative37.1%
Simplified37.1%
Final simplification44.3%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (exp (- 0.6931 (/ 1.0 v))) (/ 0.5 v)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return expf((0.6931f - (1.0f / v))) * (0.5f / 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 - (1.0e0 / v))) * (0.5e0 / v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(exp(Float32(Float32(0.6931) - Float32(Float32(1.0) / v))) * Float32(Float32(0.5) / v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp((single(0.6931) - (single(1.0) / v))) * (single(0.5) / v); end
\begin{array}{l}
\\
e^{0.6931 - \frac{1}{v}} \cdot \frac{0.5}{v}
\end{array}
Initial program 99.7%
exp-sum99.7%
*-commutative99.7%
rem-exp-log99.7%
associate-/r*99.7%
metadata-eval99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around 0 99.7%
Taylor expanded in cosTheta_O around 0 99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (exp (/ (+ (* cosTheta_O cosTheta_i) -1.0) 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) / 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)) / v))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return exp(Float32(Float32(Float32(cosTheta_O * cosTheta_i) + Float32(-1.0)) / v)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = exp((((cosTheta_O * cosTheta_i) + single(-1.0)) / v)); end
\begin{array}{l}
\\
e^{\frac{cosTheta\_O \cdot cosTheta\_i + -1}{v}}
\end{array}
Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around 0 99.7%
Taylor expanded in v around 0 97.4%
Final simplification97.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* sinTheta_O (/ sinTheta_i (- v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return sinTheta_O * (sinTheta_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 = sintheta_o * (sintheta_i / -v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(sinTheta_O * Float32(sinTheta_i / Float32(-v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinTheta_O * (sinTheta_i / -v); end
\begin{array}{l}
\\
sinTheta\_O \cdot \frac{sinTheta\_i}{-v}
\end{array}
Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 13.6%
associate-*r/13.6%
mul-1-neg13.6%
distribute-lft-neg-out13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in sinTheta_i around 0 6.3%
mul-1-neg6.3%
*-commutative6.3%
associate-*r/6.3%
unsub-neg6.3%
associate-*r/6.3%
*-commutative6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 41.4%
neg-mul-141.4%
associate-*r/23.4%
distribute-rgt-neg-in23.4%
Simplified23.4%
Final simplification23.4%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* sinTheta_O (- sinTheta_i)) v))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (sinTheta_O * -sinTheta_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 = (sintheta_o * -sintheta_i) / v
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(sinTheta_O * Float32(-sinTheta_i)) / v) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (sinTheta_O * -sinTheta_i) / v; end
\begin{array}{l}
\\
\frac{sinTheta\_O \cdot \left(-sinTheta\_i\right)}{v}
\end{array}
Initial program 99.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 13.6%
associate-*r/13.6%
mul-1-neg13.6%
distribute-lft-neg-out13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in sinTheta_i around 0 6.3%
mul-1-neg6.3%
*-commutative6.3%
associate-*r/6.3%
unsub-neg6.3%
associate-*r/6.3%
*-commutative6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 41.4%
Final simplification41.4%
(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.7%
associate-+l+99.7%
associate--l-99.7%
associate-/l*99.7%
associate-/l*99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 13.6%
associate-*r/13.6%
mul-1-neg13.6%
distribute-lft-neg-out13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in sinTheta_i around 0 6.5%
Final simplification6.5%
herbie shell --seed 2024046
(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))))))