
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 72.0%
sub-neg72.0%
neg-sub072.0%
associate-+r-72.0%
Simplified72.0%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x eps)) (exp (* x (- eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * eps)) + exp((x * -eps))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * eps)) + exp((x * -eps))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * eps)) + Math.exp((x * -eps))) / 2.0;
}
def code(x, eps): return (math.exp((x * eps)) + math.exp((x * -eps))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * eps)) + exp(Float64(x * Float64(-eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \varepsilon} + e^{x \cdot \left(-\varepsilon\right)}}{2}
\end{array}
Initial program 72.0%
sub-neg72.0%
neg-sub072.0%
associate-+r-72.0%
Simplified72.0%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in eps around inf 87.4%
mul-1-neg87.4%
distribute-rgt-neg-in87.4%
Simplified87.4%
Final simplification87.4%
(FPCore (x eps)
:precision binary64
(if (<= x -9.5e-210)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 4.4e+21)
(/ (- (exp (* x eps)) -1.0) 2.0)
(if (<= x 2.5e+31)
0.0
(if (<= x 1.2e+133) (/ (- (exp (* x (+ eps -1.0))) -1.0) 2.0) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -9.5e-210) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 4.4e+21) {
tmp = (exp((x * eps)) - -1.0) / 2.0;
} else if (x <= 2.5e+31) {
tmp = 0.0;
} else if (x <= 1.2e+133) {
tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.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 <= (-9.5d-210)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 4.4d+21) then
tmp = (exp((x * eps)) - (-1.0d0)) / 2.0d0
else if (x <= 2.5d+31) then
tmp = 0.0d0
else if (x <= 1.2d+133) then
tmp = (exp((x * (eps + (-1.0d0)))) - (-1.0d0)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -9.5e-210) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 4.4e+21) {
tmp = (Math.exp((x * eps)) - -1.0) / 2.0;
} else if (x <= 2.5e+31) {
tmp = 0.0;
} else if (x <= 1.2e+133) {
tmp = (Math.exp((x * (eps + -1.0))) - -1.0) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9.5e-210: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 4.4e+21: tmp = (math.exp((x * eps)) - -1.0) / 2.0 elif x <= 2.5e+31: tmp = 0.0 elif x <= 1.2e+133: tmp = (math.exp((x * (eps + -1.0))) - -1.0) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9.5e-210) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 4.4e+21) tmp = Float64(Float64(exp(Float64(x * eps)) - -1.0) / 2.0); elseif (x <= 2.5e+31) tmp = 0.0; elseif (x <= 1.2e+133) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) - -1.0) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9.5e-210) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 4.4e+21) tmp = (exp((x * eps)) - -1.0) / 2.0; elseif (x <= 2.5e+31) tmp = 0.0; elseif (x <= 1.2e+133) tmp = (exp((x * (eps + -1.0))) - -1.0) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9.5e-210], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.4e+21], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.5e+31], 0.0, If[LessEqual[x, 1.2e+133], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-210}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+21}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} - -1}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+31}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} - -1}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.4999999999999997e-210Initial program 69.7%
sub-neg69.7%
neg-sub069.7%
associate-+r-69.7%
Simplified69.7%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 73.7%
if -9.4999999999999997e-210 < x < 4.4e21Initial program 57.3%
sub-neg57.3%
neg-sub057.3%
associate-+r-57.3%
Simplified57.3%
Taylor expanded in eps around inf 99.8%
associate-*r*99.8%
sub-neg99.8%
mul-1-neg99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
mul-1-neg99.8%
sub-neg99.8%
mul-1-neg99.8%
neg-mul-199.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in eps around inf 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in x around 0 90.9%
if 4.4e21 < x < 2.50000000000000013e31 or 1.1999999999999999e133 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.7%
rec-exp64.7%
div-sub64.7%
+-inverses64.7%
Simplified64.7%
if 2.50000000000000013e31 < x < 1.1999999999999999e133Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
associate-*r*100.0%
neg-mul-1100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
neg-mul-1100.0%
distribute-lft-neg-in100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 45.8%
Final simplification76.9%
(FPCore (x eps)
:precision binary64
(if (<= x -1.35e+154)
(/ (* (* x x) 0.25) eps)
(if (<= x -2.15e-10)
(/ (* x (/ (+ -1.0 (/ 1.0 eps)) (/ (- 1.0 eps) (- 1.0 (* eps eps))))) 2.0)
(if (<= x 550.0)
1.0
(if (<= x 5e+27)
0.0
(if (<= x 5.8e+132) (/ (/ (expm1 x) eps) 2.0) 0.0))))))
double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -2.15e-10) {
tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 5.8e+132) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -2.15e-10) {
tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 5.8e+132) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.35e+154: tmp = ((x * x) * 0.25) / eps elif x <= -2.15e-10: tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0 elif x <= 550.0: tmp = 1.0 elif x <= 5e+27: tmp = 0.0 elif x <= 5.8e+132: tmp = (math.expm1(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(Float64(Float64(x * x) * 0.25) / eps); elseif (x <= -2.15e-10) tmp = Float64(Float64(x * Float64(Float64(-1.0 + Float64(1.0 / eps)) / Float64(Float64(1.0 - eps) / Float64(1.0 - Float64(eps * eps))))) / 2.0); elseif (x <= 550.0) tmp = 1.0; elseif (x <= 5e+27) tmp = 0.0; elseif (x <= 5.8e+132) tmp = Float64(Float64(expm1(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.35e+154], N[(N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision] / eps), $MachinePrecision], If[LessEqual[x, -2.15e-10], N[(N[(x * N[(N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - eps), $MachinePrecision] / N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 550.0], 1.0, If[LessEqual[x, 5e+27], 0.0, If[LessEqual[x, 5.8e+132], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.25}{\varepsilon}\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-10}:\\
\;\;\;\;\frac{x \cdot \frac{-1 + \frac{1}{\varepsilon}}{\frac{1 - \varepsilon}{1 - \varepsilon \cdot \varepsilon}}}{2}\\
\mathbf{elif}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+27}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+132}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 35.1%
neg-mul-135.1%
distribute-lft-neg-in35.1%
+-commutative35.1%
Simplified35.1%
Taylor expanded in eps around 0 50.0%
associate--r+50.0%
cancel-sign-sub-inv50.0%
expm1-def50.0%
mul-1-neg50.0%
metadata-eval50.0%
*-lft-identity50.0%
Simplified50.0%
Taylor expanded in x around 0 50.0%
*-commutative50.0%
associate-*l/50.0%
unpow250.0%
Simplified50.0%
if -1.35000000000000003e154 < x < -2.15000000000000007e-10Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 49.8%
neg-mul-149.8%
distribute-lft-neg-in49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around inf 11.8%
*-commutative11.8%
flip-+25.0%
associate-*r/25.0%
sub-neg25.0%
metadata-eval25.0%
metadata-eval25.0%
Applied egg-rr25.0%
associate-/l*25.0%
+-commutative25.0%
Simplified25.0%
if -2.15000000000000007e-10 < x < 550Initial program 51.9%
sub-neg51.9%
neg-sub051.9%
associate-+r-51.9%
Simplified51.9%
Taylor expanded in x around 0 78.4%
if 550 < x < 4.99999999999999979e27 or 5.7999999999999997e132 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.4%
rec-exp63.4%
div-sub63.4%
+-inverses63.4%
Simplified63.4%
if 4.99999999999999979e27 < x < 5.7999999999999997e132Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around inf 80.4%
associate-*r*80.4%
mul-1-neg80.4%
Simplified80.4%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
mul-1-neg1.8%
Simplified1.8%
expm1-log1p-u1.6%
expm1-udef1.5%
add-sqr-sqrt0.0%
sqrt-unprod44.1%
sqr-neg44.1%
sqrt-unprod44.1%
add-sqr-sqrt44.1%
Applied egg-rr44.1%
expm1-def44.1%
expm1-log1p44.4%
Simplified44.4%
Final simplification66.2%
(FPCore (x eps)
:precision binary64
(if (<= x 1.6e-294)
(/ (+ 2.0 (pow (* x eps) 2.0)) 2.0)
(if (or (<= x 3.8e+21) (and (not (<= x 5.8e+27)) (<= x 2.25e+132)))
(/ (- (exp (* x eps)) -1.0) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 1.6e-294) {
tmp = (2.0 + pow((x * eps), 2.0)) / 2.0;
} else if ((x <= 3.8e+21) || (!(x <= 5.8e+27) && (x <= 2.25e+132))) {
tmp = (exp((x * eps)) - -1.0) / 2.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.6d-294) then
tmp = (2.0d0 + ((x * eps) ** 2.0d0)) / 2.0d0
else if ((x <= 3.8d+21) .or. (.not. (x <= 5.8d+27)) .and. (x <= 2.25d+132)) then
tmp = (exp((x * eps)) - (-1.0d0)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.6e-294) {
tmp = (2.0 + Math.pow((x * eps), 2.0)) / 2.0;
} else if ((x <= 3.8e+21) || (!(x <= 5.8e+27) && (x <= 2.25e+132))) {
tmp = (Math.exp((x * eps)) - -1.0) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.6e-294: tmp = (2.0 + math.pow((x * eps), 2.0)) / 2.0 elif (x <= 3.8e+21) or (not (x <= 5.8e+27) and (x <= 2.25e+132)): tmp = (math.exp((x * eps)) - -1.0) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.6e-294) tmp = Float64(Float64(2.0 + (Float64(x * eps) ^ 2.0)) / 2.0); elseif ((x <= 3.8e+21) || (!(x <= 5.8e+27) && (x <= 2.25e+132))) tmp = Float64(Float64(exp(Float64(x * eps)) - -1.0) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.6e-294) tmp = (2.0 + ((x * eps) ^ 2.0)) / 2.0; elseif ((x <= 3.8e+21) || (~((x <= 5.8e+27)) && (x <= 2.25e+132))) tmp = (exp((x * eps)) - -1.0) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.6e-294], N[(N[(2.0 + N[Power[N[(x * eps), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.8e+21], And[N[Not[LessEqual[x, 5.8e+27]], $MachinePrecision], LessEqual[x, 2.25e+132]]], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6 \cdot 10^{-294}:\\
\;\;\;\;\frac{2 + {\left(x \cdot \varepsilon\right)}^{2}}{2}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+21} \lor \neg \left(x \leq 5.8 \cdot 10^{+27}\right) \land x \leq 2.25 \cdot 10^{+132}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} - -1}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.6000000000000001e-294Initial program 65.4%
sub-neg65.4%
neg-sub065.4%
associate-+r-65.4%
Simplified65.4%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 87.8%
associate-+r+87.8%
*-commutative87.8%
distribute-rgt1-in87.8%
metadata-eval87.8%
mul0-lft87.8%
mul0-lft87.8%
metadata-eval87.8%
unpow287.8%
unpow287.8%
swap-sqr89.0%
unpow289.0%
Simplified89.0%
if 1.6000000000000001e-294 < x < 3.8e21 or 5.8000000000000002e27 < x < 2.24999999999999986e132Initial program 68.6%
sub-neg68.6%
neg-sub068.6%
associate-+r-68.6%
Simplified68.6%
Taylor expanded in eps around inf 99.8%
associate-*r*99.8%
sub-neg99.8%
mul-1-neg99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
mul-1-neg99.8%
sub-neg99.8%
mul-1-neg99.8%
neg-mul-199.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in eps around inf 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in x around 0 77.7%
if 3.8e21 < x < 5.8000000000000002e27 or 2.24999999999999986e132 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.7%
rec-exp64.7%
div-sub64.7%
+-inverses64.7%
Simplified64.7%
Final simplification80.7%
(FPCore (x eps)
:precision binary64
(if (<= x -2e-209)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (or (<= x 4.4e+21) (and (not (<= x 5e+27)) (<= x 7.2e+133)))
(/ (- (exp (* x eps)) -1.0) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2e-209) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if ((x <= 4.4e+21) || (!(x <= 5e+27) && (x <= 7.2e+133))) {
tmp = (exp((x * eps)) - -1.0) / 2.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-209)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if ((x <= 4.4d+21) .or. (.not. (x <= 5d+27)) .and. (x <= 7.2d+133)) then
tmp = (exp((x * eps)) - (-1.0d0)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2e-209) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if ((x <= 4.4e+21) || (!(x <= 5e+27) && (x <= 7.2e+133))) {
tmp = (Math.exp((x * eps)) - -1.0) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2e-209: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif (x <= 4.4e+21) or (not (x <= 5e+27) and (x <= 7.2e+133)): tmp = (math.exp((x * eps)) - -1.0) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2e-209) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif ((x <= 4.4e+21) || (!(x <= 5e+27) && (x <= 7.2e+133))) tmp = Float64(Float64(exp(Float64(x * eps)) - -1.0) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2e-209) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif ((x <= 4.4e+21) || (~((x <= 5e+27)) && (x <= 7.2e+133))) tmp = (exp((x * eps)) - -1.0) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2e-209], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.4e+21], And[N[Not[LessEqual[x, 5e+27]], $MachinePrecision], LessEqual[x, 7.2e+133]]], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-209}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+21} \lor \neg \left(x \leq 5 \cdot 10^{+27}\right) \land x \leq 7.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} - -1}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.0000000000000001e-209Initial program 69.7%
sub-neg69.7%
neg-sub069.7%
associate-+r-69.7%
Simplified69.7%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 73.7%
if -2.0000000000000001e-209 < x < 4.4e21 or 4.99999999999999979e27 < x < 7.19999999999999956e133Initial program 65.3%
sub-neg65.3%
neg-sub065.3%
associate-+r-65.3%
Simplified65.3%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in x around 0 82.4%
if 4.4e21 < x < 4.99999999999999979e27 or 7.19999999999999956e133 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.7%
rec-exp64.7%
div-sub64.7%
+-inverses64.7%
Simplified64.7%
Final simplification76.9%
(FPCore (x eps)
:precision binary64
(if (<= x -460.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 480.0)
1.0
(if (<= x 5e+27) 0.0 (if (<= x 2e+133) (/ (/ (expm1 x) eps) 2.0) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -460.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 2e+133) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -460.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 2e+133) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -460.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 480.0: tmp = 1.0 elif x <= 5e+27: tmp = 0.0 elif x <= 2e+133: tmp = (math.expm1(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -460.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 480.0) tmp = 1.0; elseif (x <= 5e+27) tmp = 0.0; elseif (x <= 2e+133) tmp = Float64(Float64(expm1(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, -460.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 480.0], 1.0, If[LessEqual[x, 5e+27], 0.0, If[LessEqual[x, 2e+133], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -460:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+27}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -460Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.2%
expm1-def47.2%
mul-1-neg47.2%
Simplified47.2%
if -460 < x < 480Initial program 52.8%
sub-neg52.8%
neg-sub052.8%
associate-+r-52.8%
Simplified52.8%
Taylor expanded in x around 0 76.9%
if 480 < x < 4.99999999999999979e27 or 2e133 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.4%
rec-exp63.4%
div-sub63.4%
+-inverses63.4%
Simplified63.4%
if 4.99999999999999979e27 < x < 2e133Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around inf 80.4%
associate-*r*80.4%
mul-1-neg80.4%
Simplified80.4%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
mul-1-neg1.8%
Simplified1.8%
expm1-log1p-u1.6%
expm1-udef1.5%
add-sqr-sqrt0.0%
sqrt-unprod44.1%
sqr-neg44.1%
sqrt-unprod44.1%
add-sqr-sqrt44.1%
Applied egg-rr44.1%
expm1-def44.1%
expm1-log1p44.4%
Simplified44.4%
Final simplification67.3%
(FPCore (x eps) :precision binary64 (if (<= x 720.0) (/ (+ 2.0 (pow (* x eps) 2.0)) 2.0) (if (<= x 5e+27) 0.0 (if (<= x 1e+131) (/ (/ (expm1 x) eps) 2.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 720.0) {
tmp = (2.0 + pow((x * eps), 2.0)) / 2.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 1e+131) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= 720.0) {
tmp = (2.0 + Math.pow((x * eps), 2.0)) / 2.0;
} else if (x <= 5e+27) {
tmp = 0.0;
} else if (x <= 1e+131) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 720.0: tmp = (2.0 + math.pow((x * eps), 2.0)) / 2.0 elif x <= 5e+27: tmp = 0.0 elif x <= 1e+131: tmp = (math.expm1(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 720.0) tmp = Float64(Float64(2.0 + (Float64(x * eps) ^ 2.0)) / 2.0); elseif (x <= 5e+27) tmp = 0.0; elseif (x <= 1e+131) tmp = Float64(Float64(expm1(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, 720.0], N[(N[(2.0 + N[Power[N[(x * eps), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+27], 0.0, If[LessEqual[x, 1e+131], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 720:\\
\;\;\;\;\frac{2 + {\left(x \cdot \varepsilon\right)}^{2}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+27}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 10^{+131}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 720Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
neg-mul-199.9%
mul-1-neg99.9%
sub-neg99.9%
mul-1-neg99.9%
neg-mul-199.9%
distribute-lft-neg-in99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 86.5%
associate-+r+86.5%
*-commutative86.5%
distribute-rgt1-in86.5%
metadata-eval86.5%
mul0-lft86.5%
mul0-lft86.5%
metadata-eval86.5%
unpow286.5%
unpow286.5%
swap-sqr85.4%
unpow285.4%
Simplified85.4%
if 720 < x < 4.99999999999999979e27 or 9.9999999999999991e130 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.4%
rec-exp63.4%
div-sub63.4%
+-inverses63.4%
Simplified63.4%
if 4.99999999999999979e27 < x < 9.9999999999999991e130Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around inf 80.4%
associate-*r*80.4%
mul-1-neg80.4%
Simplified80.4%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
mul-1-neg1.8%
Simplified1.8%
expm1-log1p-u1.6%
expm1-udef1.5%
add-sqr-sqrt0.0%
sqrt-unprod44.1%
sqr-neg44.1%
sqrt-unprod44.1%
add-sqr-sqrt44.1%
Applied egg-rr44.1%
expm1-def44.1%
expm1-log1p44.4%
Simplified44.4%
Final simplification77.7%
(FPCore (x eps)
:precision binary64
(if (<= x -1.35e+154)
(/ (* (* x x) 0.25) eps)
(if (<= x -1.1e-12)
(/ (* x (/ (+ -1.0 (/ 1.0 eps)) (/ (- 1.0 eps) (- 1.0 (* eps eps))))) 2.0)
(if (<= x 600.0) 1.0 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -1.1e-12) {
tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0;
} 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 <= (-1.35d+154)) then
tmp = ((x * x) * 0.25d0) / eps
else if (x <= (-1.1d-12)) then
tmp = (x * (((-1.0d0) + (1.0d0 / eps)) / ((1.0d0 - eps) / (1.0d0 - (eps * eps))))) / 2.0d0
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 <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -1.1e-12) {
tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0;
} else if (x <= 600.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.35e+154: tmp = ((x * x) * 0.25) / eps elif x <= -1.1e-12: tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0 elif x <= 600.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(Float64(Float64(x * x) * 0.25) / eps); elseif (x <= -1.1e-12) tmp = Float64(Float64(x * Float64(Float64(-1.0 + Float64(1.0 / eps)) / Float64(Float64(1.0 - eps) / Float64(1.0 - Float64(eps * eps))))) / 2.0); 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 <= -1.35e+154) tmp = ((x * x) * 0.25) / eps; elseif (x <= -1.1e-12) tmp = (x * ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps * eps))))) / 2.0; elseif (x <= 600.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.35e+154], N[(N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision] / eps), $MachinePrecision], If[LessEqual[x, -1.1e-12], N[(N[(x * N[(N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - eps), $MachinePrecision] / N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 600.0], 1.0, 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.25}{\varepsilon}\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-12}:\\
\;\;\;\;\frac{x \cdot \frac{-1 + \frac{1}{\varepsilon}}{\frac{1 - \varepsilon}{1 - \varepsilon \cdot \varepsilon}}}{2}\\
\mathbf{elif}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 35.1%
neg-mul-135.1%
distribute-lft-neg-in35.1%
+-commutative35.1%
Simplified35.1%
Taylor expanded in eps around 0 50.0%
associate--r+50.0%
cancel-sign-sub-inv50.0%
expm1-def50.0%
mul-1-neg50.0%
metadata-eval50.0%
*-lft-identity50.0%
Simplified50.0%
Taylor expanded in x around 0 50.0%
*-commutative50.0%
associate-*l/50.0%
unpow250.0%
Simplified50.0%
if -1.35000000000000003e154 < x < -1.09999999999999996e-12Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 49.8%
neg-mul-149.8%
distribute-lft-neg-in49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around inf 11.8%
*-commutative11.8%
flip-+25.0%
associate-*r/25.0%
sub-neg25.0%
metadata-eval25.0%
metadata-eval25.0%
Applied egg-rr25.0%
associate-/l*25.0%
+-commutative25.0%
Simplified25.0%
if -1.09999999999999996e-12 < x < 600Initial program 51.9%
sub-neg51.9%
neg-sub051.9%
associate-+r-51.9%
Simplified51.9%
Taylor expanded in x around 0 78.4%
if 600 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.3%
rec-exp49.3%
div-sub49.3%
+-inverses49.3%
Simplified49.3%
Final simplification64.3%
(FPCore (x eps) :precision binary64 (if (<= x -1.35e+154) (/ (* (* x x) 0.25) eps) (if (<= x 3.3e-10) (/ (+ 1.0 (- 1.0 (* x (- eps -1.0)))) 2.0) 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= 3.3e-10) {
tmp = (1.0 + (1.0 - (x * (eps - -1.0)))) / 2.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.35d+154)) then
tmp = ((x * x) * 0.25d0) / eps
else if (x <= 3.3d-10) then
tmp = (1.0d0 + (1.0d0 - (x * (eps - (-1.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= 3.3e-10) {
tmp = (1.0 + (1.0 - (x * (eps - -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.35e+154: tmp = ((x * x) * 0.25) / eps elif x <= 3.3e-10: tmp = (1.0 + (1.0 - (x * (eps - -1.0)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.35e+154) tmp = Float64(Float64(Float64(x * x) * 0.25) / eps); elseif (x <= 3.3e-10) tmp = Float64(Float64(1.0 + Float64(1.0 - Float64(x * Float64(eps - -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.35e+154) tmp = ((x * x) * 0.25) / eps; elseif (x <= 3.3e-10) tmp = (1.0 + (1.0 - (x * (eps - -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.35e+154], N[(N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision] / eps), $MachinePrecision], If[LessEqual[x, 3.3e-10], N[(N[(1.0 + N[(1.0 - N[(x * N[(eps - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.25}{\varepsilon}\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-10}:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot \left(\varepsilon - -1\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 35.1%
neg-mul-135.1%
distribute-lft-neg-in35.1%
+-commutative35.1%
Simplified35.1%
Taylor expanded in eps around 0 50.0%
associate--r+50.0%
cancel-sign-sub-inv50.0%
expm1-def50.0%
mul-1-neg50.0%
metadata-eval50.0%
*-lft-identity50.0%
Simplified50.0%
Taylor expanded in x around 0 50.0%
*-commutative50.0%
associate-*l/50.0%
unpow250.0%
Simplified50.0%
if -1.35000000000000003e154 < x < 3.3e-10Initial program 57.0%
sub-neg57.0%
neg-sub057.0%
associate-+r-57.0%
Simplified57.0%
Taylor expanded in eps around inf 99.8%
associate-*r*99.8%
sub-neg99.8%
mul-1-neg99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
mul-1-neg99.8%
sub-neg99.8%
mul-1-neg99.8%
neg-mul-199.8%
distribute-lft-neg-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 85.6%
Taylor expanded in x around 0 70.9%
if 3.3e-10 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.3%
rec-exp47.3%
div-sub47.3%
+-inverses47.3%
Simplified47.3%
Final simplification62.9%
(FPCore (x eps) :precision binary64 (if (<= x -1.35e+154) (/ (* (* x x) 0.25) eps) (if (<= x -2.15e-10) (/ (* x (- eps)) 2.0) (if (<= x 520.0) 1.0 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= -1.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -2.15e-10) {
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.35d+154)) then
tmp = ((x * x) * 0.25d0) / eps
else if (x <= (-2.15d-10)) 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.35e+154) {
tmp = ((x * x) * 0.25) / eps;
} else if (x <= -2.15e-10) {
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.35e+154: tmp = ((x * x) * 0.25) / eps elif x <= -2.15e-10: 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.35e+154) tmp = Float64(Float64(Float64(x * x) * 0.25) / eps); elseif (x <= -2.15e-10) tmp = Float64(Float64(x * Float64(-eps)) / 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.35e+154) tmp = ((x * x) * 0.25) / eps; elseif (x <= -2.15e-10) 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.35e+154], N[(N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision] / eps), $MachinePrecision], If[LessEqual[x, -2.15e-10], 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.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(x \cdot x\right) \cdot 0.25}{\varepsilon}\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-10}:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.35000000000000003e154Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 35.1%
neg-mul-135.1%
distribute-lft-neg-in35.1%
+-commutative35.1%
Simplified35.1%
Taylor expanded in eps around 0 50.0%
associate--r+50.0%
cancel-sign-sub-inv50.0%
expm1-def50.0%
mul-1-neg50.0%
metadata-eval50.0%
*-lft-identity50.0%
Simplified50.0%
Taylor expanded in x around 0 50.0%
*-commutative50.0%
associate-*l/50.0%
unpow250.0%
Simplified50.0%
if -1.35000000000000003e154 < x < -2.15000000000000007e-10Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 49.8%
neg-mul-149.8%
distribute-lft-neg-in49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in x around inf 11.8%
Taylor expanded in eps around inf 11.8%
associate-*r*11.8%
neg-mul-111.8%
Simplified11.8%
if -2.15000000000000007e-10 < x < 520Initial program 51.9%
sub-neg51.9%
neg-sub051.9%
associate-+r-51.9%
Simplified51.9%
Taylor expanded in x around 0 78.4%
if 520 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.3%
rec-exp49.3%
div-sub49.3%
+-inverses49.3%
Simplified49.3%
Final simplification63.2%
(FPCore (x eps) :precision binary64 (if (<= x -2.15e-10) (/ (* x (- eps)) 2.0) (if (<= x 540.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2.15e-10) {
tmp = (x * -eps) / 2.0;
} else if (x <= 540.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.15d-10)) then
tmp = (x * -eps) / 2.0d0
else if (x <= 540.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.15e-10) {
tmp = (x * -eps) / 2.0;
} else if (x <= 540.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.15e-10: tmp = (x * -eps) / 2.0 elif x <= 540.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.15e-10) tmp = Float64(Float64(x * Float64(-eps)) / 2.0); elseif (x <= 540.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.15e-10) tmp = (x * -eps) / 2.0; elseif (x <= 540.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.15e-10], N[(N[(x * (-eps)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 540.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{-10}:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 540:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.15000000000000007e-10Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 43.0%
neg-mul-143.0%
distribute-lft-neg-in43.0%
+-commutative43.0%
Simplified43.0%
Taylor expanded in x around inf 20.0%
Taylor expanded in eps around inf 20.0%
associate-*r*20.0%
neg-mul-120.0%
Simplified20.0%
if -2.15000000000000007e-10 < x < 540Initial program 51.9%
sub-neg51.9%
neg-sub051.9%
associate-+r-51.9%
Simplified51.9%
Taylor expanded in x around 0 78.4%
if 540 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.3%
rec-exp49.3%
div-sub49.3%
+-inverses49.3%
Simplified49.3%
Final simplification61.8%
(FPCore (x eps) :precision binary64 (if (<= x 600.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
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 <= 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 <= 600.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 600.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (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 <= 600.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 600.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 600Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in x around 0 62.8%
if 600 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.3%
rec-exp49.3%
div-sub49.3%
+-inverses49.3%
Simplified49.3%
Final simplification59.2%
(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 72.0%
Simplified72.0%
Taylor expanded in eps around 0 14.7%
rec-exp14.7%
div-sub14.7%
+-inverses15.0%
Simplified15.0%
Final simplification15.0%
herbie shell --seed 2023283
(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))