
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (- x (/ y (fma x y (* (exp z) -1.1283791670955126))))))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x - (y / fma(x, y, (exp(z) * -1.1283791670955126)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); else tmp = Float64(x - Float64(y / fma(x, y, Float64(exp(z) * -1.1283791670955126)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(x * y + N[(N[Exp[z], $MachinePrecision] * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 80.2%
remove-double-neg80.2%
distribute-frac-neg80.2%
unsub-neg80.2%
distribute-frac-neg80.2%
distribute-neg-frac280.2%
neg-sub080.1%
associate--r-80.1%
neg-sub080.9%
+-commutative80.9%
fma-define80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
metadata-eval80.9%
Simplified80.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.3%
remove-double-neg98.3%
distribute-frac-neg98.3%
unsub-neg98.3%
distribute-frac-neg98.3%
distribute-neg-frac298.3%
neg-sub098.3%
associate--r-98.3%
neg-sub098.3%
+-commutative98.3%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (if (<= (exp z) 1.0) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (exp(z) <= 1.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 1.0d0) then
tmp = x + (y / (1.1283791670955126d0 - (x * y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 1.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) elif math.exp(z) <= 1.0: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (exp(z) <= 1.0) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); elseif (exp(z) <= 1.0) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 1.0], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 1:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 80.2%
remove-double-neg80.2%
distribute-frac-neg80.2%
unsub-neg80.2%
distribute-frac-neg80.2%
distribute-neg-frac280.2%
neg-sub080.1%
associate--r-80.1%
neg-sub080.9%
+-commutative80.9%
fma-define80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
metadata-eval80.9%
Simplified80.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 1Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.1%
if 1 < (exp.f64 z) Initial program 95.9%
remove-double-neg95.9%
distribute-frac-neg95.9%
unsub-neg95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
neg-sub095.9%
associate--r-95.9%
neg-sub095.9%
+-commutative95.9%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 46.1%
Taylor expanded in x around inf 100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y))))))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((exp(z) * 1.1283791670955126) - (x * y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else
tmp = x + (y / ((exp(z) * 1.1283791670955126d0) - (x * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((Math.exp(z) * 1.1283791670955126) - (x * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) else: tmp = x + (y / ((math.exp(z) * 1.1283791670955126) - (x * y))) return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); else tmp = Float64(x + Float64(y / Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); else tmp = x + (y / ((exp(z) * 1.1283791670955126) - (x * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 80.2%
remove-double-neg80.2%
distribute-frac-neg80.2%
unsub-neg80.2%
distribute-frac-neg80.2%
distribute-neg-frac280.2%
neg-sub080.1%
associate--r-80.1%
neg-sub080.9%
+-commutative80.9%
fma-define80.9%
*-commutative80.9%
distribute-rgt-neg-in80.9%
metadata-eval80.9%
Simplified80.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.3%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (- x (/ y -1.1283791670955126))))
(if (<= z -4.1e-78)
t_0
(if (<= z 2.7e-279)
t_1
(if (<= z 4.2e-201) t_0 (if (<= z 8.5e-23) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x - (y / -1.1283791670955126);
double tmp;
if (z <= -4.1e-78) {
tmp = t_0;
} else if (z <= 2.7e-279) {
tmp = t_1;
} else if (z <= 4.2e-201) {
tmp = t_0;
} else if (z <= 8.5e-23) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
t_1 = x - (y / (-1.1283791670955126d0))
if (z <= (-4.1d-78)) then
tmp = t_0
else if (z <= 2.7d-279) then
tmp = t_1
else if (z <= 4.2d-201) then
tmp = t_0
else if (z <= 8.5d-23) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x - (y / -1.1283791670955126);
double tmp;
if (z <= -4.1e-78) {
tmp = t_0;
} else if (z <= 2.7e-279) {
tmp = t_1;
} else if (z <= 4.2e-201) {
tmp = t_0;
} else if (z <= 8.5e-23) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x - (y / -1.1283791670955126) tmp = 0 if z <= -4.1e-78: tmp = t_0 elif z <= 2.7e-279: tmp = t_1 elif z <= 4.2e-201: tmp = t_0 elif z <= 8.5e-23: tmp = t_1 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) t_1 = Float64(x - Float64(y / -1.1283791670955126)) tmp = 0.0 if (z <= -4.1e-78) tmp = t_0; elseif (z <= 2.7e-279) tmp = t_1; elseif (z <= 4.2e-201) tmp = t_0; elseif (z <= 8.5e-23) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); t_1 = x - (y / -1.1283791670955126); tmp = 0.0; if (z <= -4.1e-78) tmp = t_0; elseif (z <= 2.7e-279) tmp = t_1; elseif (z <= 4.2e-201) tmp = t_0; elseif (z <= 8.5e-23) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e-78], t$95$0, If[LessEqual[z, 2.7e-279], t$95$1, If[LessEqual[z, 4.2e-201], t$95$0, If[LessEqual[z, 8.5e-23], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x - \frac{y}{-1.1283791670955126}\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-279}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-201}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.0999999999999998e-78 or 2.7000000000000001e-279 < z < 4.20000000000000024e-201Initial program 86.2%
remove-double-neg86.2%
distribute-frac-neg86.2%
unsub-neg86.2%
distribute-frac-neg86.2%
distribute-neg-frac286.2%
neg-sub086.1%
associate--r-86.1%
neg-sub086.7%
+-commutative86.7%
fma-define86.7%
*-commutative86.7%
distribute-rgt-neg-in86.7%
metadata-eval86.7%
Simplified86.7%
Taylor expanded in y around inf 95.4%
if -4.0999999999999998e-78 < z < 2.7000000000000001e-279 or 4.20000000000000024e-201 < z < 8.4999999999999996e-23Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 82.9%
if 8.4999999999999996e-23 < z Initial program 95.9%
remove-double-neg95.9%
distribute-frac-neg95.9%
unsub-neg95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
neg-sub095.9%
associate--r-95.9%
neg-sub095.9%
+-commutative95.9%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 46.8%
Taylor expanded in x around inf 100.0%
Final simplification92.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))))
(if (<= z -1.3e-301)
t_0
(if (<= z 4.8e-277)
x
(if (<= z 1.8e-198)
t_0
(if (<= z 6.2e-165) (* y 0.8862269254527579) x))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.3e-301) {
tmp = t_0;
} else if (z <= 4.8e-277) {
tmp = x;
} else if (z <= 1.8e-198) {
tmp = t_0;
} else if (z <= 6.2e-165) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
if (z <= (-1.3d-301)) then
tmp = t_0
else if (z <= 4.8d-277) then
tmp = x
else if (z <= 1.8d-198) then
tmp = t_0
else if (z <= 6.2d-165) then
tmp = y * 0.8862269254527579d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.3e-301) {
tmp = t_0;
} else if (z <= 4.8e-277) {
tmp = x;
} else if (z <= 1.8e-198) {
tmp = t_0;
} else if (z <= 6.2e-165) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) tmp = 0 if z <= -1.3e-301: tmp = t_0 elif z <= 4.8e-277: tmp = x elif z <= 1.8e-198: tmp = t_0 elif z <= 6.2e-165: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) tmp = 0.0 if (z <= -1.3e-301) tmp = t_0; elseif (z <= 4.8e-277) tmp = x; elseif (z <= 1.8e-198) tmp = t_0; elseif (z <= 6.2e-165) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); tmp = 0.0; if (z <= -1.3e-301) tmp = t_0; elseif (z <= 4.8e-277) tmp = x; elseif (z <= 1.8e-198) tmp = t_0; elseif (z <= 6.2e-165) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-301], t$95$0, If[LessEqual[z, 4.8e-277], x, If[LessEqual[z, 1.8e-198], t$95$0, If[LessEqual[z, 6.2e-165], N[(y * 0.8862269254527579), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-277}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-198}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-165}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2999999999999999e-301 or 4.8e-277 < z < 1.79999999999999999e-198Initial program 90.4%
remove-double-neg90.4%
distribute-frac-neg90.4%
unsub-neg90.4%
distribute-frac-neg90.4%
distribute-neg-frac290.4%
neg-sub090.4%
associate--r-90.4%
neg-sub090.8%
+-commutative90.8%
fma-define90.8%
*-commutative90.8%
distribute-rgt-neg-in90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in y around inf 82.7%
if -1.2999999999999999e-301 < z < 4.8e-277 or 6.19999999999999992e-165 < z Initial program 97.5%
remove-double-neg97.5%
distribute-frac-neg97.5%
unsub-neg97.5%
distribute-frac-neg97.5%
distribute-neg-frac297.5%
neg-sub097.5%
associate--r-97.5%
neg-sub097.5%
+-commutative97.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 48.9%
Taylor expanded in x around inf 84.7%
if 1.79999999999999999e-198 < z < 6.19999999999999992e-165Initial program 99.7%
remove-double-neg99.7%
distribute-frac-neg99.7%
unsub-neg99.7%
distribute-frac-neg99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
neg-sub099.7%
+-commutative99.7%
fma-define99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around 0 85.0%
*-commutative85.0%
Simplified85.0%
Final simplification83.7%
(FPCore (x y z) :precision binary64 (if (<= x -7.5e-205) x (if (<= x 2.6e-138) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e-205) {
tmp = x;
} else if (x <= 2.6e-138) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-7.5d-205)) then
tmp = x
else if (x <= 2.6d-138) then
tmp = y * 0.8862269254527579d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.5e-205) {
tmp = x;
} else if (x <= 2.6e-138) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.5e-205: tmp = x elif x <= 2.6e-138: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.5e-205) tmp = x; elseif (x <= 2.6e-138) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.5e-205) tmp = x; elseif (x <= 2.6e-138) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.5e-205], x, If[LessEqual[x, 2.6e-138], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-205}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.4999999999999996e-205 or 2.6e-138 < x Initial program 97.5%
remove-double-neg97.5%
distribute-frac-neg97.5%
unsub-neg97.5%
distribute-frac-neg97.5%
distribute-neg-frac297.5%
neg-sub097.5%
associate--r-97.5%
neg-sub097.5%
+-commutative97.5%
fma-define99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in y around inf 77.0%
Taylor expanded in x around inf 79.7%
if -7.4999999999999996e-205 < x < 2.6e-138Initial program 84.4%
remove-double-neg84.4%
distribute-frac-neg84.4%
unsub-neg84.4%
distribute-frac-neg84.4%
distribute-neg-frac284.4%
neg-sub084.3%
associate--r-84.3%
neg-sub085.0%
+-commutative85.0%
fma-define85.0%
*-commutative85.0%
distribute-rgt-neg-in85.0%
metadata-eval85.0%
Simplified85.0%
Taylor expanded in z around 0 59.6%
Taylor expanded in x around 0 49.9%
*-commutative49.9%
Simplified49.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.2%
remove-double-neg94.2%
distribute-frac-neg94.2%
unsub-neg94.2%
distribute-frac-neg94.2%
distribute-neg-frac294.2%
neg-sub094.1%
associate--r-94.1%
neg-sub094.3%
+-commutative94.3%
fma-define95.5%
*-commutative95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in y around inf 64.2%
Taylor expanded in x around inf 66.0%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
}
def code(x, y, z): return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
\end{array}
herbie shell --seed 2024118
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:alt
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))