
(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 10 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))
(if (<= (exp z) 2.0)
(+
x
(/
y
(+
1.1283791670955126
(- (* z (- 1.1283791670955126 (* z -0.5641895835477563))) (* 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) <= 2.0) {
tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 - (z * -0.5641895835477563))) - (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) <= 2.0d0) then
tmp = x + (y / (1.1283791670955126d0 + ((z * (1.1283791670955126d0 - (z * (-0.5641895835477563d0)))) - (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) <= 2.0) {
tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 - (z * -0.5641895835477563))) - (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) <= 2.0: tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 - (z * -0.5641895835477563))) - (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) <= 2.0) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 + Float64(Float64(z * Float64(1.1283791670955126 - Float64(z * -0.5641895835477563))) - 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) <= 2.0) tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 - (z * -0.5641895835477563))) - (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], 2.0], N[(x + N[(y / N[(1.1283791670955126 + N[(N[(z * N[(1.1283791670955126 - N[(z * -0.5641895835477563), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $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 2:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 + \left(z \cdot \left(1.1283791670955126 - z \cdot -0.5641895835477563\right) - x \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 94.2%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 2Initial 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%
if 2 < (exp.f64 z) Initial program 97.0%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (- x (/ y (fma x y (* (exp z) -1.1283791670955126)))))
double code(double x, double y, double z) {
return x - (y / fma(x, y, (exp(z) * -1.1283791670955126)));
}
function code(x, y, z) return Float64(x - Float64(y / fma(x, y, Float64(exp(z) * -1.1283791670955126)))) end
code[x_, y_, z_] := N[(x - N[(y / N[(x * y + N[(N[Exp[z], $MachinePrecision] * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}
\end{array}
Initial program 97.6%
remove-double-neg97.6%
distribute-frac-neg97.6%
unsub-neg97.6%
distribute-frac-neg97.6%
distribute-neg-frac297.6%
neg-sub097.7%
associate--r-97.7%
neg-sub097.7%
+-commutative97.7%
fma-define98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
metadata-eval98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((exp(z) * 1.1283791670955126) - (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 / ((exp(z) * 1.1283791670955126d0) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((Math.exp(z) * 1.1283791670955126) - (x * y)));
}
def code(x, y, z): return x + (y / ((math.exp(z) * 1.1283791670955126) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((exp(z) * 1.1283791670955126) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}
\end{array}
Initial program 97.6%
Final simplification97.6%
(FPCore (x y z)
:precision binary64
(if (<= x -3.5e-212)
x
(if (or (<= x -4.1e-231) (and (not (<= x -5.5e-258)) (<= x 6e-134)))
(* y 0.8862269254527579)
x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.5e-212) {
tmp = x;
} else if ((x <= -4.1e-231) || (!(x <= -5.5e-258) && (x <= 6e-134))) {
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 <= (-3.5d-212)) then
tmp = x
else if ((x <= (-4.1d-231)) .or. (.not. (x <= (-5.5d-258))) .and. (x <= 6d-134)) 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 <= -3.5e-212) {
tmp = x;
} else if ((x <= -4.1e-231) || (!(x <= -5.5e-258) && (x <= 6e-134))) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.5e-212: tmp = x elif (x <= -4.1e-231) or (not (x <= -5.5e-258) and (x <= 6e-134)): tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.5e-212) tmp = x; elseif ((x <= -4.1e-231) || (!(x <= -5.5e-258) && (x <= 6e-134))) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.5e-212) tmp = x; elseif ((x <= -4.1e-231) || (~((x <= -5.5e-258)) && (x <= 6e-134))) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.5e-212], x, If[Or[LessEqual[x, -4.1e-231], And[N[Not[LessEqual[x, -5.5e-258]], $MachinePrecision], LessEqual[x, 6e-134]]], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-212}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-231} \lor \neg \left(x \leq -5.5 \cdot 10^{-258}\right) \land x \leq 6 \cdot 10^{-134}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.4999999999999998e-212 or -4.1000000000000002e-231 < x < -5.49999999999999969e-258 or 6e-134 < x Initial program 98.8%
Taylor expanded in x around inf 77.3%
if -3.4999999999999998e-212 < x < -4.1000000000000002e-231 or -5.49999999999999969e-258 < x < 6e-134Initial program 93.4%
remove-double-neg93.4%
distribute-frac-neg93.4%
unsub-neg93.4%
distribute-frac-neg93.4%
distribute-neg-frac293.4%
neg-sub093.7%
associate--r-93.7%
neg-sub093.7%
+-commutative93.7%
fma-define93.7%
*-commutative93.7%
distribute-rgt-neg-in93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in z around 0 68.8%
Taylor expanded in y around 0 63.7%
Taylor expanded in x around 0 52.4%
associate-*r/52.4%
sub-neg52.4%
*-commutative52.4%
metadata-eval52.4%
distribute-lft1-in52.4%
*-commutative52.4%
times-frac52.4%
metadata-eval52.2%
Simplified52.2%
Taylor expanded in z around 0 51.0%
*-commutative51.0%
Simplified51.0%
Final simplification71.5%
(FPCore (x y z)
:precision binary64
(if (<= z -220.0)
(+ x (/ -1.0 x))
(if (<= z 8.8e-19)
(+ x (/ y (- 1.1283791670955126 (+ (* x y) (* z -1.1283791670955126)))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -220.0) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} 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 <= (-220.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 8.8d-19) then
tmp = x + (y / (1.1283791670955126d0 - ((x * y) + (z * (-1.1283791670955126d0)))))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -220.0) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -220.0: tmp = x + (-1.0 / x) elif z <= 8.8e-19: tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -220.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 8.8e-19) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(Float64(x * y) + Float64(z * -1.1283791670955126))))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -220.0) tmp = x + (-1.0 / x); elseif (z <= 8.8e-19) tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -220.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e-19], N[(x + N[(y / N[(1.1283791670955126 - N[(N[(x * y), $MachinePrecision] + N[(z * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -220:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-19}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot -1.1283791670955126\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -220Initial program 94.2%
Taylor expanded in y around inf 100.0%
if -220 < z < 8.7999999999999994e-19Initial 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.6%
if 8.7999999999999994e-19 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -140.0) (+ x (/ -1.0 x)) (if (<= z 8.8e-19) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -140.0) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
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 (z <= (-140.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 8.8d-19) 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 (z <= -140.0) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -140.0: tmp = x + (-1.0 / x) elif z <= 8.8e-19: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -140.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 8.8e-19) 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 (z <= -140.0) tmp = x + (-1.0 / x); elseif (z <= 8.8e-19) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -140.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e-19], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -140:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-19}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -140Initial program 94.2%
Taylor expanded in y around inf 100.0%
if -140 < z < 8.7999999999999994e-19Initial 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 8.7999999999999994e-19 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (<= z -4.8e-9) x (if (<= z 8.5e-19) (+ x (* y 0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e-9) {
tmp = x;
} else if (z <= 8.5e-19) {
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 <= (-4.8d-9)) then
tmp = x
else if (z <= 8.5d-19) 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 <= -4.8e-9) {
tmp = x;
} else if (z <= 8.5e-19) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.8e-9: tmp = x elif z <= 8.5e-19: tmp = x + (y * 0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.8e-9) tmp = x; elseif (z <= 8.5e-19) 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 <= -4.8e-9) tmp = x; elseif (z <= 8.5e-19) tmp = x + (y * 0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.8e-9], x, If[LessEqual[z, 8.5e-19], N[(x + N[(y * 0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-19}:\\
\;\;\;\;x + y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.8e-9 or 8.50000000000000003e-19 < z Initial program 95.8%
Taylor expanded in x around inf 76.1%
if -4.8e-9 < z < 8.50000000000000003e-19Initial program 99.8%
Taylor expanded in y around 0 72.4%
associate-*r/72.4%
Simplified72.4%
Taylor expanded in z around 0 72.1%
*-commutative72.1%
Simplified72.1%
Final simplification74.3%
(FPCore (x y z) :precision binary64 (if (<= z -3.1e-135) (+ x (/ -1.0 x)) (if (<= z 8.8e-19) (+ x (* y 0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-135) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
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 <= (-3.1d-135)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 8.8d-19) 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 <= -3.1e-135) {
tmp = x + (-1.0 / x);
} else if (z <= 8.8e-19) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e-135: tmp = x + (-1.0 / x) elif z <= 8.8e-19: tmp = x + (y * 0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e-135) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 8.8e-19) 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 <= -3.1e-135) tmp = x + (-1.0 / x); elseif (z <= 8.8e-19) tmp = x + (y * 0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e-135], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e-19], N[(x + N[(y * 0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-135}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-19}:\\
\;\;\;\;x + y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.1000000000000001e-135Initial program 95.8%
Taylor expanded in y around inf 90.5%
if -3.1000000000000001e-135 < z < 8.7999999999999994e-19Initial program 99.8%
Taylor expanded in y around 0 75.9%
associate-*r/75.9%
Simplified75.9%
Taylor expanded in z around 0 75.9%
*-commutative75.9%
Simplified75.9%
if 8.7999999999999994e-19 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (<= z -2.75e-133) (+ x (/ -1.0 x)) (if (<= z 1.2e-19) (- x (/ y -1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.75e-133) {
tmp = x + (-1.0 / x);
} else if (z <= 1.2e-19) {
tmp = x - (y / -1.1283791670955126);
} 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 <= (-2.75d-133)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 1.2d-19) then
tmp = x - (y / (-1.1283791670955126d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.75e-133) {
tmp = x + (-1.0 / x);
} else if (z <= 1.2e-19) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.75e-133: tmp = x + (-1.0 / x) elif z <= 1.2e-19: tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.75e-133) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 1.2e-19) tmp = Float64(x - Float64(y / -1.1283791670955126)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.75e-133) tmp = x + (-1.0 / x); elseif (z <= 1.2e-19) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.75e-133], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-19], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{-133}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-19}:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.74999999999999988e-133Initial program 95.8%
Taylor expanded in y around inf 90.5%
if -2.74999999999999988e-133 < z < 1.20000000000000011e-19Initial 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 y around 0 76.0%
Taylor expanded in z around 0 76.0%
if 1.20000000000000011e-19 < z Initial program 97.1%
Taylor expanded in x around inf 100.0%
Final simplification87.8%
(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 97.6%
Taylor expanded in x around inf 65.3%
Final simplification65.3%
(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 2024130
(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)))))