
(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 (<= z -350.0)
(+ x (/ -1.0 x))
(if (<= z 5.2e-50)
(+ x (/ 1.0 (- (/ 1.1283791670955126 y) x)))
(- x (* (/ y (exp z)) -0.8862269254527579)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -350.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.2e-50) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x - ((y / exp(z)) * -0.8862269254527579);
}
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 (z <= (-350.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 5.2d-50) then
tmp = x + (1.0d0 / ((1.1283791670955126d0 / y) - x))
else
tmp = x - ((y / exp(z)) * (-0.8862269254527579d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -350.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.2e-50) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x - ((y / Math.exp(z)) * -0.8862269254527579);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -350.0: tmp = x + (-1.0 / x) elif z <= 5.2e-50: tmp = x + (1.0 / ((1.1283791670955126 / y) - x)) else: tmp = x - ((y / math.exp(z)) * -0.8862269254527579) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -350.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 5.2e-50) tmp = Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 / y) - x))); else tmp = Float64(x - Float64(Float64(y / exp(z)) * -0.8862269254527579)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -350.0) tmp = x + (-1.0 / x); elseif (z <= 5.2e-50) tmp = x + (1.0 / ((1.1283791670955126 / y) - x)); else tmp = x - ((y / exp(z)) * -0.8862269254527579); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -350.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-50], N[(x + N[(1.0 / N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / N[Exp[z], $MachinePrecision]), $MachinePrecision] * -0.8862269254527579), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -350:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{1}{\frac{1.1283791670955126}{y} - x}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{e^{z}} \cdot -0.8862269254527579\\
\end{array}
\end{array}
if z < -350Initial program 87.5%
Taylor expanded in y around inf 100.0%
if -350 < z < 5.2000000000000003e-50Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
*-commutative99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
metadata-eval99.9%
fma-neg99.9%
*-commutative99.9%
clear-num99.9%
inv-pow99.9%
div-sub99.9%
add-sqr-sqrt53.0%
sqrt-unprod95.6%
sqr-neg95.6%
sqrt-unprod43.3%
add-sqr-sqrt85.7%
associate-/l*85.7%
*-inverses85.7%
*-commutative85.7%
add-sqr-sqrt43.3%
sqrt-unprod95.6%
sqr-neg95.6%
sqrt-unprod53.1%
*-un-lft-identity53.1%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
unpow-199.9%
Simplified99.9%
if 5.2000000000000003e-50 < z Initial program 91.4%
remove-double-neg91.4%
distribute-frac-neg91.4%
unsub-neg91.4%
distribute-frac-neg91.4%
distribute-neg-frac291.4%
neg-sub091.4%
associate--r-91.4%
neg-sub091.4%
+-commutative91.4%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 1.8e-307) (+ 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) <= 1.8e-307) {
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) <= 1.8e-307) 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], 1.8e-307], 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 1.8 \cdot 10^{-307}:\\
\;\;\;\;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) < 1.80000000000000003e-307Initial program 87.5%
Taylor expanded in y around inf 100.0%
if 1.80000000000000003e-307 < (exp.f64 z) Initial program 96.7%
remove-double-neg96.7%
distribute-frac-neg96.7%
unsub-neg96.7%
distribute-frac-neg96.7%
distribute-neg-frac296.7%
neg-sub096.7%
associate--r-96.7%
neg-sub096.7%
+-commutative96.7%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (- x (* y -0.8862269254527579))))
(if (<= z -0.00078)
t_0
(if (<= z -2.9e-300)
t_1
(if (<= z 2.3e-101) t_0 (if (<= z 3.1e-6) t_1 x))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x - (y * -0.8862269254527579);
double tmp;
if (z <= -0.00078) {
tmp = t_0;
} else if (z <= -2.9e-300) {
tmp = t_1;
} else if (z <= 2.3e-101) {
tmp = t_0;
} else if (z <= 3.1e-6) {
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 * (-0.8862269254527579d0))
if (z <= (-0.00078d0)) then
tmp = t_0
else if (z <= (-2.9d-300)) then
tmp = t_1
else if (z <= 2.3d-101) then
tmp = t_0
else if (z <= 3.1d-6) 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 * -0.8862269254527579);
double tmp;
if (z <= -0.00078) {
tmp = t_0;
} else if (z <= -2.9e-300) {
tmp = t_1;
} else if (z <= 2.3e-101) {
tmp = t_0;
} else if (z <= 3.1e-6) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x - (y * -0.8862269254527579) tmp = 0 if z <= -0.00078: tmp = t_0 elif z <= -2.9e-300: tmp = t_1 elif z <= 2.3e-101: tmp = t_0 elif z <= 3.1e-6: 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 * -0.8862269254527579)) tmp = 0.0 if (z <= -0.00078) tmp = t_0; elseif (z <= -2.9e-300) tmp = t_1; elseif (z <= 2.3e-101) tmp = t_0; elseif (z <= 3.1e-6) 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 * -0.8862269254527579); tmp = 0.0; if (z <= -0.00078) tmp = t_0; elseif (z <= -2.9e-300) tmp = t_1; elseif (z <= 2.3e-101) tmp = t_0; elseif (z <= 3.1e-6) 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 * -0.8862269254527579), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.00078], t$95$0, If[LessEqual[z, -2.9e-300], t$95$1, If[LessEqual[z, 2.3e-101], t$95$0, If[LessEqual[z, 3.1e-6], t$95$1, x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x - y \cdot -0.8862269254527579\\
\mathbf{if}\;z \leq -0.00078:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-300}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-101}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.79999999999999986e-4 or -2.89999999999999992e-300 < z < 2.2999999999999999e-101Initial program 92.1%
Taylor expanded in y around inf 93.2%
if -7.79999999999999986e-4 < z < -2.89999999999999992e-300 or 2.2999999999999999e-101 < z < 3.1e-6Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
*-commutative99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 81.4%
if 3.1e-6 < z Initial program 90.3%
Taylor expanded in x around inf 98.5%
Final simplification90.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (- x (/ y -1.1283791670955126))))
(if (<= z -4e-5)
t_0
(if (<= z -2.3e-299)
t_1
(if (<= z 1e-133) t_0 (if (<= z 1.7e-6) 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 <= -4e-5) {
tmp = t_0;
} else if (z <= -2.3e-299) {
tmp = t_1;
} else if (z <= 1e-133) {
tmp = t_0;
} else if (z <= 1.7e-6) {
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 <= (-4d-5)) then
tmp = t_0
else if (z <= (-2.3d-299)) then
tmp = t_1
else if (z <= 1d-133) then
tmp = t_0
else if (z <= 1.7d-6) 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 <= -4e-5) {
tmp = t_0;
} else if (z <= -2.3e-299) {
tmp = t_1;
} else if (z <= 1e-133) {
tmp = t_0;
} else if (z <= 1.7e-6) {
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 <= -4e-5: tmp = t_0 elif z <= -2.3e-299: tmp = t_1 elif z <= 1e-133: tmp = t_0 elif z <= 1.7e-6: 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 <= -4e-5) tmp = t_0; elseif (z <= -2.3e-299) tmp = t_1; elseif (z <= 1e-133) tmp = t_0; elseif (z <= 1.7e-6) 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 <= -4e-5) tmp = t_0; elseif (z <= -2.3e-299) tmp = t_1; elseif (z <= 1e-133) tmp = t_0; elseif (z <= 1.7e-6) 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, -4e-5], t$95$0, If[LessEqual[z, -2.3e-299], t$95$1, If[LessEqual[z, 1e-133], t$95$0, If[LessEqual[z, 1.7e-6], 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 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.00000000000000033e-5 or -2.3000000000000001e-299 < z < 1.0000000000000001e-133Initial program 91.7%
Taylor expanded in y around inf 94.6%
if -4.00000000000000033e-5 < z < -2.3000000000000001e-299 or 1.0000000000000001e-133 < z < 1.70000000000000003e-6Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
*-commutative99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 80.3%
if 1.70000000000000003e-6 < z Initial program 90.3%
Taylor expanded in x around inf 98.5%
Final simplification90.8%
(FPCore (x y z) :precision binary64 (if (<= z -300.0) (+ x (/ -1.0 x)) (if (<= z 55.0) (+ x (/ 1.0 (- (/ 1.1283791670955126 y) x))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 55.0) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} 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 (z <= (-300.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 55.0d0) then
tmp = x + (1.0d0 / ((1.1283791670955126d0 / y) - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 55.0) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -300.0: tmp = x + (-1.0 / x) elif z <= 55.0: tmp = x + (1.0 / ((1.1283791670955126 / y) - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -300.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 55.0) tmp = Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 / y) - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -300.0) tmp = x + (-1.0 / x); elseif (z <= 55.0) tmp = x + (1.0 / ((1.1283791670955126 / y) - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -300.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 55.0], N[(x + N[(1.0 / N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -300:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 55:\\
\;\;\;\;x + \frac{1}{\frac{1.1283791670955126}{y} - x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -300Initial program 87.5%
Taylor expanded in y around inf 100.0%
if -300 < z < 55Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
*-commutative99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
metadata-eval99.9%
fma-neg99.9%
*-commutative99.9%
clear-num99.9%
inv-pow99.9%
div-sub99.9%
add-sqr-sqrt53.6%
sqrt-unprod95.8%
sqr-neg95.8%
sqrt-unprod42.9%
add-sqr-sqrt86.6%
associate-/l*86.6%
*-inverses86.6%
*-commutative86.6%
add-sqr-sqrt42.9%
sqrt-unprod95.9%
sqr-neg95.9%
sqrt-unprod53.7%
*-un-lft-identity53.7%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
unpow-199.9%
Simplified99.9%
if 55 < z Initial program 90.3%
Taylor expanded in x around inf 98.5%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.3e-16) x (if (<= z 4.2e-5) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e-16) {
tmp = x;
} else if (z <= 4.2e-5) {
tmp = x - (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 (z <= (-1.3d-16)) then
tmp = x
else if (z <= 4.2d-5) then
tmp = x - (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 (z <= -1.3e-16) {
tmp = x;
} else if (z <= 4.2e-5) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.3e-16: tmp = x elif z <= 4.2e-5: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.3e-16) tmp = x; elseif (z <= 4.2e-5) tmp = Float64(x - Float64(y * -0.8862269254527579)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.3e-16) tmp = x; elseif (z <= 4.2e-5) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.3e-16], x, If[LessEqual[z, 4.2e-5], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-5}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2999999999999999e-16 or 4.19999999999999977e-5 < z Initial program 89.2%
Taylor expanded in x around inf 76.7%
if -1.2999999999999999e-16 < z < 4.19999999999999977e-5Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.9%
*-commutative99.9%
fma-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 76.7%
Final simplification76.7%
(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.1%
Taylor expanded in x around inf 72.2%
Final simplification72.2%
(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 2024067
(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)))))