
(FPCore (u v) :precision binary32 (+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))
float code(float u, float v) {
return 1.0f + (v * logf((u + ((1.0f - u) * expf((-2.0f / v))))));
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
code = 1.0e0 + (v * log((u + ((1.0e0 - u) * exp(((-2.0e0) / v))))))
end function
function code(u, v) return Float32(Float32(1.0) + Float32(v * log(Float32(u + Float32(Float32(Float32(1.0) - u) * exp(Float32(Float32(-2.0) / v))))))) end
function tmp = code(u, v) tmp = single(1.0) + (v * log((u + ((single(1.0) - u) * exp((single(-2.0) / v)))))); end
\begin{array}{l}
\\
1 + v \cdot \log \left(u + \left(1 - u\right) \cdot e^{\frac{-2}{v}}\right)
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v) :precision binary32 (+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))
float code(float u, float v) {
return 1.0f + (v * logf((u + ((1.0f - u) * expf((-2.0f / v))))));
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
code = 1.0e0 + (v * log((u + ((1.0e0 - u) * exp(((-2.0e0) / v))))))
end function
function code(u, v) return Float32(Float32(1.0) + Float32(v * log(Float32(u + Float32(Float32(Float32(1.0) - u) * exp(Float32(Float32(-2.0) / v))))))) end
function tmp = code(u, v) tmp = single(1.0) + (v * log((u + ((single(1.0) - u) * exp((single(-2.0) / v)))))); end
\begin{array}{l}
\\
1 + v \cdot \log \left(u + \left(1 - u\right) \cdot e^{\frac{-2}{v}}\right)
\end{array}
(FPCore (u v) :precision binary32 (fma v (log (fma (- 1.0 u) (exp (/ -2.0 v)) u)) 1.0))
float code(float u, float v) {
return fmaf(v, logf(fmaf((1.0f - u), expf((-2.0f / v)), u)), 1.0f);
}
function code(u, v) return fma(v, log(fma(Float32(Float32(1.0) - u), exp(Float32(Float32(-2.0) / v)), u)), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(v, \log \left(\mathsf{fma}\left(1 - u, e^{\frac{-2}{v}}, u\right)\right), 1\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.5%
+-commutative99.5%
fma-define99.5%
Simplified99.5%
(FPCore (u v) :precision binary32 (fma v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))) 1.0))
float code(float u, float v) {
return fmaf(v, logf((u + ((1.0f - u) * expf((-2.0f / v))))), 1.0f);
}
function code(u, v) return fma(v, log(Float32(u + Float32(Float32(Float32(1.0) - u) * exp(Float32(Float32(-2.0) / v))))), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(v, \log \left(u + \left(1 - u\right) \cdot e^{\frac{-2}{v}}\right), 1\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.5%
+-commutative99.5%
fma-define99.5%
Simplified99.5%
fma-undefine99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (u v) :precision binary32 (+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))
float code(float u, float v) {
return 1.0f + (v * logf((u + ((1.0f - u) * expf((-2.0f / v))))));
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
code = 1.0e0 + (v * log((u + ((1.0e0 - u) * exp(((-2.0e0) / v))))))
end function
function code(u, v) return Float32(Float32(1.0) + Float32(v * log(Float32(u + Float32(Float32(Float32(1.0) - u) * exp(Float32(Float32(-2.0) / v))))))) end
function tmp = code(u, v) tmp = single(1.0) + (v * log((u + ((single(1.0) - u) * exp((single(-2.0) / v)))))); end
\begin{array}{l}
\\
1 + v \cdot \log \left(u + \left(1 - u\right) \cdot e^{\frac{-2}{v}}\right)
\end{array}
Initial program 99.5%
(FPCore (u v) :precision binary32 (+ 1.0 (* v (log (+ u (exp (/ -2.0 v)))))))
float code(float u, float v) {
return 1.0f + (v * logf((u + expf((-2.0f / v)))));
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
code = 1.0e0 + (v * log((u + exp(((-2.0e0) / v)))))
end function
function code(u, v) return Float32(Float32(1.0) + Float32(v * log(Float32(u + exp(Float32(Float32(-2.0) / v)))))) end
function tmp = code(u, v) tmp = single(1.0) + (v * log((u + exp((single(-2.0) / v))))); end
\begin{array}{l}
\\
1 + v \cdot \log \left(u + e^{\frac{-2}{v}}\right)
\end{array}
Initial program 99.5%
Taylor expanded in u around 0 95.8%
(FPCore (u v) :precision binary32 (if (<= v 0.20000000298023224) (+ 1.0 (* v (log u))) (+ (* (* v u) (expm1 (/ 2.0 v))) -1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.20000000298023224f) {
tmp = 1.0f + (v * logf(u));
} else {
tmp = ((v * u) * expm1f((2.0f / v))) + -1.0f;
}
return tmp;
}
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.20000000298023224)) tmp = Float32(Float32(1.0) + Float32(v * log(u))); else tmp = Float32(Float32(Float32(v * u) * expm1(Float32(Float32(2.0) / v))) + Float32(-1.0)); end return tmp end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.20000000298023224:\\
\;\;\;\;1 + v \cdot \log u\\
\mathbf{else}:\\
\;\;\;\;\left(v \cdot u\right) \cdot \mathsf{expm1}\left(\frac{2}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.200000003Initial program 100.0%
Taylor expanded in u around 0 99.9%
Taylor expanded in u around inf 99.5%
mul-1-neg99.5%
distribute-rgt-neg-in99.5%
log-rec99.6%
remove-double-neg99.6%
Simplified99.6%
if 0.200000003 < v Initial program 93.7%
+-commutative93.7%
fma-define93.9%
+-commutative93.9%
fma-define94.0%
Simplified94.0%
Taylor expanded in u around 0 87.1%
associate-*r*87.1%
sub-neg87.1%
metadata-eval87.1%
distribute-lft-in87.1%
rec-exp87.1%
distribute-neg-frac87.1%
metadata-eval87.1%
Applied egg-rr87.1%
distribute-lft-out87.1%
metadata-eval87.1%
sub-neg87.1%
expm1-undefine87.1%
Simplified87.1%
Final simplification98.6%
(FPCore (u v)
:precision binary32
(if (<= v 0.20000000298023224)
(+ 1.0 (* v (log u)))
(+
(*
u
(-
2.0
(/ (+ -2.0 (/ (+ -1.3333333333333333 (/ -0.6666666666666666 v)) v)) v)))
-1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.20000000298023224f) {
tmp = 1.0f + (v * logf(u));
} else {
tmp = (u * (2.0f - ((-2.0f + ((-1.3333333333333333f + (-0.6666666666666666f / v)) / v)) / v))) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.20000000298023224e0) then
tmp = 1.0e0 + (v * log(u))
else
tmp = (u * (2.0e0 - (((-2.0e0) + (((-1.3333333333333333e0) + ((-0.6666666666666666e0) / v)) / v)) / v))) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.20000000298023224)) tmp = Float32(Float32(1.0) + Float32(v * log(u))); else tmp = Float32(Float32(u * Float32(Float32(2.0) - Float32(Float32(Float32(-2.0) + Float32(Float32(Float32(-1.3333333333333333) + Float32(Float32(-0.6666666666666666) / v)) / v)) / v))) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.20000000298023224)) tmp = single(1.0) + (v * log(u)); else tmp = (u * (single(2.0) - ((single(-2.0) + ((single(-1.3333333333333333) + (single(-0.6666666666666666) / v)) / v)) / v))) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.20000000298023224:\\
\;\;\;\;1 + v \cdot \log u\\
\mathbf{else}:\\
\;\;\;\;u \cdot \left(2 - \frac{-2 + \frac{-1.3333333333333333 + \frac{-0.6666666666666666}{v}}{v}}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.200000003Initial program 100.0%
Taylor expanded in u around 0 99.9%
Taylor expanded in u around inf 99.5%
mul-1-neg99.5%
distribute-rgt-neg-in99.5%
log-rec99.6%
remove-double-neg99.6%
Simplified99.6%
if 0.200000003 < v Initial program 93.7%
+-commutative93.7%
fma-define93.9%
+-commutative93.9%
fma-define94.0%
Simplified94.0%
Taylor expanded in u around 0 87.1%
Taylor expanded in v around -inf 83.5%
distribute-lft-in83.5%
mul-1-neg83.5%
fmm-def83.5%
un-div-inv83.5%
metadata-eval83.5%
Applied egg-rr83.5%
distribute-lft-out83.5%
unsub-neg83.5%
fma-undefine83.5%
neg-mul-183.5%
distribute-neg-frac83.5%
distribute-neg-in83.5%
metadata-eval83.5%
distribute-neg-frac83.5%
metadata-eval83.5%
Simplified83.5%
Final simplification98.3%
(FPCore (u v)
:precision binary32
(if (<= v 0.15000000596046448)
1.0
(+
(*
u
(-
2.0
(/ (+ -2.0 (/ (+ -1.3333333333333333 (/ -0.6666666666666666 v)) v)) v)))
-1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = (u * (2.0f - ((-2.0f + ((-1.3333333333333333f + (-0.6666666666666666f / v)) / v)) / v))) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = (u * (2.0e0 - (((-2.0e0) + (((-1.3333333333333333e0) + ((-0.6666666666666666e0) / v)) / v)) / v))) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(Float32(u * Float32(Float32(2.0) - Float32(Float32(Float32(-2.0) + Float32(Float32(Float32(-1.3333333333333333) + Float32(Float32(-0.6666666666666666) / v)) / v)) / v))) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = (u * (single(2.0) - ((single(-2.0) + ((single(-1.3333333333333333) + (single(-0.6666666666666666) / v)) / v)) / v))) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;u \cdot \left(2 - \frac{-2 + \frac{-1.3333333333333333 + \frac{-0.6666666666666666}{v}}{v}}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 79.5%
Taylor expanded in v around -inf 78.3%
distribute-lft-in78.3%
mul-1-neg78.3%
fmm-def78.3%
un-div-inv78.3%
metadata-eval78.3%
Applied egg-rr78.3%
distribute-lft-out78.3%
unsub-neg78.3%
fma-undefine78.3%
neg-mul-178.3%
distribute-neg-frac78.3%
distribute-neg-in78.3%
metadata-eval78.3%
distribute-neg-frac78.3%
metadata-eval78.3%
Simplified78.3%
Final simplification93.7%
(FPCore (u v) :precision binary32 (if (<= v 0.15000000596046448) 1.0 (+ (* u (+ 2.0 (/ (+ 2.0 (/ 1.3333333333333333 v)) v))) -1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = (u * (2.0f + ((2.0f + (1.3333333333333333f / v)) / v))) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = (u * (2.0e0 + ((2.0e0 + (1.3333333333333333e0 / v)) / v))) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(Float32(u * Float32(Float32(2.0) + Float32(Float32(Float32(2.0) + Float32(Float32(1.3333333333333333) / v)) / v))) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = (u * (single(2.0) + ((single(2.0) + (single(1.3333333333333333) / v)) / v))) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;u \cdot \left(2 + \frac{2 + \frac{1.3333333333333333}{v}}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 79.5%
Taylor expanded in v around -inf 78.3%
Taylor expanded in v around inf 75.7%
associate-*r/75.7%
metadata-eval75.7%
Simplified75.7%
Final simplification93.4%
(FPCore (u v) :precision binary32 (if (<= v 0.15000000596046448) 1.0 (+ (* u (+ 2.0 (/ 2.0 v))) -1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = (u * (2.0f + (2.0f / v))) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = (u * (2.0e0 + (2.0e0 / v))) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(Float32(u * Float32(Float32(2.0) + Float32(Float32(2.0) / v))) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = (u * (single(2.0) + (single(2.0) / v))) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;u \cdot \left(2 + \frac{2}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 79.5%
Taylor expanded in v around inf 71.4%
associate-*r/71.4%
metadata-eval71.4%
Simplified71.4%
Final simplification93.1%
(FPCore (u v) :precision binary32 (if (<= v 0.15000000596046448) 1.0 (+ (* 2.0 (+ u (/ u v))) -1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = (2.0f * (u + (u / v))) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = (2.0e0 * (u + (u / v))) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(Float32(Float32(2.0) * Float32(u + Float32(u / v))) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = (single(2.0) * (u + (u / v))) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(u + \frac{u}{v}\right) + -1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 79.5%
Taylor expanded in v around inf 71.4%
distribute-lft-out71.4%
Simplified71.4%
Final simplification93.1%
(FPCore (u v) :precision binary32 (if (<= v 0.15000000596046448) 1.0 (+ (* u 2.0) -1.0)))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = (u * 2.0f) + -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = (u * 2.0e0) + (-1.0e0)
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(Float32(u * Float32(2.0)) + Float32(-1.0)); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = (u * single(2.0)) + single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;u \cdot 2 + -1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 79.5%
Taylor expanded in v around inf 60.6%
Final simplification92.1%
(FPCore (u v) :precision binary32 (if (<= v 0.15000000596046448) 1.0 -1.0))
float code(float u, float v) {
float tmp;
if (v <= 0.15000000596046448f) {
tmp = 1.0f;
} else {
tmp = -1.0f;
}
return tmp;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
real(4) :: tmp
if (v <= 0.15000000596046448e0) then
tmp = 1.0e0
else
tmp = -1.0e0
end if
code = tmp
end function
function code(u, v) tmp = Float32(0.0) if (v <= Float32(0.15000000596046448)) tmp = Float32(1.0); else tmp = Float32(-1.0); end return tmp end
function tmp_2 = code(u, v) tmp = single(0.0); if (v <= single(0.15000000596046448)) tmp = single(1.0); else tmp = single(-1.0); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.15000000596046448:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if v < 0.150000006Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
fma-undefine100.0%
+-commutative100.0%
add-log-exp99.9%
*-commutative99.9%
exp-to-pow100.0%
+-commutative100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in v around 0 95.1%
if 0.150000006 < v Initial program 93.8%
+-commutative93.8%
fma-define94.1%
+-commutative94.1%
fma-define94.3%
Simplified94.3%
Taylor expanded in u around 0 51.0%
(FPCore (u v) :precision binary32 -1.0)
float code(float u, float v) {
return -1.0f;
}
real(4) function code(u, v)
real(4), intent (in) :: u
real(4), intent (in) :: v
code = -1.0e0
end function
function code(u, v) return Float32(-1.0) end
function tmp = code(u, v) tmp = single(-1.0); end
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.5%
+-commutative99.5%
fma-define99.5%
Simplified99.5%
Taylor expanded in u around 0 7.3%
herbie shell --seed 2024169
(FPCore (u v)
:name "HairBSDF, sample_f, cosTheta"
:precision binary32
:pre (and (and (<= 1e-5 u) (<= u 1.0)) (and (<= 0.0 v) (<= v 109.746574)))
(+ 1.0 (* v (log (+ u (* (- 1.0 u) (exp (/ -2.0 v))))))))