
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 73.9%
fma-neg73.9%
/-rgt-identity73.9%
fma-neg73.9%
/-rgt-identity73.9%
distribute-rgt-neg-in73.9%
sub-neg73.9%
metadata-eval73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in eps around inf 99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
*-commutative99.8%
associate-*r*99.8%
mul-1-neg99.8%
mul-1-neg99.8%
sub-neg99.8%
mul-1-neg99.8%
associate-*r*99.8%
exp-prod93.7%
*-lft-identity93.7%
metadata-eval93.7%
cancel-sign-sub-inv93.7%
exp-prod99.8%
mul-1-neg99.8%
sub-neg99.8%
mul-1-neg99.8%
remove-double-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-247)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (<= x 2.15e+195)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-247) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 2.15e+195) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3.2d-247)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 2.15d+195) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -3.2e-247) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 2.15e+195) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -3.2e-247: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif x <= 2.15e+195: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -3.2e-247) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 2.15e+195) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3.2e-247) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif (x <= 2.15e+195) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -3.2e-247], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.15e+195], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-247}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+195}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < -3.19999999999999993e-247Initial program 71.8%
fma-neg71.8%
/-rgt-identity71.8%
fma-neg71.8%
/-rgt-identity71.8%
distribute-rgt-neg-in71.8%
sub-neg71.8%
metadata-eval71.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
Taylor expanded in x around 0 36.1%
Taylor expanded in eps around inf 63.8%
sub-neg63.8%
mul-1-neg63.8%
remove-double-neg63.8%
associate-*r*63.8%
exp-prod59.6%
remove-double-neg59.6%
neg-mul-159.6%
sub-neg59.6%
exp-prod63.8%
*-commutative63.8%
neg-mul-163.8%
sub-neg63.8%
remove-double-neg63.8%
associate-*l*63.8%
distribute-lft-in63.8%
metadata-eval63.8%
neg-mul-163.8%
unsub-neg63.8%
Simplified63.8%
if -3.19999999999999993e-247 < x < 2.14999999999999991e195Initial program 71.2%
fma-neg71.2%
/-rgt-identity71.2%
fma-neg71.2%
/-rgt-identity71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
metadata-eval71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 69.7%
associate-*r*69.7%
sub-neg69.7%
neg-mul-169.7%
associate-*r*69.7%
mul-1-neg69.7%
*-commutative69.7%
neg-mul-169.7%
sub-neg69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
+-commutative69.7%
Simplified69.7%
if 2.14999999999999991e195 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
mul-1-neg73.2%
cancel-sign-sub73.2%
distribute-rgt1-in73.2%
distribute-rgt-out--73.2%
mul-1-neg73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in x around inf 73.2%
associate-*r*73.2%
*-commutative73.2%
distribute-rgt-out73.2%
*-commutative73.2%
Simplified73.2%
Final simplification67.6%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-247)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 5.7e+193)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(/ (* 2.0 (/ x (exp x))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -4e-247) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 5.7e+193) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (2.0 * (x / exp(x))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-4d-247)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 5.7d+193) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = (2.0d0 * (x / exp(x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-247) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 5.7e+193) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (2.0 * (x / Math.exp(x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-247: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 5.7e+193: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = (2.0 * (x / math.exp(x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-247) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 5.7e+193) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = Float64(Float64(2.0 * Float64(x / exp(x))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-247) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 5.7e+193) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = (2.0 * (x / exp(x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-247], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.7e+193], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-247}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+193}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -4.0000000000000001e-247Initial program 71.8%
fma-neg71.8%
/-rgt-identity71.8%
fma-neg71.8%
/-rgt-identity71.8%
distribute-rgt-neg-in71.8%
sub-neg71.8%
metadata-eval71.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 73.1%
associate-*r*73.1%
sub-neg73.1%
neg-mul-173.1%
associate-*r*73.1%
mul-1-neg73.1%
*-commutative73.1%
neg-mul-173.1%
sub-neg73.1%
*-commutative73.1%
distribute-rgt-neg-in73.1%
sub-neg73.1%
distribute-neg-in73.1%
metadata-eval73.1%
remove-double-neg73.1%
+-commutative73.1%
Simplified73.1%
Taylor expanded in eps around 0 82.2%
mul-1-neg82.2%
Simplified82.2%
if -4.0000000000000001e-247 < x < 5.69999999999999999e193Initial program 71.2%
fma-neg71.2%
/-rgt-identity71.2%
fma-neg71.2%
/-rgt-identity71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
metadata-eval71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 69.7%
associate-*r*69.7%
sub-neg69.7%
neg-mul-169.7%
associate-*r*69.7%
mul-1-neg69.7%
*-commutative69.7%
neg-mul-169.7%
sub-neg69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
+-commutative69.7%
Simplified69.7%
if 5.69999999999999999e193 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
mul-1-neg73.2%
cancel-sign-sub73.2%
distribute-rgt1-in73.2%
distribute-rgt-out--73.2%
mul-1-neg73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in x around inf 73.2%
*-commutative73.2%
neg-mul-173.2%
*-commutative73.2%
neg-mul-173.2%
exp-neg73.2%
associate-*r/73.2%
*-rgt-identity73.2%
Simplified73.2%
Final simplification75.0%
(FPCore (x eps)
:precision binary64
(if (<= x -3.1e-247)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (<= x 2.9e+195)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(/ (* 2.0 (/ x (exp x))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -3.1e-247) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 2.9e+195) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (2.0 * (x / exp(x))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3.1d-247)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 2.9d+195) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = (2.0d0 * (x / exp(x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -3.1e-247) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 2.9e+195) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (2.0 * (x / Math.exp(x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -3.1e-247: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif x <= 2.9e+195: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = (2.0 * (x / math.exp(x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -3.1e-247) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 2.9e+195) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = Float64(Float64(2.0 * Float64(x / exp(x))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3.1e-247) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif (x <= 2.9e+195) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = (2.0 * (x / exp(x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -3.1e-247], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.9e+195], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-247}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+195}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -3.10000000000000015e-247Initial program 71.8%
fma-neg71.8%
/-rgt-identity71.8%
fma-neg71.8%
/-rgt-identity71.8%
distribute-rgt-neg-in71.8%
sub-neg71.8%
metadata-eval71.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
Taylor expanded in x around 0 36.1%
Taylor expanded in eps around inf 63.8%
sub-neg63.8%
mul-1-neg63.8%
remove-double-neg63.8%
associate-*r*63.8%
exp-prod59.6%
remove-double-neg59.6%
neg-mul-159.6%
sub-neg59.6%
exp-prod63.8%
*-commutative63.8%
neg-mul-163.8%
sub-neg63.8%
remove-double-neg63.8%
associate-*l*63.8%
distribute-lft-in63.8%
metadata-eval63.8%
neg-mul-163.8%
unsub-neg63.8%
Simplified63.8%
if -3.10000000000000015e-247 < x < 2.89999999999999992e195Initial program 71.2%
fma-neg71.2%
/-rgt-identity71.2%
fma-neg71.2%
/-rgt-identity71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
metadata-eval71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 69.7%
associate-*r*69.7%
sub-neg69.7%
neg-mul-169.7%
associate-*r*69.7%
mul-1-neg69.7%
*-commutative69.7%
neg-mul-169.7%
sub-neg69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
+-commutative69.7%
Simplified69.7%
if 2.89999999999999992e195 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
mul-1-neg73.2%
cancel-sign-sub73.2%
distribute-rgt1-in73.2%
distribute-rgt-out--73.2%
mul-1-neg73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in x around inf 73.2%
*-commutative73.2%
neg-mul-173.2%
*-commutative73.2%
neg-mul-173.2%
exp-neg73.2%
associate-*r/73.2%
*-rgt-identity73.2%
Simplified73.2%
Final simplification67.6%
(FPCore (x eps) :precision binary64 (if (<= x 6e+24) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 2.7e+195) (/ (+ 1.0 (exp x)) 2.0) (/ (* 2.0 (/ x (exp x))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 6e+24) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.7e+195) {
tmp = (1.0 + exp(x)) / 2.0;
} else {
tmp = (2.0 * (x / exp(x))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 6d+24) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.7d+195) then
tmp = (1.0d0 + exp(x)) / 2.0d0
else
tmp = (2.0d0 * (x / exp(x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 6e+24) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.7e+195) {
tmp = (1.0 + Math.exp(x)) / 2.0;
} else {
tmp = (2.0 * (x / Math.exp(x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 6e+24: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.7e+195: tmp = (1.0 + math.exp(x)) / 2.0 else: tmp = (2.0 * (x / math.exp(x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 6e+24) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.7e+195) tmp = Float64(Float64(1.0 + exp(x)) / 2.0); else tmp = Float64(Float64(2.0 * Float64(x / exp(x))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 6e+24) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.7e+195) tmp = (1.0 + exp(x)) / 2.0; else tmp = (2.0 * (x / exp(x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 6e+24], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.7e+195], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+24}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+195}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < 5.9999999999999999e24Initial program 65.2%
fma-neg65.2%
/-rgt-identity65.2%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in x around 0 44.5%
Taylor expanded in eps around inf 79.0%
associate-*r*79.0%
sub-neg79.0%
neg-mul-179.0%
associate-*r*79.0%
mul-1-neg79.0%
*-commutative79.0%
neg-mul-179.0%
sub-neg79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
sub-neg79.0%
distribute-neg-in79.0%
metadata-eval79.0%
remove-double-neg79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in eps around 0 77.8%
mul-1-neg77.8%
Simplified77.8%
if 5.9999999999999999e24 < x < 2.7000000000000002e195Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 35.0%
Taylor expanded in eps around inf 35.4%
associate-*r*35.4%
sub-neg35.4%
neg-mul-135.4%
associate-*r*35.4%
mul-1-neg35.4%
*-commutative35.4%
neg-mul-135.4%
sub-neg35.4%
*-commutative35.4%
distribute-rgt-neg-in35.4%
sub-neg35.4%
distribute-neg-in35.4%
metadata-eval35.4%
remove-double-neg35.4%
+-commutative35.4%
Simplified35.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
expm1-log1p-u3.1%
expm1-udef3.1%
add-sqr-sqrt0.0%
sqrt-unprod62.5%
sqr-neg62.5%
sqrt-unprod62.5%
add-sqr-sqrt62.5%
Applied egg-rr62.5%
expm1-def62.5%
expm1-log1p62.5%
Simplified62.5%
if 2.7000000000000002e195 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
mul-1-neg73.2%
cancel-sign-sub73.2%
distribute-rgt1-in73.2%
distribute-rgt-out--73.2%
mul-1-neg73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in x around inf 73.2%
*-commutative73.2%
neg-mul-173.2%
*-commutative73.2%
neg-mul-173.2%
exp-neg73.2%
associate-*r/73.2%
*-rgt-identity73.2%
Simplified73.2%
Final simplification74.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 eps) eps)))
(if (<= x -1.7e-18)
(/
(+
2.0
(*
x
(+
(/ (- (* (+ 1.0 eps) (+ 1.0 eps)) (* t_0 t_0)) (- (- -1.0 eps) t_0))
(/ -1.0 eps))))
2.0)
(if (<= x 1.85e+168)
(/ (+ 1.0 (exp x)) 2.0)
(/ (- (+ 1.0 (/ 1.0 eps)) (+ -1.0 (/ 1.0 eps))) 2.0)))))
double code(double x, double eps) {
double t_0 = (1.0 + eps) / eps;
double tmp;
if (x <= -1.7e-18) {
tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0;
} else if (x <= 1.85e+168) {
tmp = (1.0 + exp(x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + eps) / eps
if (x <= (-1.7d-18)) then
tmp = (2.0d0 + (x * (((((1.0d0 + eps) * (1.0d0 + eps)) - (t_0 * t_0)) / (((-1.0d0) - eps) - t_0)) + ((-1.0d0) / eps)))) / 2.0d0
else if (x <= 1.85d+168) then
tmp = (1.0d0 + exp(x)) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) - ((-1.0d0) + (1.0d0 / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (1.0 + eps) / eps;
double tmp;
if (x <= -1.7e-18) {
tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0;
} else if (x <= 1.85e+168) {
tmp = (1.0 + Math.exp(x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + eps) / eps tmp = 0 if x <= -1.7e-18: tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0 elif x <= 1.85e+168: tmp = (1.0 + math.exp(x)) / 2.0 else: tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + eps) / eps) tmp = 0.0 if (x <= -1.7e-18) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(Float64(Float64(1.0 + eps) * Float64(1.0 + eps)) - Float64(t_0 * t_0)) / Float64(Float64(-1.0 - eps) - t_0)) + Float64(-1.0 / eps)))) / 2.0); elseif (x <= 1.85e+168) tmp = Float64(Float64(1.0 + exp(x)) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) - Float64(-1.0 + Float64(1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 + eps) / eps; tmp = 0.0; if (x <= -1.7e-18) tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0; elseif (x <= 1.85e+168) tmp = (1.0 + exp(x)) / 2.0; else tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 + eps), $MachinePrecision] / eps), $MachinePrecision]}, If[LessEqual[x, -1.7e-18], N[(N[(2.0 + N[(x * N[(N[(N[(N[(N[(1.0 + eps), $MachinePrecision] * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.85e+168], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + \varepsilon}{\varepsilon}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-18}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{\left(1 + \varepsilon\right) \cdot \left(1 + \varepsilon\right) - t_0 \cdot t_0}{\left(-1 - \varepsilon\right) - t_0} + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+168}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) - \left(-1 + \frac{1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -1.70000000000000001e-18Initial program 98.0%
fma-neg98.1%
/-rgt-identity98.1%
fma-neg98.0%
/-rgt-identity98.0%
distribute-rgt-neg-in98.0%
sub-neg98.0%
metadata-eval98.0%
distribute-rgt-neg-in98.0%
Simplified98.0%
Taylor expanded in x around 0 4.5%
distribute-lft-out--4.5%
*-commutative4.5%
+-commutative4.5%
sub-neg4.5%
metadata-eval4.5%
+-commutative4.5%
Simplified4.5%
distribute-lft-in4.5%
flip-+17.4%
Applied egg-rr17.4%
unsub-neg17.4%
unsub-neg17.4%
unsub-neg17.4%
Simplified17.4%
Taylor expanded in eps around 0 19.4%
if -1.70000000000000001e-18 < x < 1.85000000000000005e168Initial program 62.4%
fma-neg62.4%
/-rgt-identity62.4%
fma-neg62.4%
/-rgt-identity62.4%
distribute-rgt-neg-in62.4%
sub-neg62.4%
metadata-eval62.4%
distribute-rgt-neg-in62.4%
Simplified62.4%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 78.4%
associate-*r*78.4%
sub-neg78.4%
neg-mul-178.4%
associate-*r*78.4%
mul-1-neg78.4%
*-commutative78.4%
neg-mul-178.4%
sub-neg78.4%
*-commutative78.4%
distribute-rgt-neg-in78.4%
sub-neg78.4%
distribute-neg-in78.4%
metadata-eval78.4%
remove-double-neg78.4%
+-commutative78.4%
Simplified78.4%
Taylor expanded in eps around 0 59.4%
mul-1-neg59.4%
Simplified59.4%
expm1-log1p-u58.0%
expm1-udef58.0%
add-sqr-sqrt30.2%
sqrt-unprod69.5%
sqr-neg69.5%
sqrt-unprod39.3%
add-sqr-sqrt69.5%
Applied egg-rr69.5%
expm1-def69.5%
expm1-log1p70.9%
Simplified70.9%
if 1.85000000000000005e168 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 17.7%
Taylor expanded in x around 0 63.7%
Final simplification60.1%
(FPCore (x eps)
:precision binary64
(if (<= x 6e+24)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2.05e+168)
(/ (+ 1.0 (exp x)) 2.0)
(/ (- (+ 1.0 (/ 1.0 eps)) (+ -1.0 (/ 1.0 eps))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 6e+24) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.05e+168) {
tmp = (1.0 + exp(x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 6d+24) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.05d+168) then
tmp = (1.0d0 + exp(x)) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) - ((-1.0d0) + (1.0d0 / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 6e+24) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.05e+168) {
tmp = (1.0 + Math.exp(x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 6e+24: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.05e+168: tmp = (1.0 + math.exp(x)) / 2.0 else: tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 6e+24) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.05e+168) tmp = Float64(Float64(1.0 + exp(x)) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) - Float64(-1.0 + Float64(1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 6e+24) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.05e+168) tmp = (1.0 + exp(x)) / 2.0; else tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 6e+24], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.05e+168], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+24}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+168}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) - \left(-1 + \frac{1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 5.9999999999999999e24Initial program 65.2%
fma-neg65.2%
/-rgt-identity65.2%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in x around 0 44.5%
Taylor expanded in eps around inf 79.0%
associate-*r*79.0%
sub-neg79.0%
neg-mul-179.0%
associate-*r*79.0%
mul-1-neg79.0%
*-commutative79.0%
neg-mul-179.0%
sub-neg79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
sub-neg79.0%
distribute-neg-in79.0%
metadata-eval79.0%
remove-double-neg79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in eps around 0 77.8%
mul-1-neg77.8%
Simplified77.8%
if 5.9999999999999999e24 < x < 2.0500000000000002e168Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 39.5%
associate-*r*39.5%
sub-neg39.5%
neg-mul-139.5%
associate-*r*39.5%
mul-1-neg39.5%
*-commutative39.5%
neg-mul-139.5%
sub-neg39.5%
*-commutative39.5%
distribute-rgt-neg-in39.5%
sub-neg39.5%
distribute-neg-in39.5%
metadata-eval39.5%
remove-double-neg39.5%
+-commutative39.5%
Simplified39.5%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
expm1-log1p-u3.1%
expm1-udef3.1%
add-sqr-sqrt0.0%
sqrt-unprod66.2%
sqr-neg66.2%
sqrt-unprod66.2%
add-sqr-sqrt66.2%
Applied egg-rr66.2%
expm1-def66.2%
expm1-log1p66.2%
Simplified66.2%
if 2.0500000000000002e168 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 17.7%
Taylor expanded in x around 0 63.7%
Final simplification74.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 eps) eps)))
(if (<= x -1.5e-17)
(/
(+
2.0
(*
x
(+
(/ (- (* (+ 1.0 eps) (+ 1.0 eps)) (* t_0 t_0)) (- (- -1.0 eps) t_0))
(/ -1.0 eps))))
2.0)
(if (<= x 7.5e-29)
1.0
(/ (- (+ 1.0 (/ 1.0 eps)) (+ -1.0 (/ 1.0 eps))) 2.0)))))
double code(double x, double eps) {
double t_0 = (1.0 + eps) / eps;
double tmp;
if (x <= -1.5e-17) {
tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0;
} else if (x <= 7.5e-29) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + eps) / eps
if (x <= (-1.5d-17)) then
tmp = (2.0d0 + (x * (((((1.0d0 + eps) * (1.0d0 + eps)) - (t_0 * t_0)) / (((-1.0d0) - eps) - t_0)) + ((-1.0d0) / eps)))) / 2.0d0
else if (x <= 7.5d-29) then
tmp = 1.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) - ((-1.0d0) + (1.0d0 / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (1.0 + eps) / eps;
double tmp;
if (x <= -1.5e-17) {
tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0;
} else if (x <= 7.5e-29) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + eps) / eps tmp = 0 if x <= -1.5e-17: tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0 elif x <= 7.5e-29: tmp = 1.0 else: tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + eps) / eps) tmp = 0.0 if (x <= -1.5e-17) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(Float64(Float64(1.0 + eps) * Float64(1.0 + eps)) - Float64(t_0 * t_0)) / Float64(Float64(-1.0 - eps) - t_0)) + Float64(-1.0 / eps)))) / 2.0); elseif (x <= 7.5e-29) tmp = 1.0; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) - Float64(-1.0 + Float64(1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 + eps) / eps; tmp = 0.0; if (x <= -1.5e-17) tmp = (2.0 + (x * (((((1.0 + eps) * (1.0 + eps)) - (t_0 * t_0)) / ((-1.0 - eps) - t_0)) + (-1.0 / eps)))) / 2.0; elseif (x <= 7.5e-29) tmp = 1.0; else tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 + eps), $MachinePrecision] / eps), $MachinePrecision]}, If[LessEqual[x, -1.5e-17], N[(N[(2.0 + N[(x * N[(N[(N[(N[(N[(1.0 + eps), $MachinePrecision] * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e-29], 1.0, N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + \varepsilon}{\varepsilon}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{\left(1 + \varepsilon\right) \cdot \left(1 + \varepsilon\right) - t_0 \cdot t_0}{\left(-1 - \varepsilon\right) - t_0} + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-29}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) - \left(-1 + \frac{1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -1.50000000000000003e-17Initial program 98.0%
fma-neg98.1%
/-rgt-identity98.1%
fma-neg98.0%
/-rgt-identity98.0%
distribute-rgt-neg-in98.0%
sub-neg98.0%
metadata-eval98.0%
distribute-rgt-neg-in98.0%
Simplified98.0%
Taylor expanded in x around 0 4.5%
distribute-lft-out--4.5%
*-commutative4.5%
+-commutative4.5%
sub-neg4.5%
metadata-eval4.5%
+-commutative4.5%
Simplified4.5%
distribute-lft-in4.5%
flip-+17.4%
Applied egg-rr17.4%
unsub-neg17.4%
unsub-neg17.4%
unsub-neg17.4%
Simplified17.4%
Taylor expanded in eps around 0 19.4%
if -1.50000000000000003e-17 < x < 7.50000000000000006e-29Initial program 51.9%
fma-neg51.9%
/-rgt-identity51.9%
fma-neg51.9%
/-rgt-identity51.9%
distribute-rgt-neg-in51.9%
sub-neg51.9%
metadata-eval51.9%
distribute-rgt-neg-in51.9%
Simplified51.9%
Taylor expanded in x around 0 75.0%
if 7.50000000000000006e-29 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 29.0%
Taylor expanded in x around 0 48.8%
Final simplification57.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps))) (t_1 (+ -1.0 (/ 1.0 eps))))
(if (<= x -1.95e-16)
(/
(+
2.0
(*
x
(+
(/ (* eps (+ eps 2.0)) (- (- -1.0 eps) (/ (+ 1.0 eps) eps)))
(/ -1.0 eps))))
2.0)
(if (<= x 360.0)
(/ (+ 2.0 (* x (- (* (+ 1.0 eps) t_1) (* (- 1.0 eps) t_0)))) 2.0)
(/ (- t_0 t_1) 2.0)))))
double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double t_1 = -1.0 + (1.0 / eps);
double tmp;
if (x <= -1.95e-16) {
tmp = (2.0 + (x * (((eps * (eps + 2.0)) / ((-1.0 - eps) - ((1.0 + eps) / eps))) + (-1.0 / eps)))) / 2.0;
} else if (x <= 360.0) {
tmp = (2.0 + (x * (((1.0 + eps) * t_1) - ((1.0 - eps) * t_0)))) / 2.0;
} else {
tmp = (t_0 - t_1) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps)
t_1 = (-1.0d0) + (1.0d0 / eps)
if (x <= (-1.95d-16)) then
tmp = (2.0d0 + (x * (((eps * (eps + 2.0d0)) / (((-1.0d0) - eps) - ((1.0d0 + eps) / eps))) + ((-1.0d0) / eps)))) / 2.0d0
else if (x <= 360.0d0) then
tmp = (2.0d0 + (x * (((1.0d0 + eps) * t_1) - ((1.0d0 - eps) * t_0)))) / 2.0d0
else
tmp = (t_0 - t_1) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double t_1 = -1.0 + (1.0 / eps);
double tmp;
if (x <= -1.95e-16) {
tmp = (2.0 + (x * (((eps * (eps + 2.0)) / ((-1.0 - eps) - ((1.0 + eps) / eps))) + (-1.0 / eps)))) / 2.0;
} else if (x <= 360.0) {
tmp = (2.0 + (x * (((1.0 + eps) * t_1) - ((1.0 - eps) * t_0)))) / 2.0;
} else {
tmp = (t_0 - t_1) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = 1.0 + (1.0 / eps) t_1 = -1.0 + (1.0 / eps) tmp = 0 if x <= -1.95e-16: tmp = (2.0 + (x * (((eps * (eps + 2.0)) / ((-1.0 - eps) - ((1.0 + eps) / eps))) + (-1.0 / eps)))) / 2.0 elif x <= 360.0: tmp = (2.0 + (x * (((1.0 + eps) * t_1) - ((1.0 - eps) * t_0)))) / 2.0 else: tmp = (t_0 - t_1) / 2.0 return tmp
function code(x, eps) t_0 = Float64(1.0 + Float64(1.0 / eps)) t_1 = Float64(-1.0 + Float64(1.0 / eps)) tmp = 0.0 if (x <= -1.95e-16) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps * Float64(eps + 2.0)) / Float64(Float64(-1.0 - eps) - Float64(Float64(1.0 + eps) / eps))) + Float64(-1.0 / eps)))) / 2.0); elseif (x <= 360.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 + eps) * t_1) - Float64(Float64(1.0 - eps) * t_0)))) / 2.0); else tmp = Float64(Float64(t_0 - t_1) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 + (1.0 / eps); t_1 = -1.0 + (1.0 / eps); tmp = 0.0; if (x <= -1.95e-16) tmp = (2.0 + (x * (((eps * (eps + 2.0)) / ((-1.0 - eps) - ((1.0 + eps) / eps))) + (-1.0 / eps)))) / 2.0; elseif (x <= 360.0) tmp = (2.0 + (x * (((1.0 + eps) * t_1) - ((1.0 - eps) * t_0)))) / 2.0; else tmp = (t_0 - t_1) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.95e-16], N[(N[(2.0 + N[(x * N[(N[(N[(eps * N[(eps + 2.0), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps), $MachinePrecision] - N[(N[(1.0 + eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 + eps), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[(1.0 - eps), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 - t$95$1), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{\varepsilon}\\
t_1 := -1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{-16}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{\varepsilon \cdot \left(\varepsilon + 2\right)}{\left(-1 - \varepsilon\right) - \frac{1 + \varepsilon}{\varepsilon}} + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 + \varepsilon\right) \cdot t_1 - \left(1 - \varepsilon\right) \cdot t_0\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 - t_1}{2}\\
\end{array}
\end{array}
if x < -1.94999999999999989e-16Initial program 98.0%
fma-neg98.1%
/-rgt-identity98.1%
fma-neg98.0%
/-rgt-identity98.0%
distribute-rgt-neg-in98.0%
sub-neg98.0%
metadata-eval98.0%
distribute-rgt-neg-in98.0%
Simplified98.0%
Taylor expanded in x around 0 4.5%
distribute-lft-out--4.5%
*-commutative4.5%
+-commutative4.5%
sub-neg4.5%
metadata-eval4.5%
+-commutative4.5%
Simplified4.5%
distribute-lft-in4.5%
flip-+17.4%
Applied egg-rr17.4%
unsub-neg17.4%
unsub-neg17.4%
unsub-neg17.4%
Simplified17.4%
Taylor expanded in eps around 0 19.4%
Taylor expanded in eps around inf 18.1%
+-commutative18.1%
unpow218.1%
distribute-rgt-out18.1%
Simplified18.1%
if -1.94999999999999989e-16 < x < 360Initial program 53.3%
fma-neg53.3%
/-rgt-identity53.3%
fma-neg53.3%
/-rgt-identity53.3%
distribute-rgt-neg-in53.3%
sub-neg53.3%
metadata-eval53.3%
distribute-rgt-neg-in53.3%
Simplified53.3%
Taylor expanded in x around 0 73.0%
distribute-lft-out--73.0%
*-commutative73.0%
+-commutative73.0%
sub-neg73.0%
metadata-eval73.0%
+-commutative73.0%
Simplified73.0%
if 360 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 27.6%
Taylor expanded in x around 0 51.6%
Final simplification56.9%
(FPCore (x eps) :precision binary64 (if (<= x 7.5e-29) (/ (- 2.0 (* x eps)) 2.0) (/ (- (+ 1.0 (/ 1.0 eps)) (+ -1.0 (/ 1.0 eps))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= 7.5e-29) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 7.5d-29) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) - ((-1.0d0) + (1.0d0 / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 7.5e-29) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 7.5e-29: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 7.5e-29) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) - Float64(-1.0 + Float64(1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 7.5e-29) tmp = (2.0 - (x * eps)) / 2.0; else tmp = ((1.0 + (1.0 / eps)) - (-1.0 + (1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 7.5e-29], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) - \left(-1 + \frac{1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 7.50000000000000006e-29Initial program 64.1%
fma-neg64.1%
/-rgt-identity64.1%
fma-neg64.1%
/-rgt-identity64.1%
distribute-rgt-neg-in64.1%
sub-neg64.1%
metadata-eval64.1%
distribute-rgt-neg-in64.1%
Simplified64.1%
Taylor expanded in x around 0 56.4%
distribute-lft-out--56.4%
*-commutative56.4%
+-commutative56.4%
sub-neg56.4%
metadata-eval56.4%
+-commutative56.4%
Simplified56.4%
Taylor expanded in eps around 0 58.3%
Taylor expanded in eps around 0 58.3%
if 7.50000000000000006e-29 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 29.0%
Taylor expanded in x around 0 48.8%
Final simplification55.7%
(FPCore (x eps) :precision binary64 (if (<= x -3.1e-247) (/ (- 2.0 (* x eps)) 2.0) (/ (+ 2.0 (* x eps)) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -3.1e-247) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (x * eps)) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3.1d-247)) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = (2.0d0 + (x * eps)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -3.1e-247) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (x * eps)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -3.1e-247: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = (2.0 + (x * eps)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -3.1e-247) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * eps)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3.1e-247) tmp = (2.0 - (x * eps)) / 2.0; else tmp = (2.0 + (x * eps)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -3.1e-247], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-247}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < -3.10000000000000015e-247Initial program 71.8%
fma-neg71.8%
/-rgt-identity71.8%
fma-neg71.8%
/-rgt-identity71.8%
distribute-rgt-neg-in71.8%
sub-neg71.8%
metadata-eval71.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
Taylor expanded in x around 0 39.2%
distribute-lft-out--39.2%
*-commutative39.2%
+-commutative39.2%
sub-neg39.2%
metadata-eval39.2%
+-commutative39.2%
Simplified39.2%
Taylor expanded in eps around 0 42.8%
Taylor expanded in eps around 0 42.8%
if -3.10000000000000015e-247 < x Initial program 75.3%
fma-neg75.3%
/-rgt-identity75.3%
fma-neg75.3%
/-rgt-identity75.3%
distribute-rgt-neg-in75.3%
sub-neg75.3%
metadata-eval75.3%
distribute-rgt-neg-in75.3%
Simplified75.3%
Taylor expanded in x around 0 37.1%
Taylor expanded in x around 0 40.5%
mul-1-neg40.5%
associate-*r*40.5%
Simplified40.5%
Taylor expanded in eps around inf 49.0%
associate-*r*49.0%
neg-mul-149.0%
Simplified49.0%
Final simplification46.5%
(FPCore (x eps) :precision binary64 (/ (+ 2.0 (* x eps)) 2.0))
double code(double x, double eps) {
return (2.0 + (x * eps)) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (x * eps)) / 2.0d0
end function
public static double code(double x, double eps) {
return (2.0 + (x * eps)) / 2.0;
}
def code(x, eps): return (2.0 + (x * eps)) / 2.0
function code(x, eps) return Float64(Float64(2.0 + Float64(x * eps)) / 2.0) end
function tmp = code(x, eps) tmp = (2.0 + (x * eps)) / 2.0; end
code[x_, eps_] := N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 + x \cdot \varepsilon}{2}
\end{array}
Initial program 73.9%
fma-neg73.9%
/-rgt-identity73.9%
fma-neg73.9%
/-rgt-identity73.9%
distribute-rgt-neg-in73.9%
sub-neg73.9%
metadata-eval73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in x around 0 40.5%
Taylor expanded in x around 0 35.9%
mul-1-neg35.9%
associate-*r*35.9%
Simplified35.9%
Taylor expanded in eps around inf 49.2%
associate-*r*49.2%
neg-mul-149.2%
Simplified49.2%
Final simplification49.2%
(FPCore (x eps) :precision binary64 1.0)
double code(double x, double eps) {
return 1.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0
end function
public static double code(double x, double eps) {
return 1.0;
}
def code(x, eps): return 1.0
function code(x, eps) return 1.0 end
function tmp = code(x, eps) tmp = 1.0; end
code[x_, eps_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 73.9%
fma-neg73.9%
/-rgt-identity73.9%
fma-neg73.9%
/-rgt-identity73.9%
distribute-rgt-neg-in73.9%
sub-neg73.9%
metadata-eval73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in x around 0 41.9%
Final simplification41.9%
herbie shell --seed 2024020
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))