
(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))) (/ 1.0 (exp (+ x (* x eps))))) 0.5))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + (1.0 / exp((x + (x * eps))))) * 0.5;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps))))) * 0.5d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + (1.0 / Math.exp((x + (x * eps))))) * 0.5;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + (1.0 / math.exp((x + (x * eps))))) * 0.5
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps))))) * 0.5) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + (1.0 / exp((x + (x * eps))))) * 0.5; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(e^{x \cdot \left(\varepsilon + -1\right)} + \frac{1}{e^{x + x \cdot \varepsilon}}\right) \cdot 0.5
\end{array}
Initial program 73.5%
Simplified67.1%
Taylor expanded in eps around inf 98.6%
Final simplification98.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x eps))))
(if (<= x 21500.0)
(* 0.5 (+ t_0 (/ 1.0 t_0)))
(if (or (<= x 2.4e+92) (not (<= x 8.6e+150)))
0.0
(*
0.5
(+ (exp (* x (+ eps -1.0))) (/ 1.0 (+ 1.0 (* x (+ eps 1.0))))))))))
double code(double x, double eps) {
double t_0 = exp((x * eps));
double tmp;
if (x <= 21500.0) {
tmp = 0.5 * (t_0 + (1.0 / t_0));
} else if ((x <= 2.4e+92) || !(x <= 8.6e+150)) {
tmp = 0.0;
} else {
tmp = 0.5 * (exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.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 = exp((x * eps))
if (x <= 21500.0d0) then
tmp = 0.5d0 * (t_0 + (1.0d0 / t_0))
else if ((x <= 2.4d+92) .or. (.not. (x <= 8.6d+150))) then
tmp = 0.0d0
else
tmp = 0.5d0 * (exp((x * (eps + (-1.0d0)))) + (1.0d0 / (1.0d0 + (x * (eps + 1.0d0)))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * eps));
double tmp;
if (x <= 21500.0) {
tmp = 0.5 * (t_0 + (1.0 / t_0));
} else if ((x <= 2.4e+92) || !(x <= 8.6e+150)) {
tmp = 0.0;
} else {
tmp = 0.5 * (Math.exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0)))));
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * eps)) tmp = 0 if x <= 21500.0: tmp = 0.5 * (t_0 + (1.0 / t_0)) elif (x <= 2.4e+92) or not (x <= 8.6e+150): tmp = 0.0 else: tmp = 0.5 * (math.exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0))))) return tmp
function code(x, eps) t_0 = exp(Float64(x * eps)) tmp = 0.0 if (x <= 21500.0) tmp = Float64(0.5 * Float64(t_0 + Float64(1.0 / t_0))); elseif ((x <= 2.4e+92) || !(x <= 8.6e+150)) tmp = 0.0; else tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps + 1.0)))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * eps)); tmp = 0.0; if (x <= 21500.0) tmp = 0.5 * (t_0 + (1.0 / t_0)); elseif ((x <= 2.4e+92) || ~((x <= 8.6e+150))) tmp = 0.0; else tmp = 0.5 * (exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0))))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 21500.0], N[(0.5 * N[(t$95$0 + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2.4e+92], N[Not[LessEqual[x, 8.6e+150]], $MachinePrecision]], 0.0, N[(0.5 * N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \varepsilon}\\
\mathbf{if}\;x \leq 21500:\\
\;\;\;\;0.5 \cdot \left(t\_0 + \frac{1}{t\_0}\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+92} \lor \neg \left(x \leq 8.6 \cdot 10^{+150}\right):\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(\varepsilon + -1\right)} + \frac{1}{1 + x \cdot \left(\varepsilon + 1\right)}\right)\\
\end{array}
\end{array}
if x < 21500Initial program 63.9%
Simplified55.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around inf 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in eps around inf 98.6%
if 21500 < x < 2.40000000000000005e92 or 8.59999999999999994e150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
if 2.40000000000000005e92 < x < 8.59999999999999994e150Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 57.8%
Final simplification89.0%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-260)
(* 0.5 (+ 1.0 (/ 1.0 (exp (* x eps)))))
(if (or (<= x 33000000.0) (and (not (<= x 4.3e+89)) (<= x 1.85e+151)))
(* 0.5 (+ (exp (* x (+ eps -1.0))) (/ 1.0 (+ 1.0 (* x (+ eps 1.0))))))
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4e-260) {
tmp = 0.5 * (1.0 + (1.0 / exp((x * eps))));
} else if ((x <= 33000000.0) || (!(x <= 4.3e+89) && (x <= 1.85e+151))) {
tmp = 0.5 * (exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0)))));
} else {
tmp = 0.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-260)) then
tmp = 0.5d0 * (1.0d0 + (1.0d0 / exp((x * eps))))
else if ((x <= 33000000.0d0) .or. (.not. (x <= 4.3d+89)) .and. (x <= 1.85d+151)) then
tmp = 0.5d0 * (exp((x * (eps + (-1.0d0)))) + (1.0d0 / (1.0d0 + (x * (eps + 1.0d0)))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-260) {
tmp = 0.5 * (1.0 + (1.0 / Math.exp((x * eps))));
} else if ((x <= 33000000.0) || (!(x <= 4.3e+89) && (x <= 1.85e+151))) {
tmp = 0.5 * (Math.exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0)))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-260: tmp = 0.5 * (1.0 + (1.0 / math.exp((x * eps)))) elif (x <= 33000000.0) or (not (x <= 4.3e+89) and (x <= 1.85e+151)): tmp = 0.5 * (math.exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0))))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-260) tmp = Float64(0.5 * Float64(1.0 + Float64(1.0 / exp(Float64(x * eps))))); elseif ((x <= 33000000.0) || (!(x <= 4.3e+89) && (x <= 1.85e+151))) tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps + 1.0)))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-260) tmp = 0.5 * (1.0 + (1.0 / exp((x * eps)))); elseif ((x <= 33000000.0) || (~((x <= 4.3e+89)) && (x <= 1.85e+151))) tmp = 0.5 * (exp((x * (eps + -1.0))) + (1.0 / (1.0 + (x * (eps + 1.0))))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-260], N[(0.5 * N[(1.0 + N[(1.0 / N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 33000000.0], And[N[Not[LessEqual[x, 4.3e+89]], $MachinePrecision], LessEqual[x, 1.85e+151]]], N[(0.5 * N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-260}:\\
\;\;\;\;0.5 \cdot \left(1 + \frac{1}{e^{x \cdot \varepsilon}}\right)\\
\mathbf{elif}\;x \leq 33000000 \lor \neg \left(x \leq 4.3 \cdot 10^{+89}\right) \land x \leq 1.85 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(\varepsilon + -1\right)} + \frac{1}{1 + x \cdot \left(\varepsilon + 1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999985e-260Initial program 69.5%
Simplified61.3%
Taylor expanded in eps around inf 96.7%
Taylor expanded in eps around inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in eps around inf 97.4%
Taylor expanded in x around 0 74.3%
if -3.99999999999999985e-260 < x < 3.3e7 or 4.3000000000000002e89 < x < 1.8499999999999999e151Initial program 63.8%
Simplified56.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 80.4%
if 3.3e7 < x < 4.3000000000000002e89 or 1.8499999999999999e151 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
Final simplification74.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x eps))))
(if (<= x -1.55e-260)
(* 0.5 (+ 1.0 (/ 1.0 t_0)))
(if (<= x 2100000.0)
(* 0.5 (+ t_0 (- 1.0 (* x eps))))
(if (or (<= x 2.15e+89) (not (<= x 4.5e+149)))
0.0
(* 0.5 (+ 1.0 (exp (* x (+ eps -1.0))))))))))
double code(double x, double eps) {
double t_0 = exp((x * eps));
double tmp;
if (x <= -1.55e-260) {
tmp = 0.5 * (1.0 + (1.0 / t_0));
} else if (x <= 2100000.0) {
tmp = 0.5 * (t_0 + (1.0 - (x * eps)));
} else if ((x <= 2.15e+89) || !(x <= 4.5e+149)) {
tmp = 0.0;
} else {
tmp = 0.5 * (1.0 + exp((x * (eps + -1.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 = exp((x * eps))
if (x <= (-1.55d-260)) then
tmp = 0.5d0 * (1.0d0 + (1.0d0 / t_0))
else if (x <= 2100000.0d0) then
tmp = 0.5d0 * (t_0 + (1.0d0 - (x * eps)))
else if ((x <= 2.15d+89) .or. (.not. (x <= 4.5d+149))) then
tmp = 0.0d0
else
tmp = 0.5d0 * (1.0d0 + exp((x * (eps + (-1.0d0)))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * eps));
double tmp;
if (x <= -1.55e-260) {
tmp = 0.5 * (1.0 + (1.0 / t_0));
} else if (x <= 2100000.0) {
tmp = 0.5 * (t_0 + (1.0 - (x * eps)));
} else if ((x <= 2.15e+89) || !(x <= 4.5e+149)) {
tmp = 0.0;
} else {
tmp = 0.5 * (1.0 + Math.exp((x * (eps + -1.0))));
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * eps)) tmp = 0 if x <= -1.55e-260: tmp = 0.5 * (1.0 + (1.0 / t_0)) elif x <= 2100000.0: tmp = 0.5 * (t_0 + (1.0 - (x * eps))) elif (x <= 2.15e+89) or not (x <= 4.5e+149): tmp = 0.0 else: tmp = 0.5 * (1.0 + math.exp((x * (eps + -1.0)))) return tmp
function code(x, eps) t_0 = exp(Float64(x * eps)) tmp = 0.0 if (x <= -1.55e-260) tmp = Float64(0.5 * Float64(1.0 + Float64(1.0 / t_0))); elseif (x <= 2100000.0) tmp = Float64(0.5 * Float64(t_0 + Float64(1.0 - Float64(x * eps)))); elseif ((x <= 2.15e+89) || !(x <= 4.5e+149)) tmp = 0.0; else tmp = Float64(0.5 * Float64(1.0 + exp(Float64(x * Float64(eps + -1.0))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * eps)); tmp = 0.0; if (x <= -1.55e-260) tmp = 0.5 * (1.0 + (1.0 / t_0)); elseif (x <= 2100000.0) tmp = 0.5 * (t_0 + (1.0 - (x * eps))); elseif ((x <= 2.15e+89) || ~((x <= 4.5e+149))) tmp = 0.0; else tmp = 0.5 * (1.0 + exp((x * (eps + -1.0)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.55e-260], N[(0.5 * N[(1.0 + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2100000.0], N[(0.5 * N[(t$95$0 + N[(1.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2.15e+89], N[Not[LessEqual[x, 4.5e+149]], $MachinePrecision]], 0.0, N[(0.5 * N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \varepsilon}\\
\mathbf{if}\;x \leq -1.55 \cdot 10^{-260}:\\
\;\;\;\;0.5 \cdot \left(1 + \frac{1}{t\_0}\right)\\
\mathbf{elif}\;x \leq 2100000:\\
\;\;\;\;0.5 \cdot \left(t\_0 + \left(1 - x \cdot \varepsilon\right)\right)\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+89} \lor \neg \left(x \leq 4.5 \cdot 10^{+149}\right):\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{x \cdot \left(\varepsilon + -1\right)}\right)\\
\end{array}
\end{array}
if x < -1.54999999999999991e-260Initial program 69.5%
Simplified61.3%
Taylor expanded in eps around inf 96.7%
Taylor expanded in eps around inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in eps around inf 97.4%
Taylor expanded in x around 0 74.3%
if -1.54999999999999991e-260 < x < 2.1e6Initial program 56.8%
Simplified47.6%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
if 2.1e6 < x < 2.1500000000000001e89 or 4.49999999999999982e149 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
if 2.1500000000000001e89 < x < 4.49999999999999982e149Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 57.6%
Final simplification74.7%
(FPCore (x eps)
:precision binary64
(if (<= x -2e-287)
(* 0.5 (+ 1.0 (/ 1.0 (exp (* x eps)))))
(if (or (<= x 5400000.0) (and (not (<= x 1.65e+91)) (<= x 2.7e+151)))
(* 0.5 (+ 1.0 (exp (* x (+ eps -1.0)))))
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2e-287) {
tmp = 0.5 * (1.0 + (1.0 / exp((x * eps))));
} else if ((x <= 5400000.0) || (!(x <= 1.65e+91) && (x <= 2.7e+151))) {
tmp = 0.5 * (1.0 + exp((x * (eps + -1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-2d-287)) then
tmp = 0.5d0 * (1.0d0 + (1.0d0 / exp((x * eps))))
else if ((x <= 5400000.0d0) .or. (.not. (x <= 1.65d+91)) .and. (x <= 2.7d+151)) then
tmp = 0.5d0 * (1.0d0 + exp((x * (eps + (-1.0d0)))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2e-287) {
tmp = 0.5 * (1.0 + (1.0 / Math.exp((x * eps))));
} else if ((x <= 5400000.0) || (!(x <= 1.65e+91) && (x <= 2.7e+151))) {
tmp = 0.5 * (1.0 + Math.exp((x * (eps + -1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2e-287: tmp = 0.5 * (1.0 + (1.0 / math.exp((x * eps)))) elif (x <= 5400000.0) or (not (x <= 1.65e+91) and (x <= 2.7e+151)): tmp = 0.5 * (1.0 + math.exp((x * (eps + -1.0)))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2e-287) tmp = Float64(0.5 * Float64(1.0 + Float64(1.0 / exp(Float64(x * eps))))); elseif ((x <= 5400000.0) || (!(x <= 1.65e+91) && (x <= 2.7e+151))) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(x * Float64(eps + -1.0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2e-287) tmp = 0.5 * (1.0 + (1.0 / exp((x * eps)))); elseif ((x <= 5400000.0) || (~((x <= 1.65e+91)) && (x <= 2.7e+151))) tmp = 0.5 * (1.0 + exp((x * (eps + -1.0)))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2e-287], N[(0.5 * N[(1.0 + N[(1.0 / N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 5400000.0], And[N[Not[LessEqual[x, 1.65e+91]], $MachinePrecision], LessEqual[x, 2.7e+151]]], N[(0.5 * N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-287}:\\
\;\;\;\;0.5 \cdot \left(1 + \frac{1}{e^{x \cdot \varepsilon}}\right)\\
\mathbf{elif}\;x \leq 5400000 \lor \neg \left(x \leq 1.65 \cdot 10^{+91}\right) \land x \leq 2.7 \cdot 10^{+151}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{x \cdot \left(\varepsilon + -1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.00000000000000004e-287Initial program 67.4%
Simplified59.4%
Taylor expanded in eps around inf 96.9%
Taylor expanded in eps around inf 96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in eps around inf 97.6%
Taylor expanded in x around 0 75.8%
if -2.00000000000000004e-287 < x < 5.4e6 or 1.65000000000000009e91 < x < 2.7000000000000001e151Initial program 65.9%
Simplified58.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 78.2%
if 5.4e6 < x < 1.65000000000000009e91 or 2.7000000000000001e151 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
Final simplification74.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x eps))))
(if (<= x -1e-291)
(* 0.5 (+ 1.0 (/ 1.0 t_0)))
(if (or (<= x 15000.0) (and (not (<= x 1.25e+88)) (<= x 1.05e+150)))
(* 0.5 (+ 1.0 t_0))
0.0))))
double code(double x, double eps) {
double t_0 = exp((x * eps));
double tmp;
if (x <= -1e-291) {
tmp = 0.5 * (1.0 + (1.0 / t_0));
} else if ((x <= 15000.0) || (!(x <= 1.25e+88) && (x <= 1.05e+150))) {
tmp = 0.5 * (1.0 + t_0);
} else {
tmp = 0.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 = exp((x * eps))
if (x <= (-1d-291)) then
tmp = 0.5d0 * (1.0d0 + (1.0d0 / t_0))
else if ((x <= 15000.0d0) .or. (.not. (x <= 1.25d+88)) .and. (x <= 1.05d+150)) then
tmp = 0.5d0 * (1.0d0 + t_0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * eps));
double tmp;
if (x <= -1e-291) {
tmp = 0.5 * (1.0 + (1.0 / t_0));
} else if ((x <= 15000.0) || (!(x <= 1.25e+88) && (x <= 1.05e+150))) {
tmp = 0.5 * (1.0 + t_0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * eps)) tmp = 0 if x <= -1e-291: tmp = 0.5 * (1.0 + (1.0 / t_0)) elif (x <= 15000.0) or (not (x <= 1.25e+88) and (x <= 1.05e+150)): tmp = 0.5 * (1.0 + t_0) else: tmp = 0.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * eps)) tmp = 0.0 if (x <= -1e-291) tmp = Float64(0.5 * Float64(1.0 + Float64(1.0 / t_0))); elseif ((x <= 15000.0) || (!(x <= 1.25e+88) && (x <= 1.05e+150))) tmp = Float64(0.5 * Float64(1.0 + t_0)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * eps)); tmp = 0.0; if (x <= -1e-291) tmp = 0.5 * (1.0 + (1.0 / t_0)); elseif ((x <= 15000.0) || (~((x <= 1.25e+88)) && (x <= 1.05e+150))) tmp = 0.5 * (1.0 + t_0); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1e-291], N[(0.5 * N[(1.0 + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 15000.0], And[N[Not[LessEqual[x, 1.25e+88]], $MachinePrecision], LessEqual[x, 1.05e+150]]], N[(0.5 * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \varepsilon}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-291}:\\
\;\;\;\;0.5 \cdot \left(1 + \frac{1}{t\_0}\right)\\
\mathbf{elif}\;x \leq 15000 \lor \neg \left(x \leq 1.25 \cdot 10^{+88}\right) \land x \leq 1.05 \cdot 10^{+150}:\\
\;\;\;\;0.5 \cdot \left(1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.99999999999999962e-292Initial program 67.4%
Simplified59.4%
Taylor expanded in eps around inf 96.9%
Taylor expanded in eps around inf 96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in eps around inf 97.6%
Taylor expanded in x around 0 75.8%
if -9.99999999999999962e-292 < x < 15000 or 1.24999999999999999e88 < x < 1.04999999999999999e150Initial program 65.9%
Simplified58.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in eps around inf 94.6%
Taylor expanded in eps around 0 78.2%
if 15000 < x < 1.24999999999999999e88 or 1.04999999999999999e150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
Final simplification74.2%
(FPCore (x eps)
:precision binary64
(if (<= x 3.7e-233)
(* 0.5 (+ 1.0 (exp (- x))))
(if (or (<= x 29000000.0) (and (not (<= x 2.7e+90)) (<= x 1.05e+150)))
(* 0.5 (+ 1.0 (exp (* x eps))))
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 3.7e-233) {
tmp = 0.5 * (1.0 + exp(-x));
} else if ((x <= 29000000.0) || (!(x <= 2.7e+90) && (x <= 1.05e+150))) {
tmp = 0.5 * (1.0 + exp((x * eps)));
} else {
tmp = 0.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.7d-233) then
tmp = 0.5d0 * (1.0d0 + exp(-x))
else if ((x <= 29000000.0d0) .or. (.not. (x <= 2.7d+90)) .and. (x <= 1.05d+150)) then
tmp = 0.5d0 * (1.0d0 + exp((x * eps)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 3.7e-233) {
tmp = 0.5 * (1.0 + Math.exp(-x));
} else if ((x <= 29000000.0) || (!(x <= 2.7e+90) && (x <= 1.05e+150))) {
tmp = 0.5 * (1.0 + Math.exp((x * eps)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 3.7e-233: tmp = 0.5 * (1.0 + math.exp(-x)) elif (x <= 29000000.0) or (not (x <= 2.7e+90) and (x <= 1.05e+150)): tmp = 0.5 * (1.0 + math.exp((x * eps))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 3.7e-233) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(-x)))); elseif ((x <= 29000000.0) || (!(x <= 2.7e+90) && (x <= 1.05e+150))) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(x * eps)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 3.7e-233) tmp = 0.5 * (1.0 + exp(-x)); elseif ((x <= 29000000.0) || (~((x <= 2.7e+90)) && (x <= 1.05e+150))) tmp = 0.5 * (1.0 + exp((x * eps))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 3.7e-233], N[(0.5 * N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 29000000.0], And[N[Not[LessEqual[x, 2.7e+90]], $MachinePrecision], LessEqual[x, 1.05e+150]]], N[(0.5 * N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.7 \cdot 10^{-233}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{-x}\right)\\
\mathbf{elif}\;x \leq 29000000 \lor \neg \left(x \leq 2.7 \cdot 10^{+90}\right) \land x \leq 1.05 \cdot 10^{+150}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{x \cdot \varepsilon}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.6999999999999998e-233Initial program 65.9%
Simplified58.2%
Taylor expanded in eps around inf 97.2%
Taylor expanded in x around 0 72.4%
Taylor expanded in eps around 0 84.5%
neg-mul-184.5%
Simplified84.5%
if 3.6999999999999998e-233 < x < 2.9e7 or 2.7e90 < x < 1.04999999999999999e150Initial program 68.1%
Simplified59.7%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in eps around inf 93.8%
Taylor expanded in eps around 0 75.6%
if 2.9e7 < x < 2.7e90 or 1.04999999999999999e150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.0%
rec-exp64.0%
div-sub64.0%
neg-mul-164.0%
+-inverses64.0%
Simplified64.0%
Final simplification77.6%
(FPCore (x eps)
:precision binary64
(if (<= x 1e-231)
(* 0.5 (+ 1.0 (exp (- x))))
(if (<= x 740.0)
(*
0.5
(+
(/ 1.0 (+ 1.0 (* x (+ eps 1.0))))
(+ 1.0 (/ (* x (+ (* eps eps) -1.0)) (+ eps 1.0)))))
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 1e-231) {
tmp = 0.5 * (1.0 + exp(-x));
} else if (x <= 740.0) {
tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1d-231) then
tmp = 0.5d0 * (1.0d0 + exp(-x))
else if (x <= 740.0d0) then
tmp = 0.5d0 * ((1.0d0 / (1.0d0 + (x * (eps + 1.0d0)))) + (1.0d0 + ((x * ((eps * eps) + (-1.0d0))) / (eps + 1.0d0))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1e-231) {
tmp = 0.5 * (1.0 + Math.exp(-x));
} else if (x <= 740.0) {
tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1e-231: tmp = 0.5 * (1.0 + math.exp(-x)) elif x <= 740.0: tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0)))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1e-231) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(-x)))); elseif (x <= 740.0) tmp = Float64(0.5 * Float64(Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps + 1.0)))) + Float64(1.0 + Float64(Float64(x * Float64(Float64(eps * eps) + -1.0)) / Float64(eps + 1.0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1e-231) tmp = 0.5 * (1.0 + exp(-x)); elseif (x <= 740.0) tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0)))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1e-231], N[(0.5 * N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 740.0], N[(0.5 * N[(N[(1.0 / N[(1.0 + N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * N[(N[(eps * eps), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-231}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{-x}\right)\\
\mathbf{elif}\;x \leq 740:\\
\;\;\;\;0.5 \cdot \left(\frac{1}{1 + x \cdot \left(\varepsilon + 1\right)} + \left(1 + \frac{x \cdot \left(\varepsilon \cdot \varepsilon + -1\right)}{\varepsilon + 1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.9999999999999999e-232Initial program 65.9%
Simplified58.2%
Taylor expanded in eps around inf 97.2%
Taylor expanded in x around 0 72.4%
Taylor expanded in eps around 0 84.5%
neg-mul-184.5%
Simplified84.5%
if 9.9999999999999999e-232 < x < 740Initial program 60.0%
Simplified49.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 80.6%
Taylor expanded in x around 0 70.1%
sub-neg70.1%
metadata-eval70.1%
distribute-rgt-in70.1%
neg-mul-170.1%
*-commutative70.1%
sub-neg70.1%
Simplified70.1%
*-commutative70.1%
*-un-lft-identity70.1%
distribute-rgt-out--70.1%
*-commutative70.1%
flip--74.6%
+-commutative74.6%
associate-*l/74.6%
metadata-eval74.6%
sub-neg74.6%
metadata-eval74.6%
+-commutative74.6%
Applied egg-rr74.6%
if 740 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.6%
rec-exp56.6%
div-sub56.6%
neg-mul-156.6%
+-inverses56.6%
Simplified56.6%
Final simplification74.6%
(FPCore (x eps)
:precision binary64
(if (<= x -3e+77)
(* (/ (* x x) eps) 0.25)
(if (<= x 5e-231)
1.0
(if (<= x 740.0)
(*
0.5
(+
(/ 1.0 (+ 1.0 (* x (+ eps 1.0))))
(+ 1.0 (/ (* x (+ (* eps eps) -1.0)) (+ eps 1.0)))))
0.0))))
double code(double x, double eps) {
double tmp;
if (x <= -3e+77) {
tmp = ((x * x) / eps) * 0.25;
} else if (x <= 5e-231) {
tmp = 1.0;
} else if (x <= 740.0) {
tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3d+77)) then
tmp = ((x * x) / eps) * 0.25d0
else if (x <= 5d-231) then
tmp = 1.0d0
else if (x <= 740.0d0) then
tmp = 0.5d0 * ((1.0d0 / (1.0d0 + (x * (eps + 1.0d0)))) + (1.0d0 + ((x * ((eps * eps) + (-1.0d0))) / (eps + 1.0d0))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -3e+77) {
tmp = ((x * x) / eps) * 0.25;
} else if (x <= 5e-231) {
tmp = 1.0;
} else if (x <= 740.0) {
tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -3e+77: tmp = ((x * x) / eps) * 0.25 elif x <= 5e-231: tmp = 1.0 elif x <= 740.0: tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0)))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -3e+77) tmp = Float64(Float64(Float64(x * x) / eps) * 0.25); elseif (x <= 5e-231) tmp = 1.0; elseif (x <= 740.0) tmp = Float64(0.5 * Float64(Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps + 1.0)))) + Float64(1.0 + Float64(Float64(x * Float64(Float64(eps * eps) + -1.0)) / Float64(eps + 1.0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3e+77) tmp = ((x * x) / eps) * 0.25; elseif (x <= 5e-231) tmp = 1.0; elseif (x <= 740.0) tmp = 0.5 * ((1.0 / (1.0 + (x * (eps + 1.0)))) + (1.0 + ((x * ((eps * eps) + -1.0)) / (eps + 1.0)))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -3e+77], N[(N[(N[(x * x), $MachinePrecision] / eps), $MachinePrecision] * 0.25), $MachinePrecision], If[LessEqual[x, 5e-231], 1.0, If[LessEqual[x, 740.0], N[(0.5 * N[(N[(1.0 / N[(1.0 + N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x * N[(N[(eps * eps), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+77}:\\
\;\;\;\;\frac{x \cdot x}{\varepsilon} \cdot 0.25\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-231}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 740:\\
\;\;\;\;0.5 \cdot \left(\frac{1}{1 + x \cdot \left(\varepsilon + 1\right)} + \left(1 + \frac{x \cdot \left(\varepsilon \cdot \varepsilon + -1\right)}{\varepsilon + 1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.9999999999999998e77Initial program 100.0%
Taylor expanded in x around 0 65.9%
Taylor expanded in eps around 0 60.7%
neg-mul-160.7%
associate--r+60.7%
sub-neg60.7%
expm1-define60.7%
remove-double-neg60.7%
Simplified60.7%
Taylor expanded in x around 0 53.9%
*-commutative53.9%
unpow253.9%
Simplified53.9%
if -2.9999999999999998e77 < x < 5.00000000000000023e-231Initial program 56.0%
Taylor expanded in x around 0 70.7%
if 5.00000000000000023e-231 < x < 740Initial program 60.0%
Simplified49.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 80.6%
Taylor expanded in x around 0 70.1%
sub-neg70.1%
metadata-eval70.1%
distribute-rgt-in70.1%
neg-mul-170.1%
*-commutative70.1%
sub-neg70.1%
Simplified70.1%
*-commutative70.1%
*-un-lft-identity70.1%
distribute-rgt-out--70.1%
*-commutative70.1%
flip--74.6%
+-commutative74.6%
associate-*l/74.6%
metadata-eval74.6%
sub-neg74.6%
metadata-eval74.6%
+-commutative74.6%
Applied egg-rr74.6%
if 740 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.6%
rec-exp56.6%
div-sub56.6%
neg-mul-156.6%
+-inverses56.6%
Simplified56.6%
Final simplification66.1%
(FPCore (x eps) :precision binary64 (if (<= x -2.1e+77) (* (/ (* x x) eps) 0.25) (if (<= x 600.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2.1e+77) {
tmp = ((x * x) / eps) * 0.25;
} else if (x <= 600.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-2.1d+77)) then
tmp = ((x * x) / eps) * 0.25d0
else if (x <= 600.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2.1e+77) {
tmp = ((x * x) / eps) * 0.25;
} else if (x <= 600.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.1e+77: tmp = ((x * x) / eps) * 0.25 elif x <= 600.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.1e+77) tmp = Float64(Float64(Float64(x * x) / eps) * 0.25); elseif (x <= 600.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.1e+77) tmp = ((x * x) / eps) * 0.25; elseif (x <= 600.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.1e+77], N[(N[(N[(x * x), $MachinePrecision] / eps), $MachinePrecision] * 0.25), $MachinePrecision], If[LessEqual[x, 600.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+77}:\\
\;\;\;\;\frac{x \cdot x}{\varepsilon} \cdot 0.25\\
\mathbf{elif}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.0999999999999999e77Initial program 100.0%
Taylor expanded in x around 0 65.9%
Taylor expanded in eps around 0 60.7%
neg-mul-160.7%
associate--r+60.7%
sub-neg60.7%
expm1-define60.7%
remove-double-neg60.7%
Simplified60.7%
Taylor expanded in x around 0 53.9%
*-commutative53.9%
unpow253.9%
Simplified53.9%
if -2.0999999999999999e77 < x < 600Initial program 57.6%
Taylor expanded in x around 0 70.5%
if 600 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.6%
rec-exp56.6%
div-sub56.6%
neg-mul-156.6%
+-inverses56.6%
Simplified56.6%
Final simplification65.0%
(FPCore (x eps) :precision binary64 (if (<= x -1.0) (/ (* x eps) (- 2.0)) (if (<= x 520.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps) / -2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps) / -2.0d0
else if (x <= 520.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps) / -2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.0: tmp = (x * eps) / -2.0 elif x <= 520.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps) / Float64(-2.0)); elseif (x <= 520.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.0) tmp = (x * eps) / -2.0; elseif (x <= 520.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.0], N[(N[(x * eps), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 520.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot \varepsilon}{-2}\\
\mathbf{elif}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 97.5%
Taylor expanded in x around 0 51.1%
Taylor expanded in eps around inf 30.7%
mul-1-neg30.7%
*-commutative30.7%
distribute-rgt-neg-in30.7%
Simplified30.7%
if -1 < x < 520Initial program 55.1%
Taylor expanded in x around 0 75.5%
if 520 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.6%
rec-exp56.6%
div-sub56.6%
neg-mul-156.6%
+-inverses56.6%
Simplified56.6%
Final simplification63.6%
(FPCore (x eps) :precision binary64 (if (<= x 510.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 510.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 510.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 510.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 510.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 510.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 510.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 510.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 510:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 510Initial program 63.9%
Taylor expanded in x around 0 60.4%
if 510 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.6%
rec-exp56.6%
div-sub56.6%
neg-mul-156.6%
+-inverses56.6%
Simplified56.6%
Final simplification59.4%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 73.5%
Simplified67.1%
Taylor expanded in eps around 0 16.7%
rec-exp16.6%
div-sub16.6%
neg-mul-116.6%
+-inverses16.9%
Simplified16.9%
Final simplification16.9%
herbie shell --seed 2024097
(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))