
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
return 1.0f / (1.0f + expf((-x / s)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (1.0e0 + exp((-x / s)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
return 1.0f / (1.0f + expf((-x / s)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (1.0e0 + exp((-x / s)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}
(FPCore (x s) :precision binary32 (/ 1.0 (+ 1.0 (exp (/ (- x) s)))))
float code(float x, float s) {
return 1.0f / (1.0f + expf((-x / s)));
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 1.0e0 / (1.0e0 + exp((-x / s)))
end function
function code(x, s) return Float32(Float32(1.0) / Float32(Float32(1.0) + exp(Float32(Float32(-x) / s)))) end
function tmp = code(x, s) tmp = single(1.0) / (single(1.0) + exp((-x / s))); end
\begin{array}{l}
\\
\frac{1}{1 + e^{\frac{-x}{s}}}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 0.006000000052154064) 0.5 (/ 1.0 (+ 2.0 (* 0.5 (* x (* x (/ (/ 1.0 s) s))))))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 0.006000000052154064f) {
tmp = 0.5f;
} else {
tmp = 1.0f / (2.0f + (0.5f * (x * (x * ((1.0f / s) / s)))));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 0.006000000052154064e0) then
tmp = 0.5e0
else
tmp = 1.0e0 / (2.0e0 + (0.5e0 * (x * (x * ((1.0e0 / s) / s)))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(0.006000000052154064)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(Float32(0.5) * Float32(x * Float32(x * Float32(Float32(Float32(1.0) / s) / s)))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(0.006000000052154064)) tmp = single(0.5); else tmp = single(1.0) / (single(2.0) + (single(0.5) * (x * (x * ((single(1.0) / s) / s))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 0.006000000052154064:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + 0.5 \cdot \left(x \cdot \left(x \cdot \frac{\frac{1}{s}}{s}\right)\right)}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 0.00600000005Initial program 99.9%
Taylor expanded in x around 0 51.7%
if 0.00600000005 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0 75.4%
+-commutative75.4%
mul-1-neg75.4%
unsub-neg75.4%
unpow275.4%
unpow275.4%
times-frac66.9%
Simplified66.9%
clear-num66.9%
frac-times70.4%
*-un-lft-identity70.4%
Applied egg-rr70.4%
Taylor expanded in x around inf 73.7%
unpow273.7%
unpow273.7%
associate-*r/78.8%
Simplified78.8%
associate-/r*73.2%
div-inv73.2%
*-un-lft-identity73.2%
times-frac79.8%
Applied egg-rr79.8%
Final simplification62.5%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 80000.0) 0.5 (/ 1.0 (/ (* x x) (* 2.0 (* s s))))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 80000.0f) {
tmp = 0.5f;
} else {
tmp = 1.0f / ((x * x) / (2.0f * (s * s)));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 80000.0e0) then
tmp = 0.5e0
else
tmp = 1.0e0 / ((x * x) / (2.0e0 * (s * s)))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(80000.0)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) / Float32(Float32(x * x) / Float32(Float32(2.0) * Float32(s * s)))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(80000.0)) tmp = single(0.5); else tmp = single(1.0) / ((x * x) / (single(2.0) * (s * s))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 80000:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x}{2 \cdot \left(s \cdot s\right)}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 8e4Initial program 99.8%
Taylor expanded in x around 0 49.6%
if 8e4 < (/.f32 (neg.f32 x) s) Initial program 100.0%
Taylor expanded in x around 0 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
unpow281.1%
unpow281.1%
times-frac71.2%
Simplified71.2%
Taylor expanded in x around inf 79.9%
unpow279.9%
unpow279.9%
Simplified79.9%
associate-*r/79.9%
clear-num81.1%
Applied egg-rr81.1%
Final simplification60.2%
(FPCore (x s) :precision binary32 (if (<= (- x) 4.999999898305949e-32) 0.5 (/ 1.0 (+ 2.0 (* 0.5 (* x (/ x (* s s))))))))
float code(float x, float s) {
float tmp;
if (-x <= 4.999999898305949e-32f) {
tmp = 0.5f;
} else {
tmp = 1.0f / (2.0f + (0.5f * (x * (x / (s * s)))));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (-x <= 4.999999898305949e-32) then
tmp = 0.5e0
else
tmp = 1.0e0 / (2.0e0 + (0.5e0 * (x * (x / (s * s)))))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(-x) <= Float32(4.999999898305949e-32)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) + Float32(Float32(0.5) * Float32(x * Float32(x / Float32(s * s)))))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (-x <= single(4.999999898305949e-32)) tmp = single(0.5); else tmp = single(1.0) / (single(2.0) + (single(0.5) * (x * (x / (s * s))))); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-x \leq 4.999999898305949 \cdot 10^{-32}:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + 0.5 \cdot \left(x \cdot \frac{x}{s \cdot s}\right)}\\
\end{array}
\end{array}
if (neg.f32 x) < 4.9999999e-32Initial program 100.0%
Taylor expanded in x around 0 46.7%
if 4.9999999e-32 < (neg.f32 x) Initial program 99.7%
Taylor expanded in x around 0 78.9%
+-commutative78.9%
mul-1-neg78.9%
unsub-neg78.9%
unpow278.9%
unpow278.9%
times-frac71.7%
Simplified71.7%
clear-num71.7%
frac-times74.7%
*-un-lft-identity74.7%
Applied egg-rr74.7%
Taylor expanded in x around inf 76.6%
unpow276.6%
unpow276.6%
associate-*r/81.0%
Simplified81.0%
Final simplification62.1%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 2.0) 0.5 (* 2.0 (* s (/ (/ s x) x)))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 2.0f) {
tmp = 0.5f;
} else {
tmp = 2.0f * (s * ((s / x) / x));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 2.0e0) then
tmp = 0.5e0
else
tmp = 2.0e0 * (s * ((s / x) / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(2.0)) tmp = Float32(0.5); else tmp = Float32(Float32(2.0) * Float32(s * Float32(Float32(s / x) / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(2.0)) tmp = single(0.5); else tmp = single(2.0) * (s * ((s / x) / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(s \cdot \frac{\frac{s}{x}}{x}\right)\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 2Initial program 99.9%
Taylor expanded in x around 0 51.4%
if 2 < (/.f32 (neg.f32 x) s) Initial program 99.9%
Taylor expanded in x around 0 75.4%
+-commutative75.4%
mul-1-neg75.4%
unsub-neg75.4%
unpow275.4%
unpow275.4%
times-frac66.5%
Simplified66.5%
Taylor expanded in x around inf 74.3%
unpow274.3%
unpow274.3%
Simplified74.3%
associate-/l*64.5%
div-inv64.5%
Applied egg-rr64.5%
Taylor expanded in x around 0 64.5%
unpow264.5%
associate-/r*64.8%
Simplified64.8%
Final simplification56.3%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 2.0) 0.5 (* 2.0 (* (/ s x) (/ s x)))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 2.0f) {
tmp = 0.5f;
} else {
tmp = 2.0f * ((s / x) * (s / x));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 2.0e0) then
tmp = 0.5e0
else
tmp = 2.0e0 * ((s / x) * (s / x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(2.0)) tmp = Float32(0.5); else tmp = Float32(Float32(2.0) * Float32(Float32(s / x) * Float32(s / x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(2.0)) tmp = single(0.5); else tmp = single(2.0) * ((s / x) * (s / x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{s}{x} \cdot \frac{s}{x}\right)\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 2Initial program 99.9%
Taylor expanded in x around 0 51.4%
if 2 < (/.f32 (neg.f32 x) s) Initial program 99.9%
Taylor expanded in x around 0 75.4%
+-commutative75.4%
mul-1-neg75.4%
unsub-neg75.4%
unpow275.4%
unpow275.4%
times-frac66.5%
Simplified66.5%
Taylor expanded in x around inf 74.3%
unpow274.3%
unpow274.3%
times-frac64.8%
Simplified64.8%
Final simplification56.3%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 80000.0) 0.5 (* 2.0 (/ (* s s) (* x x)))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 80000.0f) {
tmp = 0.5f;
} else {
tmp = 2.0f * ((s * s) / (x * x));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 80000.0e0) then
tmp = 0.5e0
else
tmp = 2.0e0 * ((s * s) / (x * x))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(80000.0)) tmp = Float32(0.5); else tmp = Float32(Float32(2.0) * Float32(Float32(s * s) / Float32(x * x))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(80000.0)) tmp = single(0.5); else tmp = single(2.0) * ((s * s) / (x * x)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 80000:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{s \cdot s}{x \cdot x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 8e4Initial program 99.8%
Taylor expanded in x around 0 49.6%
if 8e4 < (/.f32 (neg.f32 x) s) Initial program 100.0%
Taylor expanded in x around 0 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
unpow281.1%
unpow281.1%
times-frac71.2%
Simplified71.2%
Taylor expanded in x around inf 79.9%
unpow279.9%
unpow279.9%
Simplified79.9%
Final simplification59.8%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) 80000.0) 0.5 (/ (* 2.0 (* s s)) (* x x))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= 80000.0f) {
tmp = 0.5f;
} else {
tmp = (2.0f * (s * s)) / (x * x);
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= 80000.0e0) then
tmp = 0.5e0
else
tmp = (2.0e0 * (s * s)) / (x * x)
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(80000.0)) tmp = Float32(0.5); else tmp = Float32(Float32(Float32(2.0) * Float32(s * s)) / Float32(x * x)); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(80000.0)) tmp = single(0.5); else tmp = (single(2.0) * (s * s)) / (x * x); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq 80000:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(s \cdot s\right)}{x \cdot x}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 8e4Initial program 99.8%
Taylor expanded in x around 0 49.6%
if 8e4 < (/.f32 (neg.f32 x) s) Initial program 100.0%
Taylor expanded in x around 0 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
unpow281.1%
unpow281.1%
times-frac71.2%
Simplified71.2%
Taylor expanded in x around inf 79.9%
unpow279.9%
unpow279.9%
Simplified79.9%
associate-*r/79.9%
Applied egg-rr79.9%
Final simplification59.8%
(FPCore (x s) :precision binary32 (if (<= (/ (- x) s) -5.0) 0.5 (/ 1.0 (- 2.0 (/ x s)))))
float code(float x, float s) {
float tmp;
if ((-x / s) <= -5.0f) {
tmp = 0.5f;
} else {
tmp = 1.0f / (2.0f - (x / s));
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if ((-x / s) <= (-5.0e0)) then
tmp = 0.5e0
else
tmp = 1.0e0 / (2.0e0 - (x / s))
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (Float32(Float32(-x) / s) <= Float32(-5.0)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) / Float32(Float32(2.0) - Float32(x / s))); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if ((-x / s) <= single(-5.0)) tmp = single(0.5); else tmp = single(1.0) / (single(2.0) - (x / s)); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{-x}{s} \leq -5:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 - \frac{x}{s}}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < -5Initial program 100.0%
Taylor expanded in x around 0 28.1%
if -5 < (/.f32 (neg.f32 x) s) Initial program 99.8%
Taylor expanded in x around 0 57.7%
mul-1-neg57.7%
unsub-neg57.7%
Simplified57.7%
Final simplification46.2%
(FPCore (x s) :precision binary32 (let* ((t_0 (/ (- x) s))) (if (<= t_0 2.0) 0.5 (/ 1.0 t_0))))
float code(float x, float s) {
float t_0 = -x / s;
float tmp;
if (t_0 <= 2.0f) {
tmp = 0.5f;
} else {
tmp = 1.0f / t_0;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: t_0
real(4) :: tmp
t_0 = -x / s
if (t_0 <= 2.0e0) then
tmp = 0.5e0
else
tmp = 1.0e0 / t_0
end if
code = tmp
end function
function code(x, s) t_0 = Float32(Float32(-x) / s) tmp = Float32(0.0) if (t_0 <= Float32(2.0)) tmp = Float32(0.5); else tmp = Float32(Float32(1.0) / t_0); end return tmp end
function tmp_2 = code(x, s) t_0 = -x / s; tmp = single(0.0); if (t_0 <= single(2.0)) tmp = single(0.5); else tmp = single(1.0) / t_0; end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{s}\\
\mathbf{if}\;t_0 \leq 2:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0}\\
\end{array}
\end{array}
if (/.f32 (neg.f32 x) s) < 2Initial program 99.9%
Taylor expanded in x around 0 51.4%
if 2 < (/.f32 (neg.f32 x) s) Initial program 99.9%
Taylor expanded in x around 0 32.9%
mul-1-neg32.9%
unsub-neg32.9%
Simplified32.9%
Taylor expanded in x around inf 32.9%
neg-mul-132.9%
distribute-neg-frac32.9%
Simplified32.9%
Final simplification44.7%
(FPCore (x s) :precision binary32 (if (<= x -2.0000000233721948e-7) (* s (/ -1.0 x)) 0.5))
float code(float x, float s) {
float tmp;
if (x <= -2.0000000233721948e-7f) {
tmp = s * (-1.0f / x);
} else {
tmp = 0.5f;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-2.0000000233721948e-7)) then
tmp = s * ((-1.0e0) / x)
else
tmp = 0.5e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-2.0000000233721948e-7)) tmp = Float32(s * Float32(Float32(-1.0) / x)); else tmp = Float32(0.5); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-2.0000000233721948e-7)) tmp = s * (single(-1.0) / x); else tmp = single(0.5); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.0000000233721948 \cdot 10^{-7}:\\
\;\;\;\;s \cdot \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5\\
\end{array}
\end{array}
if x < -2.00000002e-7Initial program 100.0%
Taylor expanded in x around 0 40.3%
mul-1-neg40.3%
unsub-neg40.3%
Simplified40.3%
Taylor expanded in x around inf 36.7%
mul-1-neg36.7%
Simplified36.7%
add-sqr-sqrt-0.0%
sqrt-prod45.2%
sqr-neg45.2%
sqrt-unprod36.5%
add-sqr-sqrt36.5%
clear-num39.5%
associate-/r/36.5%
add-sqr-sqrt36.5%
sqrt-unprod45.2%
sqr-neg45.2%
sqrt-prod-0.0%
add-sqr-sqrt36.7%
Applied egg-rr36.7%
if -2.00000002e-7 < x Initial program 99.8%
Taylor expanded in x around 0 46.3%
Final simplification43.6%
(FPCore (x s) :precision binary32 (if (<= x -2.0000000233721948e-7) (/ (- s) x) 0.5))
float code(float x, float s) {
float tmp;
if (x <= -2.0000000233721948e-7f) {
tmp = -s / x;
} else {
tmp = 0.5f;
}
return tmp;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
real(4) :: tmp
if (x <= (-2.0000000233721948e-7)) then
tmp = -s / x
else
tmp = 0.5e0
end if
code = tmp
end function
function code(x, s) tmp = Float32(0.0) if (x <= Float32(-2.0000000233721948e-7)) tmp = Float32(Float32(-s) / x); else tmp = Float32(0.5); end return tmp end
function tmp_2 = code(x, s) tmp = single(0.0); if (x <= single(-2.0000000233721948e-7)) tmp = -s / x; else tmp = single(0.5); end tmp_2 = tmp; end
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.0000000233721948 \cdot 10^{-7}:\\
\;\;\;\;\frac{-s}{x}\\
\mathbf{else}:\\
\;\;\;\;0.5\\
\end{array}
\end{array}
if x < -2.00000002e-7Initial program 100.0%
Taylor expanded in x around 0 40.3%
mul-1-neg40.3%
unsub-neg40.3%
Simplified40.3%
Taylor expanded in x around inf 36.7%
mul-1-neg36.7%
Simplified36.7%
if -2.00000002e-7 < x Initial program 99.8%
Taylor expanded in x around 0 46.3%
Final simplification43.6%
(FPCore (x s) :precision binary32 0.5)
float code(float x, float s) {
return 0.5f;
}
real(4) function code(x, s)
real(4), intent (in) :: x
real(4), intent (in) :: s
code = 0.5e0
end function
function code(x, s) return Float32(0.5) end
function tmp = code(x, s) tmp = single(0.5); end
\begin{array}{l}
\\
0.5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 35.1%
Final simplification35.1%
herbie shell --seed 2023279
(FPCore (x s)
:name "Logistic function"
:precision binary32
:pre (and (<= 0.0 s) (<= s 1.0651631))
(/ 1.0 (+ 1.0 (exp (/ (- x) s)))))