
(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 15 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}
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 3.8) (/ (+ (exp (- (* x eps) x)) (exp (* x (- eps)))) 2.0) (/ (+ (exp (* x (+ eps -1.0))) (exp (- x))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 3.8) {
tmp = (exp(((x * eps) - x)) + exp((x * -eps))) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp(-x)) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 3.8d0) then
tmp = (exp(((x * eps) - x)) + exp((x * -eps))) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 3.8) {
tmp = (Math.exp(((x * eps) - x)) + Math.exp((x * -eps))) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 3.8: tmp = (math.exp(((x * eps) - x)) + math.exp((x * -eps))) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp(-x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 3.8) tmp = Float64(Float64(exp(Float64(Float64(x * eps) - x)) + exp(Float64(x * Float64(-eps)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(-x))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 3.8) tmp = (exp(((x * eps) - x)) + exp((x * -eps))) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 3.8], N[(N[(N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.8:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 3.7999999999999998Initial program 62.9%
div-sub62.9%
+-rgt-identity62.9%
div-sub62.9%
Simplified62.9%
Taylor expanded in eps around inf 98.6%
*-commutative98.6%
sub-neg98.6%
mul-1-neg98.6%
*-commutative98.6%
mul-1-neg98.6%
*-commutative98.6%
mul-1-neg98.6%
sub-neg98.6%
mul-1-neg98.6%
+-commutative98.6%
exp-prod98.6%
*-lft-identity98.6%
metadata-eval98.6%
cancel-sign-sub-inv98.6%
exp-prod98.6%
Simplified98.6%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around inf 98.6%
if 3.7999999999999998 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
exp-prod100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.9%
Final simplification88.7%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x -2.45e+86)
(/ (/ 2.0 (exp x)) 2.0)
(if (<= x -4.8e-167)
(/ (+ (exp (* x (- eps))) (- 1.0 (* x (- 1.0 eps)))) 2.0)
(/ (+ (exp (* x (+ eps -1.0))) (exp (- x))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -2.45e+86) {
tmp = (2.0 / exp(x)) / 2.0;
} else if (x <= -4.8e-167) {
tmp = (exp((x * -eps)) + (1.0 - (x * (1.0 - eps)))) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp(-x)) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-2.45d+86)) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else if (x <= (-4.8d-167)) then
tmp = (exp((x * -eps)) + (1.0d0 - (x * (1.0d0 - eps)))) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -2.45e+86) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else if (x <= -4.8e-167) {
tmp = (Math.exp((x * -eps)) + (1.0 - (x * (1.0 - eps)))) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -2.45e+86: tmp = (2.0 / math.exp(x)) / 2.0 elif x <= -4.8e-167: tmp = (math.exp((x * -eps)) + (1.0 - (x * (1.0 - eps)))) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp(-x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -2.45e+86) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); elseif (x <= -4.8e-167) tmp = Float64(Float64(exp(Float64(x * Float64(-eps))) + Float64(1.0 - Float64(x * Float64(1.0 - eps)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(-x))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.45e+86) tmp = (2.0 / exp(x)) / 2.0; elseif (x <= -4.8e-167) tmp = (exp((x * -eps)) + (1.0 - (x * (1.0 - eps)))) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -2.45e+86], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.8e-167], N[(N[(N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.45 \cdot 10^{+86}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-167}:\\
\;\;\;\;\frac{e^{x \cdot \left(-\varepsilon\right)} + \left(1 - x \cdot \left(1 - \varepsilon\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -2.45e86Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
exp-prod100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Taylor expanded in eps around 0 100.0%
exp-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -2.45e86 < x < -4.79999999999999986e-167Initial program 59.2%
div-sub59.2%
+-rgt-identity59.2%
div-sub59.2%
Simplified59.2%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
sub-neg97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
sub-neg97.5%
mul-1-neg97.5%
+-commutative97.5%
exp-prod97.5%
*-lft-identity97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
exp-prod97.5%
Simplified97.5%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 77.8%
if -4.79999999999999986e-167 < x Initial program 73.4%
div-sub73.4%
+-rgt-identity73.4%
div-sub73.4%
Simplified73.4%
Taylor expanded in eps around inf 99.2%
*-commutative99.2%
sub-neg99.2%
mul-1-neg99.2%
*-commutative99.2%
mul-1-neg99.2%
*-commutative99.2%
mul-1-neg99.2%
sub-neg99.2%
mul-1-neg99.2%
+-commutative99.2%
exp-prod99.2%
*-lft-identity99.2%
metadata-eval99.2%
cancel-sign-sub-inv99.2%
exp-prod99.2%
Simplified99.2%
Taylor expanded in eps around 0 82.2%
Final simplification83.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
NOTE: eps should be positive before calling this function
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
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
eps = abs(eps) def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
NOTE: eps should be positive before calling this function 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}
eps = |eps|\\
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 74.2%
div-sub74.2%
+-rgt-identity74.2%
div-sub74.2%
Simplified74.2%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
sub-neg99.0%
mul-1-neg99.0%
*-commutative99.0%
mul-1-neg99.0%
*-commutative99.0%
mul-1-neg99.0%
sub-neg99.0%
mul-1-neg99.0%
+-commutative99.0%
exp-prod99.0%
*-lft-identity99.0%
metadata-eval99.0%
cancel-sign-sub-inv99.0%
exp-prod99.0%
Simplified99.0%
Final simplification99.0%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* x (- 1.0 eps))))
(t_1 (exp (* x (+ eps -1.0))))
(t_2 (/ (/ 2.0 (exp x)) 2.0))
(t_3 (+ 1.0 (/ 1.0 eps))))
(if (<= x -2.45e+86)
t_2
(if (<= x -4.8e-167)
(/ (+ (exp (* x (- eps))) t_0) 2.0)
(if (<= x 1.25e+61)
(/ (- t_1 -1.0) 2.0)
(if (<= x 1.85e+223)
(/ (+ (* t_1 t_3) (+ (- 1.0 x) (- x (* x eps)))) 2.0)
(if (<= x 3.5e+259)
(/
(+ (* t_0 t_3) (* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0)
t_2)))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 1.0 - (x * (1.0 - eps));
double t_1 = exp((x * (eps + -1.0)));
double t_2 = (2.0 / exp(x)) / 2.0;
double t_3 = 1.0 + (1.0 / eps);
double tmp;
if (x <= -2.45e+86) {
tmp = t_2;
} else if (x <= -4.8e-167) {
tmp = (exp((x * -eps)) + t_0) / 2.0;
} else if (x <= 1.25e+61) {
tmp = (t_1 - -1.0) / 2.0;
} else if (x <= 1.85e+223) {
tmp = ((t_1 * t_3) + ((1.0 - x) + (x - (x * eps)))) / 2.0;
} else if (x <= 3.5e+259) {
tmp = ((t_0 * t_3) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 1.0d0 - (x * (1.0d0 - eps))
t_1 = exp((x * (eps + (-1.0d0))))
t_2 = (2.0d0 / exp(x)) / 2.0d0
t_3 = 1.0d0 + (1.0d0 / eps)
if (x <= (-2.45d+86)) then
tmp = t_2
else if (x <= (-4.8d-167)) then
tmp = (exp((x * -eps)) + t_0) / 2.0d0
else if (x <= 1.25d+61) then
tmp = (t_1 - (-1.0d0)) / 2.0d0
else if (x <= 1.85d+223) then
tmp = ((t_1 * t_3) + ((1.0d0 - x) + (x - (x * eps)))) / 2.0d0
else if (x <= 3.5d+259) then
tmp = ((t_0 * t_3) + ((1.0d0 + (x * ((-1.0d0) - eps))) * ((-1.0d0) / eps))) / 2.0d0
else
tmp = t_2
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 1.0 - (x * (1.0 - eps));
double t_1 = Math.exp((x * (eps + -1.0)));
double t_2 = (2.0 / Math.exp(x)) / 2.0;
double t_3 = 1.0 + (1.0 / eps);
double tmp;
if (x <= -2.45e+86) {
tmp = t_2;
} else if (x <= -4.8e-167) {
tmp = (Math.exp((x * -eps)) + t_0) / 2.0;
} else if (x <= 1.25e+61) {
tmp = (t_1 - -1.0) / 2.0;
} else if (x <= 1.85e+223) {
tmp = ((t_1 * t_3) + ((1.0 - x) + (x - (x * eps)))) / 2.0;
} else if (x <= 3.5e+259) {
tmp = ((t_0 * t_3) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
} else {
tmp = t_2;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 1.0 - (x * (1.0 - eps)) t_1 = math.exp((x * (eps + -1.0))) t_2 = (2.0 / math.exp(x)) / 2.0 t_3 = 1.0 + (1.0 / eps) tmp = 0 if x <= -2.45e+86: tmp = t_2 elif x <= -4.8e-167: tmp = (math.exp((x * -eps)) + t_0) / 2.0 elif x <= 1.25e+61: tmp = (t_1 - -1.0) / 2.0 elif x <= 1.85e+223: tmp = ((t_1 * t_3) + ((1.0 - x) + (x - (x * eps)))) / 2.0 elif x <= 3.5e+259: tmp = ((t_0 * t_3) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 else: tmp = t_2 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(1.0 - Float64(x * Float64(1.0 - eps))) t_1 = exp(Float64(x * Float64(eps + -1.0))) t_2 = Float64(Float64(2.0 / exp(x)) / 2.0) t_3 = Float64(1.0 + Float64(1.0 / eps)) tmp = 0.0 if (x <= -2.45e+86) tmp = t_2; elseif (x <= -4.8e-167) tmp = Float64(Float64(exp(Float64(x * Float64(-eps))) + t_0) / 2.0); elseif (x <= 1.25e+61) tmp = Float64(Float64(t_1 - -1.0) / 2.0); elseif (x <= 1.85e+223) tmp = Float64(Float64(Float64(t_1 * t_3) + Float64(Float64(1.0 - x) + Float64(x - Float64(x * eps)))) / 2.0); elseif (x <= 3.5e+259) tmp = Float64(Float64(Float64(t_0 * t_3) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); else tmp = t_2; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 1.0 - (x * (1.0 - eps)); t_1 = exp((x * (eps + -1.0))); t_2 = (2.0 / exp(x)) / 2.0; t_3 = 1.0 + (1.0 / eps); tmp = 0.0; if (x <= -2.45e+86) tmp = t_2; elseif (x <= -4.8e-167) tmp = (exp((x * -eps)) + t_0) / 2.0; elseif (x <= 1.25e+61) tmp = (t_1 - -1.0) / 2.0; elseif (x <= 1.85e+223) tmp = ((t_1 * t_3) + ((1.0 - x) + (x - (x * eps)))) / 2.0; elseif (x <= 3.5e+259) tmp = ((t_0 * t_3) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0; else tmp = t_2; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.45e+86], t$95$2, If[LessEqual[x, -4.8e-167], N[(N[(N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.25e+61], N[(N[(t$95$1 - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.85e+223], N[(N[(N[(t$95$1 * t$95$3), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] + N[(x - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.5e+259], N[(N[(N[(t$95$0 * t$95$3), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := 1 - x \cdot \left(1 - \varepsilon\right)\\
t_1 := e^{x \cdot \left(\varepsilon + -1\right)}\\
t_2 := \frac{\frac{2}{e^{x}}}{2}\\
t_3 := 1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{+86}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-167}:\\
\;\;\;\;\frac{e^{x \cdot \left(-\varepsilon\right)} + t_0}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+61}:\\
\;\;\;\;\frac{t_1 - -1}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+223}:\\
\;\;\;\;\frac{t_1 \cdot t_3 + \left(\left(1 - x\right) + \left(x - x \cdot \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+259}:\\
\;\;\;\;\frac{t_0 \cdot t_3 + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -2.45e86 or 3.4999999999999998e259 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
exp-prod100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in eps around 0 89.5%
Taylor expanded in eps around 0 89.5%
exp-neg89.5%
associate-*r/89.5%
metadata-eval89.5%
Simplified89.5%
if -2.45e86 < x < -4.79999999999999986e-167Initial program 59.2%
div-sub59.2%
+-rgt-identity59.2%
div-sub59.2%
Simplified59.2%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
sub-neg97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
sub-neg97.5%
mul-1-neg97.5%
+-commutative97.5%
exp-prod97.5%
*-lft-identity97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
exp-prod97.5%
Simplified97.5%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 77.8%
if -4.79999999999999986e-167 < x < 1.25000000000000004e61Initial program 57.9%
div-sub57.9%
+-rgt-identity57.9%
div-sub57.9%
Simplified57.9%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
sub-neg98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
+-commutative98.8%
exp-prod98.8%
*-lft-identity98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
exp-prod98.8%
Simplified98.8%
Taylor expanded in x around 0 88.2%
if 1.25000000000000004e61 < x < 1.8500000000000001e223Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 28.2%
mul-1-neg28.2%
+-commutative28.2%
*-commutative28.2%
+-commutative28.2%
Simplified28.2%
Taylor expanded in eps around inf 72.7%
+-commutative72.7%
distribute-rgt-out72.7%
metadata-eval72.7%
sub-neg72.7%
*-commutative72.7%
mul-1-neg72.7%
unsub-neg72.7%
*-commutative72.7%
distribute-rgt-out--72.7%
*-lft-identity72.7%
Simplified72.7%
if 1.8500000000000001e223 < x < 3.4999999999999998e259Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification82.6%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* x (- 1.0 eps)))) (t_1 (/ (/ 2.0 (exp x)) 2.0)))
(if (<= x -2.45e+86)
t_1
(if (<= x -4.8e-167)
(/ (+ (exp (* x (- eps))) t_0) 2.0)
(if (<= x 3.7e+158)
(/ (- (exp (* x (+ eps -1.0))) -1.0) 2.0)
(if (or (<= x 5.5e+222) (not (<= x 2.8e+259)))
t_1
(/
(+
(* t_0 (+ 1.0 (/ 1.0 eps)))
(* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0)))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 1.0 - (x * (1.0 - eps));
double t_1 = (2.0 / exp(x)) / 2.0;
double tmp;
if (x <= -2.45e+86) {
tmp = t_1;
} else if (x <= -4.8e-167) {
tmp = (exp((x * -eps)) + t_0) / 2.0;
} else if (x <= 3.7e+158) {
tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.0;
} else if ((x <= 5.5e+222) || !(x <= 2.8e+259)) {
tmp = t_1;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 - (x * (1.0d0 - eps))
t_1 = (2.0d0 / exp(x)) / 2.0d0
if (x <= (-2.45d+86)) then
tmp = t_1
else if (x <= (-4.8d-167)) then
tmp = (exp((x * -eps)) + t_0) / 2.0d0
else if (x <= 3.7d+158) then
tmp = (exp((x * (eps + (-1.0d0)))) - (-1.0d0)) / 2.0d0
else if ((x <= 5.5d+222) .or. (.not. (x <= 2.8d+259))) then
tmp = t_1
else
tmp = ((t_0 * (1.0d0 + (1.0d0 / eps))) + ((1.0d0 + (x * ((-1.0d0) - eps))) * ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 1.0 - (x * (1.0 - eps));
double t_1 = (2.0 / Math.exp(x)) / 2.0;
double tmp;
if (x <= -2.45e+86) {
tmp = t_1;
} else if (x <= -4.8e-167) {
tmp = (Math.exp((x * -eps)) + t_0) / 2.0;
} else if (x <= 3.7e+158) {
tmp = (Math.exp((x * (eps + -1.0))) - -1.0) / 2.0;
} else if ((x <= 5.5e+222) || !(x <= 2.8e+259)) {
tmp = t_1;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 1.0 - (x * (1.0 - eps)) t_1 = (2.0 / math.exp(x)) / 2.0 tmp = 0 if x <= -2.45e+86: tmp = t_1 elif x <= -4.8e-167: tmp = (math.exp((x * -eps)) + t_0) / 2.0 elif x <= 3.7e+158: tmp = (math.exp((x * (eps + -1.0))) - -1.0) / 2.0 elif (x <= 5.5e+222) or not (x <= 2.8e+259): tmp = t_1 else: tmp = ((t_0 * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(1.0 - Float64(x * Float64(1.0 - eps))) t_1 = Float64(Float64(2.0 / exp(x)) / 2.0) tmp = 0.0 if (x <= -2.45e+86) tmp = t_1; elseif (x <= -4.8e-167) tmp = Float64(Float64(exp(Float64(x * Float64(-eps))) + t_0) / 2.0); elseif (x <= 3.7e+158) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) - -1.0) / 2.0); elseif ((x <= 5.5e+222) || !(x <= 2.8e+259)) tmp = t_1; else tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 1.0 - (x * (1.0 - eps)); t_1 = (2.0 / exp(x)) / 2.0; tmp = 0.0; if (x <= -2.45e+86) tmp = t_1; elseif (x <= -4.8e-167) tmp = (exp((x * -eps)) + t_0) / 2.0; elseif (x <= 3.7e+158) tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.0; elseif ((x <= 5.5e+222) || ~((x <= 2.8e+259))) tmp = t_1; else tmp = ((t_0 * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2.45e+86], t$95$1, If[LessEqual[x, -4.8e-167], N[(N[(N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.7e+158], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5.5e+222], N[Not[LessEqual[x, 2.8e+259]], $MachinePrecision]], t$95$1, N[(N[(N[(t$95$0 * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := 1 - x \cdot \left(1 - \varepsilon\right)\\
t_1 := \frac{\frac{2}{e^{x}}}{2}\\
\mathbf{if}\;x \leq -2.45 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-167}:\\
\;\;\;\;\frac{e^{x \cdot \left(-\varepsilon\right)} + t_0}{2}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+158}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+222} \lor \neg \left(x \leq 2.8 \cdot 10^{+259}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\end{array}
\end{array}
if x < -2.45e86 or 3.70000000000000011e158 < x < 5.4999999999999999e222 or 2.8000000000000001e259 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
exp-prod100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in eps around 0 91.5%
Taylor expanded in eps around 0 88.1%
exp-neg88.1%
associate-*r/88.1%
metadata-eval88.1%
Simplified88.1%
if -2.45e86 < x < -4.79999999999999986e-167Initial program 59.2%
div-sub59.2%
+-rgt-identity59.2%
div-sub59.2%
Simplified59.2%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
sub-neg97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
*-commutative97.5%
mul-1-neg97.5%
sub-neg97.5%
mul-1-neg97.5%
+-commutative97.5%
exp-prod97.5%
*-lft-identity97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
exp-prod97.5%
Simplified97.5%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 77.8%
if -4.79999999999999986e-167 < x < 3.70000000000000011e158Initial program 66.8%
div-sub66.8%
+-rgt-identity66.8%
div-sub66.8%
Simplified66.8%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
sub-neg99.1%
mul-1-neg99.1%
*-commutative99.1%
mul-1-neg99.1%
*-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
mul-1-neg99.1%
+-commutative99.1%
exp-prod99.1%
*-lft-identity99.1%
metadata-eval99.1%
cancel-sign-sub-inv99.1%
exp-prod99.1%
Simplified99.1%
Taylor expanded in x around 0 74.1%
if 5.4999999999999999e222 < x < 2.8000000000000001e259Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification76.9%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (/ 2.0 (exp x)) 2.0)))
(if (<= x 5000000000.0)
t_0
(if (<= x 1.5e+158)
(/ (/ (+ x (expm1 x)) eps) 2.0)
(if (or (<= x 5.1e+222) (not (<= x 1.05e+258)))
t_0
(/
(+
(* (- 1.0 (* x (- 1.0 eps))) (+ 1.0 (/ 1.0 eps)))
(* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (2.0 / exp(x)) / 2.0;
double tmp;
if (x <= 5000000000.0) {
tmp = t_0;
} else if (x <= 1.5e+158) {
tmp = ((x + expm1(x)) / eps) / 2.0;
} else if ((x <= 5.1e+222) || !(x <= 1.05e+258)) {
tmp = t_0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (2.0 / Math.exp(x)) / 2.0;
double tmp;
if (x <= 5000000000.0) {
tmp = t_0;
} else if (x <= 1.5e+158) {
tmp = ((x + Math.expm1(x)) / eps) / 2.0;
} else if ((x <= 5.1e+222) || !(x <= 1.05e+258)) {
tmp = t_0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (2.0 / math.exp(x)) / 2.0 tmp = 0 if x <= 5000000000.0: tmp = t_0 elif x <= 1.5e+158: tmp = ((x + math.expm1(x)) / eps) / 2.0 elif (x <= 5.1e+222) or not (x <= 1.05e+258): tmp = t_0 else: tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(2.0 / exp(x)) / 2.0) tmp = 0.0 if (x <= 5000000000.0) tmp = t_0; elseif (x <= 1.5e+158) tmp = Float64(Float64(Float64(x + expm1(x)) / eps) / 2.0); elseif ((x <= 5.1e+222) || !(x <= 1.05e+258)) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps))) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); end return tmp end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 5000000000.0], t$95$0, If[LessEqual[x, 1.5e+158], N[(N[(N[(x + N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5.1e+222], N[Not[LessEqual[x, 1.05e+258]], $MachinePrecision]], t$95$0, N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{e^{x}}}{2}\\
\mathbf{if}\;x \leq 5000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+158}:\\
\;\;\;\;\frac{\frac{x + \mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+222} \lor \neg \left(x \leq 1.05 \cdot 10^{+258}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - \varepsilon\right)\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\end{array}
\end{array}
if x < 5e9 or 1.5e158 < x < 5.0999999999999999e222 or 1.04999999999999998e258 < x Initial program 68.0%
div-sub68.0%
+-rgt-identity68.0%
div-sub68.0%
Simplified68.0%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
sub-neg98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
+-commutative98.8%
exp-prod98.8%
*-lft-identity98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
exp-prod98.8%
Simplified98.8%
Taylor expanded in eps around 0 90.9%
Taylor expanded in eps around 0 82.3%
exp-neg82.3%
associate-*r/82.3%
metadata-eval82.3%
Simplified82.3%
if 5e9 < x < 1.5e158Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 38.8%
mul-1-neg38.8%
+-commutative38.8%
*-commutative38.8%
+-commutative38.8%
Simplified38.8%
Taylor expanded in eps around 0 1.7%
+-commutative1.7%
neg-mul-11.7%
associate--l+1.7%
expm1-def1.7%
Simplified1.7%
expm1-log1p-u1.7%
expm1-udef1.7%
add-sqr-sqrt0.0%
sqrt-unprod22.5%
sqr-neg22.5%
sqrt-unprod22.5%
add-sqr-sqrt22.5%
Applied egg-rr22.5%
expm1-def22.5%
expm1-log1p22.5%
Simplified22.5%
if 5.0999999999999999e222 < x < 1.04999999999999998e258Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification71.4%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (/ 2.0 (exp x)) 2.0)))
(if (<= x -4.8e-167)
t_0
(if (<= x 3.5e+158)
(/ (- (exp (* x (+ eps -1.0))) -1.0) 2.0)
(if (or (<= x 5e+222) (not (<= x 4.5e+254)))
t_0
(/
(+
(* (- 1.0 (* x (- 1.0 eps))) (+ 1.0 (/ 1.0 eps)))
(* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (2.0 / exp(x)) / 2.0;
double tmp;
if (x <= -4.8e-167) {
tmp = t_0;
} else if (x <= 3.5e+158) {
tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.0;
} else if ((x <= 5e+222) || !(x <= 4.5e+254)) {
tmp = t_0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 = (2.0d0 / exp(x)) / 2.0d0
if (x <= (-4.8d-167)) then
tmp = t_0
else if (x <= 3.5d+158) then
tmp = (exp((x * (eps + (-1.0d0)))) - (-1.0d0)) / 2.0d0
else if ((x <= 5d+222) .or. (.not. (x <= 4.5d+254))) then
tmp = t_0
else
tmp = (((1.0d0 - (x * (1.0d0 - eps))) * (1.0d0 + (1.0d0 / eps))) + ((1.0d0 + (x * ((-1.0d0) - eps))) * ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (2.0 / Math.exp(x)) / 2.0;
double tmp;
if (x <= -4.8e-167) {
tmp = t_0;
} else if (x <= 3.5e+158) {
tmp = (Math.exp((x * (eps + -1.0))) - -1.0) / 2.0;
} else if ((x <= 5e+222) || !(x <= 4.5e+254)) {
tmp = t_0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (2.0 / math.exp(x)) / 2.0 tmp = 0 if x <= -4.8e-167: tmp = t_0 elif x <= 3.5e+158: tmp = (math.exp((x * (eps + -1.0))) - -1.0) / 2.0 elif (x <= 5e+222) or not (x <= 4.5e+254): tmp = t_0 else: tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(2.0 / exp(x)) / 2.0) tmp = 0.0 if (x <= -4.8e-167) tmp = t_0; elseif (x <= 3.5e+158) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) - -1.0) / 2.0); elseif ((x <= 5e+222) || !(x <= 4.5e+254)) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps))) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (2.0 / exp(x)) / 2.0; tmp = 0.0; if (x <= -4.8e-167) tmp = t_0; elseif (x <= 3.5e+158) tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.0; elseif ((x <= 5e+222) || ~((x <= 4.5e+254))) tmp = t_0; else tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -4.8e-167], t$95$0, If[LessEqual[x, 3.5e+158], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5e+222], N[Not[LessEqual[x, 4.5e+254]], $MachinePrecision]], t$95$0, N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{e^{x}}}{2}\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{-167}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+158}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+222} \lor \neg \left(x \leq 4.5 \cdot 10^{+254}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - \varepsilon\right)\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\end{array}
\end{array}
if x < -4.79999999999999986e-167 or 3.5000000000000001e158 < x < 5.00000000000000023e222 or 4.4999999999999998e254 < x Initial program 82.6%
div-sub82.6%
+-rgt-identity82.6%
div-sub82.6%
Simplified82.6%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
sub-neg98.9%
mul-1-neg98.9%
*-commutative98.9%
mul-1-neg98.9%
*-commutative98.9%
mul-1-neg98.9%
sub-neg98.9%
mul-1-neg98.9%
+-commutative98.9%
exp-prod98.9%
*-lft-identity98.9%
metadata-eval98.9%
cancel-sign-sub-inv98.9%
exp-prod98.9%
Simplified98.9%
Taylor expanded in eps around 0 87.2%
Taylor expanded in eps around 0 79.9%
exp-neg79.9%
associate-*r/79.9%
metadata-eval79.9%
Simplified79.9%
if -4.79999999999999986e-167 < x < 3.5000000000000001e158Initial program 66.8%
div-sub66.8%
+-rgt-identity66.8%
div-sub66.8%
Simplified66.8%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
sub-neg99.1%
mul-1-neg99.1%
*-commutative99.1%
mul-1-neg99.1%
*-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
mul-1-neg99.1%
+-commutative99.1%
exp-prod99.1%
*-lft-identity99.1%
metadata-eval99.1%
cancel-sign-sub-inv99.1%
exp-prod99.1%
Simplified99.1%
Taylor expanded in x around 0 74.1%
if 5.00000000000000023e222 < x < 4.4999999999999998e254Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification75.4%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (or (<= x 5.2e+222) (not (<= x 9e+257)))
(/ (/ 2.0 (exp x)) 2.0)
(/
(+
(* (- 1.0 (* x (- 1.0 eps))) (+ 1.0 (/ 1.0 eps)))
(* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0)))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if ((x <= 5.2e+222) || !(x <= 9e+257)) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= 5.2d+222) .or. (.not. (x <= 9d+257))) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (((1.0d0 - (x * (1.0d0 - eps))) * (1.0d0 + (1.0d0 / eps))) + ((1.0d0 + (x * ((-1.0d0) - eps))) * ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if ((x <= 5.2e+222) || !(x <= 9e+257)) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if (x <= 5.2e+222) or not (x <= 9e+257): tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if ((x <= 5.2e+222) || !(x <= 9e+257)) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps))) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= 5.2e+222) || ~((x <= 9e+257))) tmp = (2.0 / exp(x)) / 2.0; else tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[Or[LessEqual[x, 5.2e+222], N[Not[LessEqual[x, 9e+257]], $MachinePrecision]], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.2 \cdot 10^{+222} \lor \neg \left(x \leq 9 \cdot 10^{+257}\right):\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - \varepsilon\right)\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\end{array}
\end{array}
if x < 5.2000000000000002e222 or 8.9999999999999999e257 < x Initial program 73.3%
div-sub73.3%
+-rgt-identity73.3%
div-sub73.3%
Simplified73.3%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
sub-neg99.0%
mul-1-neg99.0%
*-commutative99.0%
mul-1-neg99.0%
*-commutative99.0%
mul-1-neg99.0%
sub-neg99.0%
mul-1-neg99.0%
+-commutative99.0%
exp-prod99.0%
*-lft-identity99.0%
metadata-eval99.0%
cancel-sign-sub-inv99.0%
exp-prod99.0%
Simplified99.0%
Taylor expanded in eps around 0 85.2%
Taylor expanded in eps around 0 74.5%
exp-neg74.5%
associate-*r/74.5%
metadata-eval74.5%
Simplified74.5%
if 5.2000000000000002e222 < x < 8.9999999999999999e257Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification73.5%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (* (* x x) -0.5))))
(if (<= x -2050000.0)
(/ (/ (* x (* x 0.5)) eps) 2.0)
(if (<= x 1.4)
(/ (+ t_0 t_0) 2.0)
(if (<= x 9.4e+222)
0.0
(if (<= x 1e+259)
(/
(+
(* (- 1.0 (* x (- 1.0 eps))) (+ 1.0 (/ 1.0 eps)))
(* (+ 1.0 (* x (- -1.0 eps))) (/ -1.0 eps)))
2.0)
0.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double tmp;
if (x <= -2050000.0) {
tmp = ((x * (x * 0.5)) / eps) / 2.0;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 9.4e+222) {
tmp = 0.0;
} else if (x <= 1e+259) {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 + ((x * x) * (-0.5d0))
if (x <= (-2050000.0d0)) then
tmp = ((x * (x * 0.5d0)) / eps) / 2.0d0
else if (x <= 1.4d0) then
tmp = (t_0 + t_0) / 2.0d0
else if (x <= 9.4d+222) then
tmp = 0.0d0
else if (x <= 1d+259) then
tmp = (((1.0d0 - (x * (1.0d0 - eps))) * (1.0d0 + (1.0d0 / eps))) + ((1.0d0 + (x * ((-1.0d0) - eps))) * ((-1.0d0) / eps))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double tmp;
if (x <= -2050000.0) {
tmp = ((x * (x * 0.5)) / eps) / 2.0;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 9.4e+222) {
tmp = 0.0;
} else if (x <= 1e+259) {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 1.0 + ((x * x) * -0.5) tmp = 0 if x <= -2050000.0: tmp = ((x * (x * 0.5)) / eps) / 2.0 elif x <= 1.4: tmp = (t_0 + t_0) / 2.0 elif x <= 9.4e+222: tmp = 0.0 elif x <= 1e+259: tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(1.0 + Float64(Float64(x * x) * -0.5)) tmp = 0.0 if (x <= -2050000.0) tmp = Float64(Float64(Float64(x * Float64(x * 0.5)) / eps) / 2.0); elseif (x <= 1.4) tmp = Float64(Float64(t_0 + t_0) / 2.0); elseif (x <= 9.4e+222) tmp = 0.0; elseif (x <= 1e+259) tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps))) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(1.0 + Float64(x * Float64(-1.0 - eps))) * Float64(-1.0 / eps))) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 1.0 + ((x * x) * -0.5); tmp = 0.0; if (x <= -2050000.0) tmp = ((x * (x * 0.5)) / eps) / 2.0; elseif (x <= 1.4) tmp = (t_0 + t_0) / 2.0; elseif (x <= 9.4e+222) tmp = 0.0; elseif (x <= 1e+259) tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((1.0 + (x * (-1.0 - eps))) * (-1.0 / eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2050000.0], N[(N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.4e+222], 0.0, If[LessEqual[x, 1e+259], N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := 1 + \left(x \cdot x\right) \cdot -0.5\\
\mathbf{if}\;x \leq -2050000:\\
\;\;\;\;\frac{\frac{x \cdot \left(x \cdot 0.5\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{elif}\;x \leq 9.4 \cdot 10^{+222}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 10^{+259}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - \varepsilon\right)\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right) \cdot \frac{-1}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.05e6Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 34.1%
mul-1-neg34.1%
+-commutative34.1%
*-commutative34.1%
+-commutative34.1%
Simplified34.1%
Taylor expanded in eps around 0 55.3%
+-commutative55.3%
neg-mul-155.3%
associate--l+55.3%
expm1-def55.3%
Simplified55.3%
Taylor expanded in x around 0 35.0%
*-commutative35.0%
unpow235.0%
associate-*l*35.0%
Simplified35.0%
if -2.05e6 < x < 1.3999999999999999Initial program 52.9%
div-sub52.9%
+-rgt-identity52.9%
div-sub52.9%
Simplified52.9%
Taylor expanded in eps around 0 79.9%
*-commutative79.9%
distribute-lft1-in79.9%
mul-1-neg79.9%
distribute-lft-out79.9%
mul-1-neg79.9%
*-commutative79.9%
distribute-lft1-in80.6%
mul-1-neg80.6%
Simplified80.6%
Taylor expanded in x around 0 80.1%
*-commutative80.1%
unpow280.1%
Simplified80.1%
Taylor expanded in x around 0 79.4%
*-commutative80.1%
unpow280.1%
Simplified79.4%
if 1.3999999999999999 < x < 9.3999999999999998e222 or 9.999999999999999e258 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
mul-1-neg31.0%
+-commutative31.0%
*-commutative31.0%
+-commutative31.0%
Simplified31.0%
Taylor expanded in x around 0 18.0%
Taylor expanded in eps around 0 51.5%
distribute-lft1-in51.5%
metadata-eval51.5%
mul0-lft51.5%
+-inverses51.5%
div-sub22.5%
+-inverses51.5%
Simplified51.5%
if 9.3999999999999998e222 < x < 9.999999999999999e258Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 45.2%
Final simplification64.1%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (* (* x x) -0.5))))
(if (<= x -750000000.0)
(/ (/ (* x (* x 0.5)) eps) 2.0)
(if (<= x 1.4)
(/ (+ t_0 t_0) 2.0)
(if (<= x 2.05e+223)
0.0
(if (<= x 1.5e+253)
(/
(+
(* (- 1.0 (* x (- 1.0 eps))) (+ 1.0 (/ 1.0 eps)))
(/ (+ x -1.0) eps))
2.0)
0.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double tmp;
if (x <= -750000000.0) {
tmp = ((x * (x * 0.5)) / eps) / 2.0;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 2.05e+223) {
tmp = 0.0;
} else if (x <= 1.5e+253) {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((x + -1.0) / eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 + ((x * x) * (-0.5d0))
if (x <= (-750000000.0d0)) then
tmp = ((x * (x * 0.5d0)) / eps) / 2.0d0
else if (x <= 1.4d0) then
tmp = (t_0 + t_0) / 2.0d0
else if (x <= 2.05d+223) then
tmp = 0.0d0
else if (x <= 1.5d+253) then
tmp = (((1.0d0 - (x * (1.0d0 - eps))) * (1.0d0 + (1.0d0 / eps))) + ((x + (-1.0d0)) / eps)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double tmp;
if (x <= -750000000.0) {
tmp = ((x * (x * 0.5)) / eps) / 2.0;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 2.05e+223) {
tmp = 0.0;
} else if (x <= 1.5e+253) {
tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((x + -1.0) / eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 1.0 + ((x * x) * -0.5) tmp = 0 if x <= -750000000.0: tmp = ((x * (x * 0.5)) / eps) / 2.0 elif x <= 1.4: tmp = (t_0 + t_0) / 2.0 elif x <= 2.05e+223: tmp = 0.0 elif x <= 1.5e+253: tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((x + -1.0) / eps)) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(1.0 + Float64(Float64(x * x) * -0.5)) tmp = 0.0 if (x <= -750000000.0) tmp = Float64(Float64(Float64(x * Float64(x * 0.5)) / eps) / 2.0); elseif (x <= 1.4) tmp = Float64(Float64(t_0 + t_0) / 2.0); elseif (x <= 2.05e+223) tmp = 0.0; elseif (x <= 1.5e+253) tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps))) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(x + -1.0) / eps)) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 1.0 + ((x * x) * -0.5); tmp = 0.0; if (x <= -750000000.0) tmp = ((x * (x * 0.5)) / eps) / 2.0; elseif (x <= 1.4) tmp = (t_0 + t_0) / 2.0; elseif (x <= 2.05e+223) tmp = 0.0; elseif (x <= 1.5e+253) tmp = (((1.0 - (x * (1.0 - eps))) * (1.0 + (1.0 / eps))) + ((x + -1.0) / eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -750000000.0], N[(N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.4], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.05e+223], 0.0, If[LessEqual[x, 1.5e+253], N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := 1 + \left(x \cdot x\right) \cdot -0.5\\
\mathbf{if}\;x \leq -750000000:\\
\;\;\;\;\frac{\frac{x \cdot \left(x \cdot 0.5\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+223}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+253}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - \varepsilon\right)\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \frac{x + -1}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -7.5e8Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 34.1%
mul-1-neg34.1%
+-commutative34.1%
*-commutative34.1%
+-commutative34.1%
Simplified34.1%
Taylor expanded in eps around 0 55.3%
+-commutative55.3%
neg-mul-155.3%
associate--l+55.3%
expm1-def55.3%
Simplified55.3%
Taylor expanded in x around 0 35.0%
*-commutative35.0%
unpow235.0%
associate-*l*35.0%
Simplified35.0%
if -7.5e8 < x < 1.3999999999999999Initial program 52.9%
div-sub52.9%
+-rgt-identity52.9%
div-sub52.9%
Simplified52.9%
Taylor expanded in eps around 0 79.9%
*-commutative79.9%
distribute-lft1-in79.9%
mul-1-neg79.9%
distribute-lft-out79.9%
mul-1-neg79.9%
*-commutative79.9%
distribute-lft1-in80.6%
mul-1-neg80.6%
Simplified80.6%
Taylor expanded in x around 0 80.1%
*-commutative80.1%
unpow280.1%
Simplified80.1%
Taylor expanded in x around 0 79.4%
*-commutative80.1%
unpow280.1%
Simplified79.4%
if 1.3999999999999999 < x < 2.05e223 or 1.4999999999999999e253 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
mul-1-neg31.0%
+-commutative31.0%
*-commutative31.0%
+-commutative31.0%
Simplified31.0%
Taylor expanded in x around 0 18.0%
Taylor expanded in eps around 0 51.5%
distribute-lft1-in51.5%
metadata-eval51.5%
mul0-lft51.5%
+-inverses51.5%
div-sub22.5%
+-inverses51.5%
Simplified51.5%
if 2.05e223 < x < 1.4999999999999999e253Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
+-commutative55.9%
*-commutative55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in x around 0 22.2%
Taylor expanded in eps around 0 34.3%
Final simplification63.7%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (* (* x x) -0.5))) (t_1 (/ (/ (* x (* x 0.5)) eps) 2.0)))
(if (<= x -750000000.0)
t_1
(if (<= x 1.4)
(/ (+ t_0 t_0) 2.0)
(if (<= x 5e+222) 0.0 (if (<= x 8.2e+259) t_1 0.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double t_1 = ((x * (x * 0.5)) / eps) / 2.0;
double tmp;
if (x <= -750000000.0) {
tmp = t_1;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 5e+222) {
tmp = 0.0;
} else if (x <= 8.2e+259) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 + ((x * x) * (-0.5d0))
t_1 = ((x * (x * 0.5d0)) / eps) / 2.0d0
if (x <= (-750000000.0d0)) then
tmp = t_1
else if (x <= 1.4d0) then
tmp = (t_0 + t_0) / 2.0d0
else if (x <= 5d+222) then
tmp = 0.0d0
else if (x <= 8.2d+259) then
tmp = t_1
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 1.0 + ((x * x) * -0.5);
double t_1 = ((x * (x * 0.5)) / eps) / 2.0;
double tmp;
if (x <= -750000000.0) {
tmp = t_1;
} else if (x <= 1.4) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 5e+222) {
tmp = 0.0;
} else if (x <= 8.2e+259) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 1.0 + ((x * x) * -0.5) t_1 = ((x * (x * 0.5)) / eps) / 2.0 tmp = 0 if x <= -750000000.0: tmp = t_1 elif x <= 1.4: tmp = (t_0 + t_0) / 2.0 elif x <= 5e+222: tmp = 0.0 elif x <= 8.2e+259: tmp = t_1 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(1.0 + Float64(Float64(x * x) * -0.5)) t_1 = Float64(Float64(Float64(x * Float64(x * 0.5)) / eps) / 2.0) tmp = 0.0 if (x <= -750000000.0) tmp = t_1; elseif (x <= 1.4) tmp = Float64(Float64(t_0 + t_0) / 2.0); elseif (x <= 5e+222) tmp = 0.0; elseif (x <= 8.2e+259) tmp = t_1; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 1.0 + ((x * x) * -0.5); t_1 = ((x * (x * 0.5)) / eps) / 2.0; tmp = 0.0; if (x <= -750000000.0) tmp = t_1; elseif (x <= 1.4) tmp = (t_0 + t_0) / 2.0; elseif (x <= 5e+222) tmp = 0.0; elseif (x <= 8.2e+259) tmp = t_1; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -750000000.0], t$95$1, If[LessEqual[x, 1.4], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+222], 0.0, If[LessEqual[x, 8.2e+259], t$95$1, 0.0]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := 1 + \left(x \cdot x\right) \cdot -0.5\\
t_1 := \frac{\frac{x \cdot \left(x \cdot 0.5\right)}{\varepsilon}}{2}\\
\mathbf{if}\;x \leq -750000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.4:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+222}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+259}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -7.5e8 or 5.00000000000000023e222 < x < 8.2000000000000005e259Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 38.3%
mul-1-neg38.3%
+-commutative38.3%
*-commutative38.3%
+-commutative38.3%
Simplified38.3%
Taylor expanded in eps around 0 45.1%
+-commutative45.1%
neg-mul-145.1%
associate--l+45.1%
expm1-def45.1%
Simplified45.1%
Taylor expanded in x around 0 34.7%
*-commutative34.7%
unpow234.7%
associate-*l*34.7%
Simplified34.7%
if -7.5e8 < x < 1.3999999999999999Initial program 52.9%
div-sub52.9%
+-rgt-identity52.9%
div-sub52.9%
Simplified52.9%
Taylor expanded in eps around 0 79.9%
*-commutative79.9%
distribute-lft1-in79.9%
mul-1-neg79.9%
distribute-lft-out79.9%
mul-1-neg79.9%
*-commutative79.9%
distribute-lft1-in80.6%
mul-1-neg80.6%
Simplified80.6%
Taylor expanded in x around 0 80.1%
*-commutative80.1%
unpow280.1%
Simplified80.1%
Taylor expanded in x around 0 79.4%
*-commutative80.1%
unpow280.1%
Simplified79.4%
if 1.3999999999999999 < x < 5.00000000000000023e222 or 8.2000000000000005e259 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
mul-1-neg31.0%
+-commutative31.0%
*-commutative31.0%
+-commutative31.0%
Simplified31.0%
Taylor expanded in x around 0 18.0%
Taylor expanded in eps around 0 51.5%
distribute-lft1-in51.5%
metadata-eval51.5%
mul0-lft51.5%
+-inverses51.5%
div-sub22.5%
+-inverses51.5%
Simplified51.5%
Final simplification63.7%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (/ (* x (* x 0.5)) eps) 2.0)))
(if (<= x -9.8e+64)
t_0
(if (<= x 500.0) 1.0 (if (<= x 5e+222) 0.0 (if (<= x 4e+256) t_0 0.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = ((x * (x * 0.5)) / eps) / 2.0;
double tmp;
if (x <= -9.8e+64) {
tmp = t_0;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 5e+222) {
tmp = 0.0;
} else if (x <= 4e+256) {
tmp = t_0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 = ((x * (x * 0.5d0)) / eps) / 2.0d0
if (x <= (-9.8d+64)) then
tmp = t_0
else if (x <= 500.0d0) then
tmp = 1.0d0
else if (x <= 5d+222) then
tmp = 0.0d0
else if (x <= 4d+256) then
tmp = t_0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = ((x * (x * 0.5)) / eps) / 2.0;
double tmp;
if (x <= -9.8e+64) {
tmp = t_0;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 5e+222) {
tmp = 0.0;
} else if (x <= 4e+256) {
tmp = t_0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = ((x * (x * 0.5)) / eps) / 2.0 tmp = 0 if x <= -9.8e+64: tmp = t_0 elif x <= 500.0: tmp = 1.0 elif x <= 5e+222: tmp = 0.0 elif x <= 4e+256: tmp = t_0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(Float64(x * Float64(x * 0.5)) / eps) / 2.0) tmp = 0.0 if (x <= -9.8e+64) tmp = t_0; elseif (x <= 500.0) tmp = 1.0; elseif (x <= 5e+222) tmp = 0.0; elseif (x <= 4e+256) tmp = t_0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = ((x * (x * 0.5)) / eps) / 2.0; tmp = 0.0; if (x <= -9.8e+64) tmp = t_0; elseif (x <= 500.0) tmp = 1.0; elseif (x <= 5e+222) tmp = 0.0; elseif (x <= 4e+256) tmp = t_0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -9.8e+64], t$95$0, If[LessEqual[x, 500.0], 1.0, If[LessEqual[x, 5e+222], 0.0, If[LessEqual[x, 4e+256], t$95$0, 0.0]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{\frac{x \cdot \left(x \cdot 0.5\right)}{\varepsilon}}{2}\\
\mathbf{if}\;x \leq -9.8 \cdot 10^{+64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+222}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+256}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.8000000000000005e64 or 5.00000000000000023e222 < x < 4.0000000000000001e256Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 39.9%
mul-1-neg39.9%
+-commutative39.9%
*-commutative39.9%
+-commutative39.9%
Simplified39.9%
Taylor expanded in eps around 0 40.9%
+-commutative40.9%
neg-mul-140.9%
associate--l+40.9%
expm1-def40.9%
Simplified40.9%
Taylor expanded in x around 0 38.6%
*-commutative38.6%
unpow238.6%
associate-*l*38.6%
Simplified38.6%
if -9.8000000000000005e64 < x < 500Initial program 54.5%
div-sub54.5%
+-rgt-identity54.5%
div-sub54.5%
Simplified54.5%
Taylor expanded in x around 0 76.5%
if 500 < x < 5.00000000000000023e222 or 4.0000000000000001e256 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
mul-1-neg31.0%
+-commutative31.0%
*-commutative31.0%
+-commutative31.0%
Simplified31.0%
Taylor expanded in x around 0 18.0%
Taylor expanded in eps around 0 51.5%
distribute-lft1-in51.5%
metadata-eval51.5%
mul0-lft51.5%
+-inverses51.5%
div-sub22.5%
+-inverses51.5%
Simplified51.5%
Final simplification63.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x -2.5e-9) (/ (* x (- eps)) 2.0) (if (<= x 550.0) 1.0 0.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -2.5e-9) {
tmp = (x * -eps) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-2.5d-9)) then
tmp = (x * -eps) / 2.0d0
else if (x <= 550.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -2.5e-9) {
tmp = (x * -eps) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -2.5e-9: tmp = (x * -eps) / 2.0 elif x <= 550.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -2.5e-9) tmp = Float64(Float64(x * Float64(-eps)) / 2.0); elseif (x <= 550.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.5e-9) tmp = (x * -eps) / 2.0; elseif (x <= 550.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -2.5e-9], N[(N[(x * (-eps)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 550.0], 1.0, 0.0]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.5000000000000001e-9Initial program 97.5%
div-sub97.5%
+-rgt-identity97.5%
div-sub97.5%
Simplified97.5%
Taylor expanded in x around 0 34.9%
mul-1-neg34.9%
+-commutative34.9%
*-commutative34.9%
+-commutative34.9%
Simplified34.9%
Taylor expanded in x around -inf 22.5%
Taylor expanded in eps around inf 22.4%
associate-*r*22.4%
mul-1-neg22.4%
Simplified22.4%
if -2.5000000000000001e-9 < x < 550Initial program 52.9%
div-sub52.9%
+-rgt-identity52.9%
div-sub52.9%
Simplified52.9%
Taylor expanded in x around 0 80.3%
if 550 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 33.8%
mul-1-neg33.8%
+-commutative33.8%
*-commutative33.8%
+-commutative33.8%
Simplified33.8%
Taylor expanded in x around 0 18.5%
Taylor expanded in eps around 0 48.3%
distribute-lft1-in48.3%
metadata-eval48.3%
mul0-lft48.3%
+-inverses48.3%
div-sub22.6%
+-inverses48.3%
Simplified48.3%
Final simplification61.5%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 500.0) 1.0 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 500.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 500.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 500.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 500.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 500.0], 1.0, 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 500Initial program 62.9%
div-sub62.9%
+-rgt-identity62.9%
div-sub62.9%
Simplified62.9%
Taylor expanded in x around 0 62.9%
if 500 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 33.8%
mul-1-neg33.8%
+-commutative33.8%
*-commutative33.8%
+-commutative33.8%
Simplified33.8%
Taylor expanded in x around 0 18.5%
Taylor expanded in eps around 0 48.3%
distribute-lft1-in48.3%
metadata-eval48.3%
mul0-lft48.3%
+-inverses48.3%
div-sub22.6%
+-inverses48.3%
Simplified48.3%
Final simplification58.5%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 0.0)
eps = abs(eps);
double code(double x, double eps) {
return 0.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 0.0;
}
eps = abs(eps) def code(x, eps): return 0.0
eps = abs(eps) function code(x, eps) return 0.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 0.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 0.0
\begin{array}{l}
eps = |eps|\\
\\
0
\end{array}
Initial program 74.2%
div-sub74.2%
+-rgt-identity74.2%
div-sub74.2%
Simplified74.2%
Taylor expanded in x around 0 40.2%
mul-1-neg40.2%
+-commutative40.2%
*-commutative40.2%
+-commutative40.2%
Simplified40.2%
Taylor expanded in x around 0 23.9%
Taylor expanded in eps around 0 16.5%
distribute-lft1-in16.5%
metadata-eval16.5%
mul0-lft16.5%
+-inverses16.5%
div-sub8.7%
+-inverses16.5%
Simplified16.5%
Final simplification16.5%
herbie shell --seed 2023224
(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))