
(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 11 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}
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (let* ((t_0 (exp (/ x_m s)))) (/ (exp (- (log1p t_0))) (+ s (/ s t_0)))))
x_m = fabs(x);
float code(float x_m, float s) {
float t_0 = expf((x_m / s));
return expf(-log1pf(t_0)) / (s + (s / t_0));
}
x_m = abs(x) function code(x_m, s) t_0 = exp(Float32(x_m / s)) return Float32(exp(Float32(-log1p(t_0))) / Float32(s + Float32(s / t_0))) end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := e^{\frac{x\_m}{s}}\\
\frac{e^{-\mathsf{log1p}\left(t\_0\right)}}{s + \frac{s}{t\_0}}
\end{array}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
add-exp-log99.3%
log-rec99.3%
log1p-define99.3%
Applied egg-rr99.3%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (let* ((t_0 (exp (/ x_m s)))) (/ (/ 1.0 (+ t_0 1.0)) (+ s (/ s t_0)))))
x_m = fabs(x);
float code(float x_m, float s) {
float t_0 = expf((x_m / s));
return (1.0f / (t_0 + 1.0f)) / (s + (s / t_0));
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
real(4) :: t_0
t_0 = exp((x_m / s))
code = (1.0e0 / (t_0 + 1.0e0)) / (s + (s / t_0))
end function
x_m = abs(x) function code(x_m, s) t_0 = exp(Float32(x_m / s)) return Float32(Float32(Float32(1.0) / Float32(t_0 + Float32(1.0))) / Float32(s + Float32(s / t_0))) end
x_m = abs(x); function tmp = code(x_m, s) t_0 = exp((x_m / s)); tmp = (single(1.0) / (t_0 + single(1.0))) / (s + (s / t_0)); end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := e^{\frac{x\_m}{s}}\\
\frac{\frac{1}{t\_0 + 1}}{s + \frac{s}{t\_0}}
\end{array}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.3%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (let* ((t_0 (exp (/ x_m s)))) (/ 1.0 (* (+ s (/ s t_0)) (+ t_0 1.0)))))
x_m = fabs(x);
float code(float x_m, float s) {
float t_0 = expf((x_m / s));
return 1.0f / ((s + (s / t_0)) * (t_0 + 1.0f));
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
real(4) :: t_0
t_0 = exp((x_m / s))
code = 1.0e0 / ((s + (s / t_0)) * (t_0 + 1.0e0))
end function
x_m = abs(x) function code(x_m, s) t_0 = exp(Float32(x_m / s)) return Float32(Float32(1.0) / Float32(Float32(s + Float32(s / t_0)) * Float32(t_0 + Float32(1.0)))) end
x_m = abs(x); function tmp = code(x_m, s) t_0 = exp((x_m / s)); tmp = single(1.0) / ((s + (s / t_0)) * (t_0 + single(1.0))); end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := e^{\frac{x\_m}{s}}\\
\frac{1}{\left(s + \frac{s}{t\_0}\right) \cdot \left(t\_0 + 1\right)}
\end{array}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
associate-*r*64.4%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.3%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (/ (/ 1.0 (+ (exp (/ x_m s)) 1.0)) (+ s (/ s (+ (/ x_m s) 1.0)))))
x_m = fabs(x);
float code(float x_m, float s) {
return (1.0f / (expf((x_m / s)) + 1.0f)) / (s + (s / ((x_m / s) + 1.0f)));
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
code = (1.0e0 / (exp((x_m / s)) + 1.0e0)) / (s + (s / ((x_m / s) + 1.0e0)))
end function
x_m = abs(x) function code(x_m, s) return Float32(Float32(Float32(1.0) / Float32(exp(Float32(x_m / s)) + Float32(1.0))) / Float32(s + Float32(s / Float32(Float32(x_m / s) + Float32(1.0))))) end
x_m = abs(x); function tmp = code(x_m, s) tmp = (single(1.0) / (exp((x_m / s)) + single(1.0))) / (s + (s / ((x_m / s) + single(1.0)))); end
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\frac{1}{e^{\frac{x\_m}{s}} + 1}}{s + \frac{s}{\frac{x\_m}{s} + 1}}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 62.5%
Final simplification62.5%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (/ 1.0 (* (+ (exp (/ x_m s)) 1.0) (+ s (/ s (+ (/ x_m s) 1.0))))))
x_m = fabs(x);
float code(float x_m, float s) {
return 1.0f / ((expf((x_m / s)) + 1.0f) * (s + (s / ((x_m / s) + 1.0f))));
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
code = 1.0e0 / ((exp((x_m / s)) + 1.0e0) * (s + (s / ((x_m / s) + 1.0e0))))
end function
x_m = abs(x) function code(x_m, s) return Float32(Float32(1.0) / Float32(Float32(exp(Float32(x_m / s)) + Float32(1.0)) * Float32(s + Float32(s / Float32(Float32(x_m / s) + Float32(1.0)))))) end
x_m = abs(x); function tmp = code(x_m, s) tmp = single(1.0) / ((exp((x_m / s)) + single(1.0)) * (s + (s / ((x_m / s) + single(1.0))))); end
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{1}{\left(e^{\frac{x\_m}{s}} + 1\right) \cdot \left(s + \frac{s}{\frac{x\_m}{s} + 1}\right)}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
associate-*r*64.4%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 62.5%
Final simplification62.5%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (/ (/ 1.0 (+ (exp (/ x_m s)) 1.0)) (+ s s)))
x_m = fabs(x);
float code(float x_m, float s) {
return (1.0f / (expf((x_m / s)) + 1.0f)) / (s + s);
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
code = (1.0e0 / (exp((x_m / s)) + 1.0e0)) / (s + s)
end function
x_m = abs(x) function code(x_m, s) return Float32(Float32(Float32(1.0) / Float32(exp(Float32(x_m / s)) + Float32(1.0))) / Float32(s + s)) end
x_m = abs(x); function tmp = code(x_m, s) tmp = (single(1.0) / (exp((x_m / s)) + single(1.0))) / (s + s); end
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\frac{1}{e^{\frac{x\_m}{s}} + 1}}{s + s}
\end{array}
Initial program 99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
distribute-lft-in99.2%
*-rgt-identity99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 99.2%
associate-/r*99.3%
Simplified64.5%
distribute-frac-neg264.5%
rec-exp64.4%
Applied egg-rr64.4%
Taylor expanded in x around inf 64.5%
distribute-lft-in25.4%
*-rgt-identity25.4%
mul-1-neg25.4%
rec-exp25.4%
rgt-mult-inverse99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in s around inf 61.2%
Final simplification61.2%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (if (<= x_m 1.500000013088254e-9) (/ (+ (* x_m (+ (/ 0.125 s) (/ 0.25 x_m))) (* -0.25 (* x_m (/ 0.5 s)))) s) 0.0))
x_m = fabs(x);
float code(float x_m, float s) {
float tmp;
if (x_m <= 1.500000013088254e-9f) {
tmp = ((x_m * ((0.125f / s) + (0.25f / x_m))) + (-0.25f * (x_m * (0.5f / s)))) / s;
} else {
tmp = 0.0f;
}
return tmp;
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
real(4) :: tmp
if (x_m <= 1.500000013088254e-9) then
tmp = ((x_m * ((0.125e0 / s) + (0.25e0 / x_m))) + ((-0.25e0) * (x_m * (0.5e0 / s)))) / s
else
tmp = 0.0e0
end if
code = tmp
end function
x_m = abs(x) function code(x_m, s) tmp = Float32(0.0) if (x_m <= Float32(1.500000013088254e-9)) tmp = Float32(Float32(Float32(x_m * Float32(Float32(Float32(0.125) / s) + Float32(Float32(0.25) / x_m))) + Float32(Float32(-0.25) * Float32(x_m * Float32(Float32(0.5) / s)))) / s); else tmp = Float32(0.0); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, s) tmp = single(0.0); if (x_m <= single(1.500000013088254e-9)) tmp = ((x_m * ((single(0.125) / s) + (single(0.25) / x_m))) + (single(-0.25) * (x_m * (single(0.5) / s)))) / s; else tmp = single(0.0); end tmp_2 = tmp; end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.500000013088254 \cdot 10^{-9}:\\
\;\;\;\;\frac{x\_m \cdot \left(\frac{0.125}{s} + \frac{0.25}{x\_m}\right) + -0.25 \cdot \left(x\_m \cdot \frac{0.5}{s}\right)}{s}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.50000001e-9Initial program 98.9%
fabs-neg98.9%
distribute-frac-neg98.9%
distribute-frac-neg298.9%
fabs-neg98.9%
*-commutative98.9%
fabs-neg98.9%
+-commutative98.9%
fabs-neg98.9%
Simplified98.9%
Applied egg-rr98.9%
associate-*r/98.9%
*-rgt-identity98.9%
Simplified98.9%
Taylor expanded in s around inf 70.3%
Simplified55.3%
Taylor expanded in x around inf 69.6%
associate-*r/69.6%
metadata-eval69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
if 1.50000001e-9 < x Initial program 99.9%
fabs-neg99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
fabs-neg99.9%
*-commutative99.9%
fabs-neg99.9%
+-commutative99.9%
fabs-neg99.9%
Simplified100.0%
Applied egg-rr64.7%
associate-*r/64.7%
*-rgt-identity64.7%
Simplified64.7%
Taylor expanded in s around inf 58.5%
Simplified48.7%
Taylor expanded in s around 0 97.9%
Taylor expanded in x around 0 97.9%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (if (<= x_m 4.999999980020986e-13) (/ (+ (* -0.25 (* x_m (/ 0.5 s))) (+ 0.25 (/ (* x_m 0.125) s))) s) 0.0))
x_m = fabs(x);
float code(float x_m, float s) {
float tmp;
if (x_m <= 4.999999980020986e-13f) {
tmp = ((-0.25f * (x_m * (0.5f / s))) + (0.25f + ((x_m * 0.125f) / s))) / s;
} else {
tmp = 0.0f;
}
return tmp;
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
real(4) :: tmp
if (x_m <= 4.999999980020986e-13) then
tmp = (((-0.25e0) * (x_m * (0.5e0 / s))) + (0.25e0 + ((x_m * 0.125e0) / s))) / s
else
tmp = 0.0e0
end if
code = tmp
end function
x_m = abs(x) function code(x_m, s) tmp = Float32(0.0) if (x_m <= Float32(4.999999980020986e-13)) tmp = Float32(Float32(Float32(Float32(-0.25) * Float32(x_m * Float32(Float32(0.5) / s))) + Float32(Float32(0.25) + Float32(Float32(x_m * Float32(0.125)) / s))) / s); else tmp = Float32(0.0); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, s) tmp = single(0.0); if (x_m <= single(4.999999980020986e-13)) tmp = ((single(-0.25) * (x_m * (single(0.5) / s))) + (single(0.25) + ((x_m * single(0.125)) / s))) / s; else tmp = single(0.0); end tmp_2 = tmp; end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.999999980020986 \cdot 10^{-13}:\\
\;\;\;\;\frac{-0.25 \cdot \left(x\_m \cdot \frac{0.5}{s}\right) + \left(0.25 + \frac{x\_m \cdot 0.125}{s}\right)}{s}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.99999998e-13Initial program 99.0%
fabs-neg99.0%
distribute-frac-neg99.0%
distribute-frac-neg299.0%
fabs-neg99.0%
*-commutative99.0%
fabs-neg99.0%
+-commutative99.0%
fabs-neg99.0%
Simplified99.0%
Applied egg-rr99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
Taylor expanded in s around inf 70.5%
Simplified55.7%
Taylor expanded in x around 0 55.1%
associate-*r/55.7%
*-commutative55.7%
Simplified55.7%
if 4.99999998e-13 < x Initial program 99.7%
fabs-neg99.7%
distribute-frac-neg99.7%
distribute-frac-neg299.7%
fabs-neg99.7%
*-commutative99.7%
fabs-neg99.7%
+-commutative99.7%
fabs-neg99.7%
Simplified99.7%
Applied egg-rr66.3%
associate-*r/66.4%
*-rgt-identity66.4%
Simplified66.4%
Taylor expanded in s around inf 58.8%
Simplified48.5%
Taylor expanded in s around 0 95.0%
Taylor expanded in x around 0 95.0%
Final simplification70.0%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (/ (/ (+ (* x_m -0.125) (+ (* s 0.25) (* 0.25 (+ x_m (* x_m -0.5))))) s) s))
x_m = fabs(x);
float code(float x_m, float s) {
return (((x_m * -0.125f) + ((s * 0.25f) + (0.25f * (x_m + (x_m * -0.5f))))) / s) / s;
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
code = (((x_m * (-0.125e0)) + ((s * 0.25e0) + (0.25e0 * (x_m + (x_m * (-0.5e0)))))) / s) / s
end function
x_m = abs(x) function code(x_m, s) return Float32(Float32(Float32(Float32(x_m * Float32(-0.125)) + Float32(Float32(s * Float32(0.25)) + Float32(Float32(0.25) * Float32(x_m + Float32(x_m * Float32(-0.5)))))) / s) / s) end
x_m = abs(x); function tmp = code(x_m, s) tmp = (((x_m * single(-0.125)) + ((s * single(0.25)) + (single(0.25) * (x_m + (x_m * single(-0.5)))))) / s) / s; end
\begin{array}{l}
x_m = \left|x\right|
\\
\frac{\frac{x\_m \cdot -0.125 + \left(s \cdot 0.25 + 0.25 \cdot \left(x\_m + x\_m \cdot -0.5\right)\right)}{s}}{s}
\end{array}
Initial program 99.2%
fabs-neg99.2%
distribute-frac-neg99.2%
distribute-frac-neg299.2%
fabs-neg99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
Simplified99.3%
Applied egg-rr87.1%
associate-*r/87.1%
*-rgt-identity87.1%
Simplified87.1%
Taylor expanded in s around inf 66.2%
Simplified53.1%
Taylor expanded in s around 0 88.9%
Final simplification88.9%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 (if (<= x_m 3.99999992980668e-14) (/ 0.25 s) 0.0))
x_m = fabs(x);
float code(float x_m, float s) {
float tmp;
if (x_m <= 3.99999992980668e-14f) {
tmp = 0.25f / s;
} else {
tmp = 0.0f;
}
return tmp;
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
real(4) :: tmp
if (x_m <= 3.99999992980668e-14) then
tmp = 0.25e0 / s
else
tmp = 0.0e0
end if
code = tmp
end function
x_m = abs(x) function code(x_m, s) tmp = Float32(0.0) if (x_m <= Float32(3.99999992980668e-14)) tmp = Float32(Float32(0.25) / s); else tmp = Float32(0.0); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, s) tmp = single(0.0); if (x_m <= single(3.99999992980668e-14)) tmp = single(0.25) / s; else tmp = single(0.0); end tmp_2 = tmp; end
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 3.99999992980668 \cdot 10^{-14}:\\
\;\;\;\;\frac{0.25}{s}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.99999993e-14Initial program 98.9%
fabs-neg98.9%
distribute-frac-neg98.9%
distribute-frac-neg298.9%
fabs-neg98.9%
*-commutative98.9%
fabs-neg98.9%
+-commutative98.9%
fabs-neg98.9%
Simplified99.0%
Taylor expanded in s around inf 34.6%
if 3.99999993e-14 < x Initial program 99.7%
fabs-neg99.7%
distribute-frac-neg99.7%
distribute-frac-neg299.7%
fabs-neg99.7%
*-commutative99.7%
fabs-neg99.7%
+-commutative99.7%
fabs-neg99.7%
Simplified99.7%
Applied egg-rr67.0%
associate-*r/67.1%
*-rgt-identity67.1%
Simplified67.1%
Taylor expanded in s around inf 59.6%
Simplified49.6%
Taylor expanded in s around 0 94.1%
Taylor expanded in x around 0 94.1%
x_m = (fabs.f32 x) (FPCore (x_m s) :precision binary32 0.0)
x_m = fabs(x);
float code(float x_m, float s) {
return 0.0f;
}
x_m = abs(x)
real(4) function code(x_m, s)
real(4), intent (in) :: x_m
real(4), intent (in) :: s
code = 0.0e0
end function
x_m = abs(x) function code(x_m, s) return Float32(0.0) end
x_m = abs(x); function tmp = code(x_m, s) tmp = single(0.0); end
\begin{array}{l}
x_m = \left|x\right|
\\
0
\end{array}
Initial program 99.2%
fabs-neg99.2%
distribute-frac-neg99.2%
distribute-frac-neg299.2%
fabs-neg99.2%
*-commutative99.2%
fabs-neg99.2%
+-commutative99.2%
fabs-neg99.2%
Simplified99.3%
Applied egg-rr87.1%
associate-*r/87.1%
*-rgt-identity87.1%
Simplified87.1%
Taylor expanded in s around inf 66.2%
Simplified53.1%
Taylor expanded in s around 0 75.2%
Taylor expanded in x around 0 75.2%
herbie shell --seed 2024137
(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))))))