
(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 (pow E (+ (+ 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 powf(((float) M_E), ((0.6931f + logf((0.5f / v))) + (-1.0f / v)));
}
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(exp(1)) ^ 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 = single(2.71828182845904523536) ^ ((single(0.6931) + log((single(0.5) / v))) + (single(-1.0) / v)); end
\begin{array}{l}
\\
{e}^{\left(\left(0.6931 + \log \left(\frac{0.5}{v}\right)\right) + \frac{-1}{v}\right)}
\end{array}
Initial program 99.6%
Simplified99.6%
*-un-lft-identity99.6%
exp-prod99.6%
associate--r+99.6%
div-inv99.6%
clear-num99.6%
*-commutative99.6%
associate-*l/99.6%
div-inv99.6%
clear-num99.6%
*-commutative99.6%
associate-*l/99.6%
sub-div99.6%
Applied egg-rr99.6%
exp-1-e99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in sinTheta_O around 0 99.6%
Taylor expanded in v around inf 99.6%
log-rec99.6%
sub-neg99.6%
log-div99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v)
:precision binary32
(if (<= (* sinTheta_i sinTheta_O) -4.999999999099794e-24)
(exp (/ sinTheta_O (/ v sinTheta_i)))
(if (<= (* sinTheta_i sinTheta_O) 1.500000029312222e-25)
(+ -1.0 (+ 1.0 (/ sinTheta_i (/ v sinTheta_O))))
(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_i * sinTheta_O) <= -4.999999999099794e-24f) {
tmp = expf((sinTheta_O / (v / sinTheta_i)));
} else if ((sinTheta_i * sinTheta_O) <= 1.500000029312222e-25f) {
tmp = -1.0f + (1.0f + (sinTheta_i / (v / sinTheta_O)));
} 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_i * sintheta_o) <= (-4.999999999099794e-24)) then
tmp = exp((sintheta_o / (v / sintheta_i)))
else if ((sintheta_i * sintheta_o) <= 1.500000029312222e-25) then
tmp = (-1.0e0) + (1.0e0 + (sintheta_i / (v / sintheta_o)))
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 (Float32(sinTheta_i * sinTheta_O) <= Float32(-4.999999999099794e-24)) tmp = exp(Float32(sinTheta_O / Float32(v / sinTheta_i))); elseif (Float32(sinTheta_i * sinTheta_O) <= Float32(1.500000029312222e-25)) tmp = Float32(Float32(-1.0) + Float32(Float32(1.0) + Float32(sinTheta_i / Float32(v / sinTheta_O)))); else tmp = exp(Float32(sinTheta_O * Float32(Float32(-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_i * sinTheta_O) <= single(-4.999999999099794e-24)) tmp = exp((sinTheta_O / (v / sinTheta_i))); elseif ((sinTheta_i * sinTheta_O) <= single(1.500000029312222e-25)) tmp = single(-1.0) + (single(1.0) + (sinTheta_i / (v / sinTheta_O))); else tmp = exp((sinTheta_O * (-sinTheta_i / v))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;sinTheta_i \cdot sinTheta_O \leq -4.999999999099794 \cdot 10^{-24}:\\
\;\;\;\;e^{\frac{sinTheta_O}{\frac{v}{sinTheta_i}}}\\
\mathbf{elif}\;sinTheta_i \cdot sinTheta_O \leq 1.500000029312222 \cdot 10^{-25}:\\
\;\;\;\;-1 + \left(1 + \frac{sinTheta_i}{\frac{v}{sinTheta_O}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{sinTheta_O \cdot \frac{-sinTheta_i}{v}}\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < -5e-24Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 4.1%
expm1-log1p-u4.1%
expm1-udef4.1%
add-sqr-sqrt4.1%
sqrt-unprod4.1%
mul-1-neg4.1%
mul-1-neg4.1%
sqr-neg4.1%
sqrt-unprod-0.0%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
expm1-def71.4%
expm1-log1p71.4%
associate-/l*71.4%
Simplified71.4%
if -5e-24 < (*.f32 sinTheta_i sinTheta_O) < 1.50000003e-25Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 8.8%
Taylor expanded in sinTheta_O around 0 6.4%
neg-mul-16.4%
unsub-neg6.4%
associate-/l*6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 42.0%
mul-1-neg42.0%
associate-*l/21.0%
*-commutative21.0%
distribute-rgt-neg-in21.0%
Simplified21.0%
add-sqr-sqrt9.5%
sqrt-unprod21.4%
sqr-neg21.4%
sqrt-unprod11.5%
add-sqr-sqrt21.1%
div-inv21.1%
associate-*r*42.0%
*-commutative42.0%
div-inv42.0%
expm1-log1p-u41.7%
expm1-udef79.4%
log1p-udef79.4%
add-exp-log79.7%
div-inv79.7%
*-commutative79.7%
associate-*r*79.7%
div-inv79.7%
clear-num79.7%
un-div-inv79.7%
Applied egg-rr79.7%
if 1.50000003e-25 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.5%
Simplified99.5%
Taylor expanded in sinTheta_i around inf 56.5%
mul-1-neg56.5%
associate-*r/56.5%
distribute-rgt-neg-in56.5%
distribute-neg-frac56.5%
Simplified56.5%
Final simplification75.9%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= (* sinTheta_i sinTheta_O) -4.999999999099794e-24) (exp (* sinTheta_O (/ sinTheta_i v))) (+ -1.0 (+ 1.0 (/ 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.999999999099794e-24f) {
tmp = expf((sinTheta_O * (sinTheta_i / v)));
} else {
tmp = -1.0f + (1.0f + (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.999999999099794e-24)) then
tmp = exp((sintheta_o * (sintheta_i / v)))
else
tmp = (-1.0e0) + (1.0e0 + (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.999999999099794e-24)) tmp = exp(Float32(sinTheta_O * Float32(sinTheta_i / v))); else tmp = Float32(Float32(-1.0) + Float32(Float32(1.0) + Float32(sinTheta_i / 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.999999999099794e-24)) tmp = exp((sinTheta_O * (sinTheta_i / v))); else tmp = single(-1.0) + (single(1.0) + (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.999999999099794 \cdot 10^{-24}:\\
\;\;\;\;e^{sinTheta_O \cdot \frac{sinTheta_i}{v}}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(1 + \frac{sinTheta_i}{\frac{v}{sinTheta_O}}\right)\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < -5e-24Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 4.1%
mul-1-neg4.1%
exp-neg4.1%
Applied egg-rr4.1%
rec-exp4.1%
distribute-neg-frac4.1%
distribute-rgt-neg-in4.1%
Simplified4.1%
expm1-log1p-u4.1%
expm1-udef4.1%
Applied egg-rr78.5%
expm1-def71.4%
expm1-log1p71.4%
associate-/r/71.4%
*-commutative71.4%
Simplified71.4%
if -5e-24 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 15.4%
Taylor expanded in sinTheta_O around 0 6.4%
neg-mul-16.4%
unsub-neg6.4%
associate-/l*6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 37.0%
mul-1-neg37.0%
associate-*l/18.9%
*-commutative18.9%
distribute-rgt-neg-in18.9%
Simplified18.9%
add-sqr-sqrt8.6%
sqrt-unprod19.2%
sqr-neg19.2%
sqrt-unprod10.4%
add-sqr-sqrt19.1%
div-inv19.1%
associate-*r*37.1%
*-commutative37.1%
div-inv37.1%
expm1-log1p-u36.8%
expm1-udef71.6%
log1p-udef71.6%
add-exp-log71.8%
div-inv71.8%
*-commutative71.8%
associate-*r*71.8%
div-inv71.8%
clear-num71.8%
un-div-inv71.8%
Applied egg-rr71.8%
Final simplification71.8%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (if (<= (* sinTheta_i sinTheta_O) -4.999999999099794e-24) (exp (/ sinTheta_O (/ v sinTheta_i))) (+ -1.0 (+ 1.0 (/ 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.999999999099794e-24f) {
tmp = expf((sinTheta_O / (v / sinTheta_i)));
} else {
tmp = -1.0f + (1.0f + (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.999999999099794e-24)) then
tmp = exp((sintheta_o / (v / sintheta_i)))
else
tmp = (-1.0e0) + (1.0e0 + (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.999999999099794e-24)) tmp = exp(Float32(sinTheta_O / Float32(v / sinTheta_i))); else tmp = Float32(Float32(-1.0) + Float32(Float32(1.0) + Float32(sinTheta_i / 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.999999999099794e-24)) tmp = exp((sinTheta_O / (v / sinTheta_i))); else tmp = single(-1.0) + (single(1.0) + (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.999999999099794 \cdot 10^{-24}:\\
\;\;\;\;e^{\frac{sinTheta_O}{\frac{v}{sinTheta_i}}}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(1 + \frac{sinTheta_i}{\frac{v}{sinTheta_O}}\right)\\
\end{array}
\end{array}
if (*.f32 sinTheta_i sinTheta_O) < -5e-24Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 4.1%
expm1-log1p-u4.1%
expm1-udef4.1%
add-sqr-sqrt4.1%
sqrt-unprod4.1%
mul-1-neg4.1%
mul-1-neg4.1%
sqr-neg4.1%
sqrt-unprod-0.0%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
expm1-def71.4%
expm1-log1p71.4%
associate-/l*71.4%
Simplified71.4%
if -5e-24 < (*.f32 sinTheta_i sinTheta_O) Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 15.4%
Taylor expanded in sinTheta_O around 0 6.4%
neg-mul-16.4%
unsub-neg6.4%
associate-/l*6.4%
Simplified6.4%
Taylor expanded in sinTheta_O around inf 37.0%
mul-1-neg37.0%
associate-*l/18.9%
*-commutative18.9%
distribute-rgt-neg-in18.9%
Simplified18.9%
add-sqr-sqrt8.6%
sqrt-unprod19.2%
sqr-neg19.2%
sqrt-unprod10.4%
add-sqr-sqrt19.1%
div-inv19.1%
associate-*r*37.1%
*-commutative37.1%
div-inv37.1%
expm1-log1p-u36.8%
expm1-udef71.6%
log1p-udef71.6%
add-exp-log71.8%
div-inv71.8%
*-commutative71.8%
associate-*r*71.8%
div-inv71.8%
clear-num71.8%
un-div-inv71.8%
Applied egg-rr71.8%
Final simplification71.8%
(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.6%
exp-sum99.6%
*-commutative99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
+-rgt-identity99.6%
metadata-eval99.6%
metadata-eval99.6%
+-rgt-identity99.6%
sub-neg99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in sinTheta_O around 0 99.6%
Taylor expanded in cosTheta_O around 0 99.6%
Final simplification99.6%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (* (/ 0.5 v) (exp (/ -1.0 v))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return (0.5f / v) * expf((-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(((-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(-1.0) / v))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = (single(0.5) / v) * exp((single(-1.0) / v)); end
\begin{array}{l}
\\
\frac{0.5}{v} \cdot e^{\frac{-1}{v}}
\end{array}
Initial program 99.6%
exp-sum99.6%
*-commutative99.6%
rem-exp-log99.6%
associate-/r*99.6%
metadata-eval99.6%
+-rgt-identity99.6%
metadata-eval99.6%
metadata-eval99.6%
+-rgt-identity99.6%
sub-neg99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in sinTheta_O around 0 99.6%
Taylor expanded in cosTheta_O around 0 99.6%
Taylor expanded in v around 0 96.7%
Final simplification96.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (+ -1.0 (+ 1.0 (/ sinTheta_i (/ v sinTheta_O)))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return -1.0f + (1.0f + (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 = (-1.0e0) + (1.0e0 + (sintheta_i / (v / sintheta_o)))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(-1.0) + Float32(Float32(1.0) + Float32(sinTheta_i / Float32(v / sinTheta_O)))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(-1.0) + (single(1.0) + (sinTheta_i / (v / sinTheta_O))); end
\begin{array}{l}
\\
-1 + \left(1 + \frac{sinTheta_i}{\frac{v}{sinTheta_O}}\right)
\end{array}
Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.3%
neg-mul-16.3%
unsub-neg6.3%
associate-/l*6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 33.8%
mul-1-neg33.8%
associate-*l/17.6%
*-commutative17.6%
distribute-rgt-neg-in17.6%
Simplified17.6%
add-sqr-sqrt7.9%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod9.7%
add-sqr-sqrt17.7%
div-inv17.7%
associate-*r*33.9%
*-commutative33.9%
div-inv33.9%
expm1-log1p-u33.3%
expm1-udef65.2%
log1p-udef65.2%
add-exp-log65.8%
div-inv65.8%
*-commutative65.8%
associate-*r*65.8%
div-inv65.8%
clear-num65.8%
un-div-inv65.8%
Applied egg-rr65.8%
Final simplification65.8%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ 1.0 (/ v (* sinTheta_i sinTheta_O))))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return 1.0f / (v / (sinTheta_i * 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 = 1.0e0 / (v / (sintheta_i * sintheta_o))
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(Float32(1.0) / Float32(v / Float32(sinTheta_i * sinTheta_O))) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = single(1.0) / (v / (sinTheta_i * sinTheta_O)); end
\begin{array}{l}
\\
\frac{1}{\frac{v}{sinTheta_i \cdot sinTheta_O}}
\end{array}
Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.3%
neg-mul-16.3%
unsub-neg6.3%
associate-/l*6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 33.8%
mul-1-neg33.8%
associate-*l/17.6%
*-commutative17.6%
distribute-rgt-neg-in17.6%
Simplified17.6%
distribute-rgt-neg-out17.6%
div-inv17.6%
associate-*r*33.8%
*-commutative33.8%
distribute-lft-neg-in33.8%
distribute-rgt-neg-out33.8%
div-inv33.8%
clear-num33.9%
*-commutative33.9%
add-sqr-sqrt18.6%
sqrt-unprod51.0%
sqr-neg51.0%
sqrt-unprod15.4%
add-sqr-sqrt34.0%
Applied egg-rr34.0%
Final simplification34.0%
(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 / 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.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.3%
neg-mul-16.3%
unsub-neg6.3%
associate-/l*6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 33.8%
mul-1-neg33.8%
associate-*l/17.6%
*-commutative17.6%
distribute-rgt-neg-in17.6%
Simplified17.6%
distribute-rgt-neg-out17.6%
div-inv17.6%
associate-*r*33.8%
*-commutative33.8%
distribute-lft-neg-in33.8%
distribute-rgt-neg-out33.8%
div-inv33.8%
add-log-exp66.6%
*-un-lft-identity66.6%
log-prod66.6%
metadata-eval66.6%
add-log-exp33.8%
add-sqr-sqrt18.6%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod15.2%
add-sqr-sqrt33.9%
div-inv33.9%
*-commutative33.9%
associate-*r*17.7%
div-inv17.7%
clear-num17.7%
un-div-inv17.7%
Applied egg-rr17.7%
+-lft-identity17.7%
associate-/r/17.7%
*-commutative17.7%
Simplified17.7%
Final simplification17.7%
(FPCore (cosTheta_i cosTheta_O sinTheta_i sinTheta_O v) :precision binary32 (/ sinTheta_O (/ v sinTheta_i)))
float code(float cosTheta_i, float cosTheta_O, float sinTheta_i, float sinTheta_O, float v) {
return sinTheta_O / (v / sinTheta_i);
}
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 / (v / sintheta_i)
end function
function code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) return Float32(sinTheta_O / Float32(v / sinTheta_i)) end
function tmp = code(cosTheta_i, cosTheta_O, sinTheta_i, sinTheta_O, v) tmp = sinTheta_O / (v / sinTheta_i); end
\begin{array}{l}
\\
\frac{sinTheta_O}{\frac{v}{sinTheta_i}}
\end{array}
Initial program 99.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.3%
neg-mul-16.3%
unsub-neg6.3%
associate-/l*6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 33.8%
mul-1-neg33.8%
associate-*l/17.6%
*-commutative17.6%
distribute-rgt-neg-in17.6%
Simplified17.6%
add-sqr-sqrt7.9%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod9.7%
add-sqr-sqrt17.7%
div-inv17.7%
associate-*r*33.9%
*-commutative33.9%
div-inv33.9%
associate-/l*17.7%
Applied egg-rr17.7%
Final simplification17.7%
(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.6%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.3%
neg-mul-16.3%
unsub-neg6.3%
associate-/l*6.3%
Simplified6.3%
Taylor expanded in sinTheta_O around inf 33.8%
mul-1-neg33.8%
associate-*l/17.6%
*-commutative17.6%
distribute-rgt-neg-in17.6%
Simplified17.6%
add-sqr-sqrt7.9%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod9.7%
add-sqr-sqrt17.7%
div-inv17.7%
associate-*r*33.9%
*-commutative33.9%
div-inv33.9%
*-commutative33.9%
Applied egg-rr33.9%
Final simplification33.9%
(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%
Simplified99.6%
Taylor expanded in sinTheta_i around inf 14.3%
Taylor expanded in sinTheta_O around 0 6.5%
Final simplification6.5%
herbie shell --seed 2023312
(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))))))