
(FPCore (x s) :precision binary32 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0))) (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
float t_0 = expf((-fabsf(x) / s));
float t_1 = 1.0f + t_0;
return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
t_0 = exp((-abs(x) / s))
t_1 = 1.0e0 + t_0
code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s) t_0 = exp(Float32(Float32(-abs(x)) / s)) t_1 = Float32(Float32(1.0) + t_0) return Float32(t_0 / Float32(Float32(s * t_1) * t_1)) end
function tmp = code(x, s) t_0 = exp((-abs(x) / s)); t_1 = single(1.0) + t_0; tmp = t_0 / ((s * t_1) * t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t_0\\
\frac{t_0}{\left(s \cdot t_1\right) \cdot t_1}
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x s) :precision binary32 (let* ((t_0 (exp (/ (- (fabs x)) s))) (t_1 (+ 1.0 t_0))) (/ t_0 (* (* s t_1) t_1))))
float code(float x, float s) {
float t_0 = expf((-fabsf(x) / s));
float t_1 = 1.0f + t_0;
return t_0 / ((s * t_1) * t_1);
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: t_1
t_0 = exp((-abs(x) / s))
t_1 = 1.0e0 + t_0
code = t_0 / ((s * t_1) * t_1)
end function
function code(x, s) t_0 = exp(Float32(Float32(-abs(x)) / s)) t_1 = Float32(Float32(1.0) + t_0) return Float32(t_0 / Float32(Float32(s * t_1) * t_1)) end
function tmp = code(x, s) t_0 = exp((-abs(x) / s)); t_1 = single(1.0) + t_0; tmp = t_0 / ((s * t_1) * t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\frac{-\left|x\right|}{s}}\\
t_1 := 1 + t_0\\
\frac{t_0}{\left(s \cdot t_1\right) \cdot t_1}
\end{array}
\end{array}
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ (/ 1.0 s) (+ (pow E (/ x s)) (+ (exp (/ (fabs x) (- s))) 2.0))))
x = abs(x);
float code(float x, float s) {
return (1.0f / s) / (powf(((float) M_E), (x / s)) + (expf((fabsf(x) / -s)) + 2.0f));
}
x = abs(x) function code(x, s) return Float32(Float32(Float32(1.0) / s) / Float32((Float32(exp(1)) ^ Float32(x / s)) + Float32(exp(Float32(abs(x) / Float32(-s))) + Float32(2.0)))) end
x = abs(x) function tmp = code(x, s) tmp = (single(1.0) / s) / ((single(2.71828182845904523536) ^ (x / s)) + (exp((abs(x) / -s)) + single(2.0))); end
\begin{array}{l}
x = |x|\\
\\
\frac{\frac{1}{s}}{{e}^{\left(\frac{x}{s}\right)} + \left(e^{\frac{\left|x\right|}{-s}} + 2\right)}
\end{array}
Initial program 99.8%
Simplified99.8%
expm1-log1p-u99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
log1p-def99.8%
*-rgt-identity99.8%
*-rgt-identity99.8%
unpow199.8%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow66.2%
unpow166.2%
Simplified66.2%
expm1-log1p-u66.2%
*-un-lft-identity66.2%
exp-prod66.2%
exp-1-e66.2%
Applied egg-rr66.2%
Final simplification66.2%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ 1.0 (* s (+ 2.0 (+ (exp (/ (fabs x) (- s))) (exp (/ (fabs x) s)))))))
x = abs(x);
float code(float x, float s) {
return 1.0f / (s * (2.0f + (expf((fabsf(x) / -s)) + expf((fabsf(x) / s)))));
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (s * (2.0e0 + (exp((abs(x) / -s)) + exp((abs(x) / s)))))
end function
x = abs(x) function code(x, s) return Float32(Float32(1.0) / Float32(s * Float32(Float32(2.0) + Float32(exp(Float32(abs(x) / Float32(-s))) + exp(Float32(abs(x) / s)))))) end
x = abs(x) function tmp = code(x, s) tmp = single(1.0) / (s * (single(2.0) + (exp((abs(x) / -s)) + exp((abs(x) / s))))); end
\begin{array}{l}
x = |x|\\
\\
\frac{1}{s \cdot \left(2 + \left(e^{\frac{\left|x\right|}{-s}} + e^{\frac{\left|x\right|}{s}}\right)\right)}
\end{array}
Initial program 99.8%
Simplified99.8%
expm1-log1p-u98.1%
expm1-udef98.1%
Applied egg-rr98.1%
expm1-def98.1%
expm1-log1p99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ 1.0 (/ (+ (exp (/ x s)) 3.0) (/ 1.0 s))))
x = abs(x);
float code(float x, float s) {
return 1.0f / ((expf((x / s)) + 3.0f) / (1.0f / s));
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((exp((x / s)) + 3.0e0) / (1.0e0 / s))
end function
x = abs(x) function code(x, s) return Float32(Float32(1.0) / Float32(Float32(exp(Float32(x / s)) + Float32(3.0)) / Float32(Float32(1.0) / s))) end
x = abs(x) function tmp = code(x, s) tmp = single(1.0) / ((exp((x / s)) + single(3.0)) / (single(1.0) / s)); end
\begin{array}{l}
x = |x|\\
\\
\frac{1}{\frac{e^{\frac{x}{s}} + 3}{\frac{1}{s}}}
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in s around inf 96.8%
add-cube-cbrt96.4%
pow396.3%
+-commutative96.3%
add-sqr-sqrt96.3%
add-sqr-sqrt96.3%
add-sqr-sqrt54.5%
fabs-sqr54.5%
add-sqr-sqrt64.5%
Applied egg-rr64.5%
rem-cube-cbrt64.9%
clear-num64.9%
+-commutative64.9%
Applied egg-rr64.9%
Final simplification64.9%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ (/ 1.0 s) (+ 2.0 (* 2.0 (cosh (/ x s))))))
x = abs(x);
float code(float x, float s) {
return (1.0f / s) / (2.0f + (2.0f * coshf((x / s))));
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = (1.0e0 / s) / (2.0e0 + (2.0e0 * cosh((x / s))))
end function
x = abs(x) function code(x, s) return Float32(Float32(Float32(1.0) / s) / Float32(Float32(2.0) + Float32(Float32(2.0) * cosh(Float32(x / s))))) end
x = abs(x) function tmp = code(x, s) tmp = (single(1.0) / s) / (single(2.0) + (single(2.0) * cosh((x / s)))); end
\begin{array}{l}
x = |x|\\
\\
\frac{\frac{1}{s}}{2 + 2 \cdot \cosh \left(\frac{x}{s}\right)}
\end{array}
Initial program 99.8%
Simplified99.8%
expm1-log1p-u98.1%
expm1-udef98.1%
Applied egg-rr98.1%
expm1-def98.1%
expm1-log1p99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in s around 0 99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+l+99.8%
*-rgt-identity99.8%
*-rgt-identity99.8%
unpow199.8%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow66.2%
unpow166.2%
mul-1-neg66.2%
distribute-frac-neg66.2%
unpow166.2%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
expm1-log1p-u98.1%
expm1-udef98.1%
distribute-frac-neg98.1%
cosh-undef98.1%
Applied egg-rr98.1%
expm1-def98.1%
expm1-log1p99.8%
Simplified99.8%
Final simplification99.8%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ 1.0 (* s (+ (exp (/ x s)) 3.0))))
x = abs(x);
float code(float x, float s) {
return 1.0f / (s * (expf((x / s)) + 3.0f));
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (s * (exp((x / s)) + 3.0e0))
end function
x = abs(x) function code(x, s) return Float32(Float32(1.0) / Float32(s * Float32(exp(Float32(x / s)) + Float32(3.0)))) end
x = abs(x) function tmp = code(x, s) tmp = single(1.0) / (s * (exp((x / s)) + single(3.0))); end
\begin{array}{l}
x = |x|\\
\\
\frac{1}{s \cdot \left(e^{\frac{x}{s}} + 3\right)}
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in s around inf 96.8%
expm1-log1p-u95.7%
expm1-udef95.6%
+-commutative95.6%
add-sqr-sqrt95.6%
add-sqr-sqrt95.6%
add-sqr-sqrt54.1%
fabs-sqr54.1%
add-sqr-sqrt63.8%
Applied egg-rr63.8%
expm1-def63.8%
expm1-log1p64.9%
associate-/r*64.9%
+-commutative64.9%
Simplified64.9%
Final simplification64.9%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ (/ 1.0 s) (+ (exp (/ x s)) 3.0)))
x = abs(x);
float code(float x, float s) {
return (1.0f / s) / (expf((x / s)) + 3.0f);
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = (1.0e0 / s) / (exp((x / s)) + 3.0e0)
end function
x = abs(x) function code(x, s) return Float32(Float32(Float32(1.0) / s) / Float32(exp(Float32(x / s)) + Float32(3.0))) end
x = abs(x) function tmp = code(x, s) tmp = (single(1.0) / s) / (exp((x / s)) + single(3.0)); end
\begin{array}{l}
x = |x|\\
\\
\frac{\frac{1}{s}}{e^{\frac{x}{s}} + 3}
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in s around inf 96.8%
expm1-log1p-u95.7%
expm1-udef95.6%
+-commutative95.6%
add-sqr-sqrt95.6%
add-sqr-sqrt95.6%
add-sqr-sqrt54.1%
fabs-sqr54.1%
add-sqr-sqrt63.8%
Applied egg-rr63.8%
expm1-def63.8%
expm1-log1p64.9%
+-commutative64.9%
Simplified64.9%
Final simplification64.9%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (if (<= x 9.999999998199587e-24) (/ (/ 1.0 s) (+ (* (/ x s) (/ x s)) 4.0)) (/ (/ 1.0 s) (+ 4.0 (/ (* x x) (* s s))))))
x = abs(x);
float code(float x, float s) {
float tmp;
if (x <= 9.999999998199587e-24f) {
tmp = (1.0f / s) / (((x / s) * (x / s)) + 4.0f);
} else {
tmp = (1.0f / s) / (4.0f + ((x * x) / (s * s)));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 9.999999998199587e-24) then
tmp = (1.0e0 / s) / (((x / s) * (x / s)) + 4.0e0)
else
tmp = (1.0e0 / s) / (4.0e0 + ((x * x) / (s * s)))
end if
code = tmp
end function
x = abs(x) function code(x, s) tmp = Float32(0.0) if (x <= Float32(9.999999998199587e-24)) tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(Float32(x / s) * Float32(x / s)) + Float32(4.0))); else tmp = Float32(Float32(Float32(1.0) / s) / Float32(Float32(4.0) + Float32(Float32(x * x) / Float32(s * s)))); end return tmp end
x = abs(x) function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(9.999999998199587e-24)) tmp = (single(1.0) / s) / (((x / s) * (x / s)) + single(4.0)); else tmp = (single(1.0) / s) / (single(4.0) + ((x * x) / (s * s))); end tmp_2 = tmp; end
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.999999998199587 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{1}{s}}{\frac{x}{s} \cdot \frac{x}{s} + 4}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{s}}{4 + \frac{x \cdot x}{s \cdot s}}\\
\end{array}
\end{array}
if x < 1e-23Initial program 99.7%
Simplified99.7%
expm1-log1p-u97.1%
expm1-udef97.1%
Applied egg-rr97.1%
expm1-def97.1%
expm1-log1p99.7%
associate-/r*99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Simplified99.7%
Taylor expanded in s around 0 99.7%
associate-/r*99.7%
+-commutative99.7%
associate-+l+99.7%
*-rgt-identity99.7%
*-rgt-identity99.7%
unpow199.7%
sqr-pow18.7%
fabs-sqr18.7%
sqr-pow37.4%
unpow137.4%
mul-1-neg37.4%
distribute-frac-neg37.4%
unpow137.4%
sqr-pow18.7%
fabs-sqr18.7%
sqr-pow99.7%
unpow199.7%
Simplified99.7%
Taylor expanded in x around 0 73.7%
+-commutative73.7%
unpow273.7%
unpow273.7%
times-frac79.7%
Simplified79.7%
if 1e-23 < x Initial program 99.9%
Simplified99.9%
expm1-log1p-u99.4%
expm1-udef99.3%
Applied egg-rr99.3%
expm1-def99.4%
expm1-log1p99.9%
associate-/r*99.9%
+-commutative99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in s around 0 99.9%
associate-/r*99.9%
+-commutative99.9%
associate-+l+99.9%
*-rgt-identity99.9%
*-rgt-identity99.9%
unpow199.9%
sqr-pow99.9%
fabs-sqr99.9%
sqr-pow99.9%
unpow199.9%
mul-1-neg99.9%
distribute-frac-neg99.9%
unpow199.9%
sqr-pow99.9%
fabs-sqr99.9%
sqr-pow99.9%
unpow199.9%
Simplified99.9%
Taylor expanded in x around 0 84.2%
+-commutative84.2%
unpow284.2%
unpow284.2%
Simplified84.2%
Final simplification81.7%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ (/ 1.0 s) (+ (* (/ x s) (/ x s)) 4.0)))
x = abs(x);
float code(float x, float s) {
return (1.0f / s) / (((x / s) * (x / s)) + 4.0f);
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = (1.0e0 / s) / (((x / s) * (x / s)) + 4.0e0)
end function
x = abs(x) function code(x, s) return Float32(Float32(Float32(1.0) / s) / Float32(Float32(Float32(x / s) * Float32(x / s)) + Float32(4.0))) end
x = abs(x) function tmp = code(x, s) tmp = (single(1.0) / s) / (((x / s) * (x / s)) + single(4.0)); end
\begin{array}{l}
x = |x|\\
\\
\frac{\frac{1}{s}}{\frac{x}{s} \cdot \frac{x}{s} + 4}
\end{array}
Initial program 99.8%
Simplified99.8%
expm1-log1p-u98.1%
expm1-udef98.1%
Applied egg-rr98.1%
expm1-def98.1%
expm1-log1p99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in s around 0 99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+l+99.8%
*-rgt-identity99.8%
*-rgt-identity99.8%
unpow199.8%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow66.2%
unpow166.2%
mul-1-neg66.2%
distribute-frac-neg66.2%
unpow166.2%
sqr-pow56.1%
fabs-sqr56.1%
sqr-pow99.8%
unpow199.8%
Simplified99.8%
Taylor expanded in x around 0 78.5%
+-commutative78.5%
unpow278.5%
unpow278.5%
times-frac80.0%
Simplified80.0%
Final simplification80.0%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ 1.0 (+ (* s 4.0) (* x (/ x s)))))
x = abs(x);
float code(float x, float s) {
return 1.0f / ((s * 4.0f) + (x * (x / s)));
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / ((s * 4.0e0) + (x * (x / s)))
end function
x = abs(x) function code(x, s) return Float32(Float32(1.0) / Float32(Float32(s * Float32(4.0)) + Float32(x * Float32(x / s)))) end
x = abs(x) function tmp = code(x, s) tmp = single(1.0) / ((s * single(4.0)) + (x * (x / s))); end
\begin{array}{l}
x = |x|\\
\\
\frac{1}{s \cdot 4 + x \cdot \frac{x}{s}}
\end{array}
Initial program 99.8%
Simplified99.8%
expm1-log1p-u98.1%
expm1-udef98.1%
Applied egg-rr98.1%
expm1-def98.1%
expm1-log1p99.8%
associate-/r*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in s around inf 66.4%
associate-+r+66.4%
distribute-lft1-in66.4%
metadata-eval66.4%
mul0-lft66.4%
+-lft-identity66.4%
*-commutative66.4%
fma-def66.4%
unpow266.4%
sqr-abs66.4%
Simplified66.4%
fma-udef66.4%
associate-/l*66.8%
div-inv66.8%
clear-num66.8%
Applied egg-rr66.8%
Final simplification66.8%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (if (<= x 2.9999999242136255e-5) (/ 0.25 s) (/ 1.0 (/ x (/ s x)))))
x = abs(x);
float code(float x, float s) {
float tmp;
if (x <= 2.9999999242136255e-5f) {
tmp = 0.25f / s;
} else {
tmp = 1.0f / (x / (s / x));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 2.9999999242136255e-5) then
tmp = 0.25e0 / s
else
tmp = 1.0e0 / (x / (s / x))
end if
code = tmp
end function
x = abs(x) function code(x, s) tmp = Float32(0.0) if (x <= Float32(2.9999999242136255e-5)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(Float32(1.0) / Float32(x / Float32(s / x))); end return tmp end
x = abs(x) function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(2.9999999242136255e-5)) tmp = single(0.25) / s; else tmp = single(1.0) / (x / (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9999999242136255 \cdot 10^{-5}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{s}{x}}}\\
\end{array}
\end{array}
if x < 2.99999992e-5Initial program 99.7%
Simplified99.7%
Taylor expanded in s around inf 36.5%
if 2.99999992e-5 < x Initial program 100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
associate-/r*100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in s around inf 68.5%
associate-+r+68.5%
distribute-lft1-in68.5%
metadata-eval68.5%
mul0-lft68.5%
+-lft-identity68.5%
*-commutative68.5%
fma-def68.5%
unpow268.5%
sqr-abs68.5%
Simplified68.5%
Taylor expanded in s around 0 67.0%
unpow267.0%
Simplified67.0%
clear-num68.5%
inv-pow68.5%
Applied egg-rr68.5%
unpow-168.5%
associate-/l*68.5%
Simplified68.5%
Final simplification47.6%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (if (<= x 2.9999999242136255e-5) (/ 0.25 s) (/ s (* x x))))
x = abs(x);
float code(float x, float s) {
float tmp;
if (x <= 2.9999999242136255e-5f) {
tmp = 0.25f / s;
} else {
tmp = s / (x * x);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= 2.9999999242136255e-5) then
tmp = 0.25e0 / s
else
tmp = s / (x * x)
end if
code = tmp
end function
x = abs(x) function code(x, s) tmp = Float32(0.0) if (x <= Float32(2.9999999242136255e-5)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(s / Float32(x * x)); end return tmp end
x = abs(x) function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(2.9999999242136255e-5)) tmp = single(0.25) / s; else tmp = s / (x * x); end tmp_2 = tmp; end
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9999999242136255 \cdot 10^{-5}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;\frac{s}{x \cdot x}\\
\end{array}
\end{array}
if x < 2.99999992e-5Initial program 99.7%
Simplified99.7%
Taylor expanded in s around inf 36.5%
if 2.99999992e-5 < x Initial program 100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
associate-/r*100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Simplified100.0%
Taylor expanded in s around inf 68.5%
associate-+r+68.5%
distribute-lft1-in68.5%
metadata-eval68.5%
mul0-lft68.5%
+-lft-identity68.5%
*-commutative68.5%
fma-def68.5%
unpow268.5%
sqr-abs68.5%
Simplified68.5%
Taylor expanded in s around 0 67.0%
unpow267.0%
Simplified67.0%
Final simplification47.1%
NOTE: x should be positive before calling this function (FPCore (x s) :precision binary32 (/ 0.25 s))
x = abs(x);
float code(float x, float s) {
return 0.25f / s;
}
NOTE: x should be positive before calling this function
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 0.25e0 / s
end function
x = abs(x) function code(x, s) return Float32(Float32(0.25) / s) end
x = abs(x) function tmp = code(x, s) tmp = single(0.25) / s; end
\begin{array}{l}
x = |x|\\
\\
\frac{0.25}{s}
\end{array}
Initial program 99.8%
Simplified99.8%
Taylor expanded in s around inf 25.3%
Final simplification25.3%
herbie shell --seed 2023229
(FPCore (x s)
:name "Logistic distribution"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ (exp (/ (- (fabs x)) s)) (* (* s (+ 1.0 (exp (/ (- (fabs x)) s)))) (+ 1.0 (exp (/ (- (fabs x)) s))))))