
(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 9 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
(pow
(sqrt
(*
(exp
(+
(-
(* (/ cosTheta_i v) cosTheta_O)
(fma (/ sinTheta_i v) sinTheta_O (/ 1.0 v)))
0.6931))
(/ 0.5 v)))
2.0))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return powf(sqrtf((expf(((((cosTheta_i / v) * cosTheta_O) - fmaf((sinTheta_i / v), sinTheta_O, (1.0f / v))) + 0.6931f)) * (0.5f / v))), 2.0f);
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return sqrt(Float32(exp(Float32(Float32(Float32(Float32(cosTheta_i / v) * cosTheta_O) - fma(Float32(sinTheta_i / v), sinTheta_O, Float32(Float32(1.0) / v))) + Float32(0.6931))) * Float32(Float32(0.5) / v))) ^ Float32(2.0) end
\begin{array}{l}
\\
{\left(\sqrt{e^{\left(\frac{cosTheta\_i}{v} \cdot cosTheta\_O - \mathsf{fma}\left(\frac{sinTheta\_i}{v}, sinTheta\_O, \frac{1}{v}\right)\right) + 0.6931} \cdot \frac{0.5}{v}}\right)}^{2}
\end{array}
Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
add-sqr-sqrt99.8%
pow299.8%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(let* ((t_0 (/ (* sinTheta_i sinTheta_O) v)))
(if (<= (* sinTheta_i sinTheta_O) 4.999999898305949e-32)
t_0
(/ 1.0 (exp t_0)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float t_0 = (sinTheta_i * sinTheta_O) / v;
float tmp;
if ((sinTheta_i * sinTheta_O) <= 4.999999898305949e-32f) {
tmp = t_0;
} else {
tmp = 1.0f / expf(t_0);
}
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_i * sintheta_o) / v
if ((sintheta_i * sintheta_o) <= 4.999999898305949e-32) then
tmp = t_0
else
tmp = 1.0e0 / exp(t_0)
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = Float32(Float32(sinTheta_i * sinTheta_O) / v) tmp = Float32(0.0) if (Float32(sinTheta_i * sinTheta_O) <= Float32(4.999999898305949e-32)) tmp = t_0; else tmp = Float32(Float32(1.0) / exp(t_0)); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) t_0 = (sinTheta_i * sinTheta_O) / v; tmp = single(0.0); if ((sinTheta_i * sinTheta_O) <= single(4.999999898305949e-32)) tmp = t_0; else tmp = single(1.0) / exp(t_0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{sinTheta\_i \cdot sinTheta\_O}{v}\\
\mathbf{if}\;sinTheta\_i \cdot sinTheta\_O \leq 4.999999898305949 \cdot 10^{-32}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{t\_0}}\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < 4.9999999e-32Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 6.3%
add-sqr-sqrt4.7%
sqrt-unprod6.3%
mul-1-neg6.3%
mul-1-neg6.3%
sqr-neg6.3%
sqrt-unprod4.0%
add-sqr-sqrt9.9%
*-un-lft-identity9.9%
associate-/l*9.9%
Applied egg-rr9.9%
*-lft-identity9.9%
associate-/l*9.9%
associate-*r/9.9%
Simplified9.9%
Taylor expanded in sinTheta_O around 0 6.3%
associate-*r/6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 42.9%
if 4.9999999e-32 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.7%
associate-+l+99.7%
sub-neg99.7%
associate-+l-99.7%
associate-/l*99.7%
sub-neg99.7%
associate-/l*99.7%
remove-double-neg99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 57.9%
mul-1-neg57.9%
exp-neg57.9%
associate-/l*57.9%
Applied egg-rr57.9%
Taylor expanded in sinTheta_O around inf 57.9%
Final simplification45.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= (* sinTheta_i sinTheta_O) 4.999999898305949e-32) (/ (* sinTheta_i sinTheta_O) v) (exp (* (/ sinTheta_i v) (- sinTheta_O)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if ((sinTheta_i * sinTheta_O) <= 4.999999898305949e-32f) {
tmp = (sinTheta_i * sinTheta_O) / v;
} else {
tmp = expf(((sinTheta_i / v) * -sinTheta_O));
}
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_i * sintheta_o) <= 4.999999898305949e-32) then
tmp = (sintheta_i * sintheta_o) / v
else
tmp = exp(((sintheta_i / v) * -sintheta_o))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (Float32(sinTheta_i * sinTheta_O) <= Float32(4.999999898305949e-32)) tmp = Float32(Float32(sinTheta_i * sinTheta_O) / v); else tmp = exp(Float32(Float32(sinTheta_i / v) * Float32(-sinTheta_O))); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if ((sinTheta_i * sinTheta_O) <= single(4.999999898305949e-32)) tmp = (sinTheta_i * sinTheta_O) / v; else tmp = exp(((sinTheta_i / v) * -sinTheta_O)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sinTheta\_i \cdot sinTheta\_O \leq 4.999999898305949 \cdot 10^{-32}:\\
\;\;\;\;\frac{sinTheta\_i \cdot sinTheta\_O}{v}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{sinTheta\_i}{v} \cdot \left(-sinTheta\_O\right)}\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < 4.9999999e-32Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 6.3%
add-sqr-sqrt4.7%
sqrt-unprod6.3%
mul-1-neg6.3%
mul-1-neg6.3%
sqr-neg6.3%
sqrt-unprod4.0%
add-sqr-sqrt9.9%
*-un-lft-identity9.9%
associate-/l*9.9%
Applied egg-rr9.9%
*-lft-identity9.9%
associate-/l*9.9%
associate-*r/9.9%
Simplified9.9%
Taylor expanded in sinTheta_O around 0 6.3%
associate-*r/6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 42.9%
if 4.9999999e-32 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.7%
associate-+l+99.7%
sub-neg99.7%
associate-+l-99.7%
associate-/l*99.7%
sub-neg99.7%
associate-/l*99.7%
remove-double-neg99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 57.9%
mul-1-neg57.9%
associate-*r/57.9%
*-commutative57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
Final simplification45.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= (* sinTheta_i sinTheta_O) 4.999999898305949e-32) (/ (* sinTheta_i sinTheta_O) v) (exp (/ sinTheta_i (/ (- v) sinTheta_O)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
float tmp;
if ((sinTheta_i * sinTheta_O) <= 4.999999898305949e-32f) {
tmp = (sinTheta_i * sinTheta_O) / v;
} else {
tmp = expf((sinTheta_i / (-v / sinTheta_O)));
}
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_i * sintheta_o) <= 4.999999898305949e-32) then
tmp = (sintheta_i * sintheta_o) / v
else
tmp = exp((sintheta_i / (-v / sintheta_o)))
end if
code = tmp
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = Float32(0.0) if (Float32(sinTheta_i * sinTheta_O) <= Float32(4.999999898305949e-32)) tmp = Float32(Float32(sinTheta_i * sinTheta_O) / v); else tmp = exp(Float32(sinTheta_i / Float32(Float32(-v) / sinTheta_O))); end return tmp end
function tmp_2 = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(0.0); if ((sinTheta_i * sinTheta_O) <= single(4.999999898305949e-32)) tmp = (sinTheta_i * sinTheta_O) / v; else tmp = exp((sinTheta_i / (-v / sinTheta_O))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sinTheta\_i \cdot sinTheta\_O \leq 4.999999898305949 \cdot 10^{-32}:\\
\;\;\;\;\frac{sinTheta\_i \cdot sinTheta\_O}{v}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{sinTheta\_i}{\frac{-v}{sinTheta\_O}}}\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < 4.9999999e-32Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 6.3%
add-sqr-sqrt4.7%
sqrt-unprod6.3%
mul-1-neg6.3%
mul-1-neg6.3%
sqr-neg6.3%
sqrt-unprod4.0%
add-sqr-sqrt9.9%
*-un-lft-identity9.9%
associate-/l*9.9%
Applied egg-rr9.9%
*-lft-identity9.9%
associate-/l*9.9%
associate-*r/9.9%
Simplified9.9%
Taylor expanded in sinTheta_O around 0 6.3%
associate-*r/6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 42.9%
if 4.9999999e-32 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.7%
associate-+l+99.7%
sub-neg99.7%
associate-+l-99.7%
associate-/l*99.7%
sub-neg99.7%
associate-/l*99.7%
remove-double-neg99.7%
associate-/r*99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in sinTheta_i around inf 57.9%
mul-1-neg57.9%
exp-neg57.9%
associate-/l*57.9%
Applied egg-rr57.9%
rec-exp57.9%
neg-mul-157.9%
metadata-eval57.9%
associate-/l*57.9%
*-commutative57.9%
times-frac57.9%
*-lft-identity57.9%
neg-mul-157.9%
associate-/l*57.9%
Simplified57.9%
Final simplification45.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* 0.5 (/ (exp (+ 0.6931 (/ (- -1.0 (* sinTheta_i sinTheta_O)) 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 - (sinTheta_i * sinTheta_O)) / 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) - (sintheta_i * sintheta_o)) / v))) / v)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(0.5) * Float32(exp(Float32(Float32(0.6931) + Float32(Float32(Float32(-1.0) - Float32(sinTheta_i * sinTheta_O)) / 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) - (sinTheta_i * sinTheta_O)) / v))) / v); end
\begin{array}{l}
\\
0.5 \cdot \frac{e^{0.6931 + \frac{-1 - sinTheta\_i \cdot sinTheta\_O}{v}}}{v}
\end{array}
Initial program 99.8%
exp-sum99.8%
*-commutative99.8%
rem-exp-log99.9%
associate-/r*99.9%
metadata-eval99.9%
+-rgt-identity99.9%
metadata-eval99.9%
metadata-eval99.9%
+-rgt-identity99.9%
sub-neg99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in cosTheta_O around 0 99.9%
Taylor expanded in v around 0 99.9%
Taylor expanded in v around 0 99.9%
Final simplification99.9%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ 0.5 v) (exp (+ 0.6931 (/ -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 + (-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 + ((-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(0.6931) + 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) + (single(-1.0) / v))); end
\begin{array}{l}
\\
\frac{0.5}{v} \cdot e^{0.6931 + \frac{-1}{v}}
\end{array}
Initial program 99.8%
exp-sum99.8%
*-commutative99.8%
rem-exp-log99.9%
associate-/r*99.9%
metadata-eval99.9%
+-rgt-identity99.9%
metadata-eval99.9%
metadata-eval99.9%
+-rgt-identity99.9%
sub-neg99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in cosTheta_O around 0 99.9%
Taylor expanded in sinTheta_O around 0 99.7%
Final simplification99.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ sinTheta_i v) sinTheta_O))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (sinTheta_i / v) * sinTheta_O;
}
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_i / v) * sintheta_o
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(sinTheta_i / v) * sinTheta_O) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (sinTheta_i / v) * sinTheta_O; end
\begin{array}{l}
\\
\frac{sinTheta\_i}{v} \cdot sinTheta\_O
\end{array}
Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 14.3%
add-sqr-sqrt4.0%
sqrt-unprod6.0%
mul-1-neg6.0%
mul-1-neg6.0%
sqr-neg6.0%
sqrt-unprod4.1%
add-sqr-sqrt9.1%
*-un-lft-identity9.1%
associate-/l*9.1%
Applied egg-rr9.1%
*-lft-identity9.1%
associate-/l*9.1%
associate-*r/9.1%
Simplified9.1%
Taylor expanded in sinTheta_O around 0 6.3%
associate-*r/6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 37.2%
associate-*r/20.2%
Simplified20.2%
Final simplification20.2%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ (* sinTheta_i sinTheta_O) v))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (sinTheta_i * sinTheta_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 = (sintheta_i * sintheta_o) / v
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(sinTheta_i * sinTheta_O) / v) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (sinTheta_i * sinTheta_O) / v; end
\begin{array}{l}
\\
\frac{sinTheta\_i \cdot sinTheta\_O}{v}
\end{array}
Initial program 99.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 14.3%
add-sqr-sqrt4.0%
sqrt-unprod6.0%
mul-1-neg6.0%
mul-1-neg6.0%
sqr-neg6.0%
sqrt-unprod4.1%
add-sqr-sqrt9.1%
*-un-lft-identity9.1%
associate-/l*9.1%
Applied egg-rr9.1%
*-lft-identity9.1%
associate-/l*9.1%
associate-*r/9.1%
Simplified9.1%
Taylor expanded in sinTheta_O around 0 6.3%
associate-*r/6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 37.2%
Final simplification37.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.8%
associate-+l+99.8%
sub-neg99.8%
associate-+l-99.8%
associate-/l*99.8%
sub-neg99.8%
associate-/l*99.8%
remove-double-neg99.8%
associate-/r*99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.4%
Final simplification6.4%
herbie shell --seed 2024036
(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))))))