
(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 12 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 88.2%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 99.4%
remove-double-neg99.4%
distribute-frac-neg99.4%
unsub-neg99.4%
distribute-frac-neg99.4%
distribute-neg-frac299.4%
neg-sub099.4%
associate--r-99.4%
neg-sub099.4%
+-commutative99.4%
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)) (+ 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 88.2%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 99.4%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(if (<= (exp z) 0.0)
(+ x (/ -1.0 x))
(+
x
(/
y
(-
(+
1.1283791670955126
(*
z
(+
1.1283791670955126
(* z (+ 0.5641895835477563 (* z 0.18806319451591877))))))
(* 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 / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (z * 0.18806319451591877)))))) - (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 / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 + (z * 0.18806319451591877d0)))))) - (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 / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (z * 0.18806319451591877)))))) - (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 / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (z * 0.18806319451591877)))))) - (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(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 + Float64(z * 0.18806319451591877)))))) - 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 / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (z * 0.18806319451591877)))))) - (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[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 + N[(z * 0.18806319451591877), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + z \cdot 0.18806319451591877\right)\right)\right) - x \cdot y}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 88.2%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 99.4%
Taylor expanded in z around 0 99.4%
*-commutative99.4%
*-commutative99.4%
Simplified99.4%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(if (<= z -2.8e-34)
(+ x (/ -1.0 x))
(if (or (<= z -8.2e-284) (and (not (<= z 5e-222)) (<= z 4.6e-27)))
(- x (/ y -1.1283791670955126))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e-34) {
tmp = x + (-1.0 / x);
} else if ((z <= -8.2e-284) || (!(z <= 5e-222) && (z <= 4.6e-27))) {
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.8d-34)) then
tmp = x + ((-1.0d0) / x)
else if ((z <= (-8.2d-284)) .or. (.not. (z <= 5d-222)) .and. (z <= 4.6d-27)) 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.8e-34) {
tmp = x + (-1.0 / x);
} else if ((z <= -8.2e-284) || (!(z <= 5e-222) && (z <= 4.6e-27))) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.8e-34: tmp = x + (-1.0 / x) elif (z <= -8.2e-284) or (not (z <= 5e-222) and (z <= 4.6e-27)): tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.8e-34) tmp = Float64(x + Float64(-1.0 / x)); elseif ((z <= -8.2e-284) || (!(z <= 5e-222) && (z <= 4.6e-27))) 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.8e-34) tmp = x + (-1.0 / x); elseif ((z <= -8.2e-284) || (~((z <= 5e-222)) && (z <= 4.6e-27))) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.8e-34], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -8.2e-284], And[N[Not[LessEqual[z, 5e-222]], $MachinePrecision], LessEqual[z, 4.6e-27]]], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-34}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-284} \lor \neg \left(z \leq 5 \cdot 10^{-222}\right) \land z \leq 4.6 \cdot 10^{-27}:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.79999999999999997e-34Initial program 90.3%
Taylor expanded in y around inf 94.2%
if -2.79999999999999997e-34 < z < -8.19999999999999997e-284 or 5.00000000000000008e-222 < z < 4.5999999999999999e-27Initial 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 81.1%
if -8.19999999999999997e-284 < z < 5.00000000000000008e-222 or 4.5999999999999999e-27 < z Initial program 98.8%
Taylor expanded in x around inf 94.1%
Final simplification88.8%
(FPCore (x y z)
:precision binary64
(if (<= z -6.2e-33)
(+ x (/ -1.0 x))
(if (or (<= z -8.5e-284) (and (not (<= z 1.2e-220)) (<= z 4.2e-27)))
(- x (* y -0.8862269254527579))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e-33) {
tmp = x + (-1.0 / x);
} else if ((z <= -8.5e-284) || (!(z <= 1.2e-220) && (z <= 4.2e-27))) {
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 <= (-6.2d-33)) then
tmp = x + ((-1.0d0) / x)
else if ((z <= (-8.5d-284)) .or. (.not. (z <= 1.2d-220)) .and. (z <= 4.2d-27)) 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 <= -6.2e-33) {
tmp = x + (-1.0 / x);
} else if ((z <= -8.5e-284) || (!(z <= 1.2e-220) && (z <= 4.2e-27))) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.2e-33: tmp = x + (-1.0 / x) elif (z <= -8.5e-284) or (not (z <= 1.2e-220) and (z <= 4.2e-27)): tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.2e-33) tmp = Float64(x + Float64(-1.0 / x)); elseif ((z <= -8.5e-284) || (!(z <= 1.2e-220) && (z <= 4.2e-27))) 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 <= -6.2e-33) tmp = x + (-1.0 / x); elseif ((z <= -8.5e-284) || (~((z <= 1.2e-220)) && (z <= 4.2e-27))) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.2e-33], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -8.5e-284], And[N[Not[LessEqual[z, 1.2e-220]], $MachinePrecision], LessEqual[z, 4.2e-27]]], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-33}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-284} \lor \neg \left(z \leq 1.2 \cdot 10^{-220}\right) \land z \leq 4.2 \cdot 10^{-27}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.19999999999999994e-33Initial program 90.3%
Taylor expanded in y around inf 94.2%
if -6.19999999999999994e-33 < z < -8.4999999999999995e-284 or 1.2000000000000001e-220 < z < 4.20000000000000031e-27Initial 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 81.0%
*-commutative81.0%
Simplified81.0%
if -8.4999999999999995e-284 < z < 1.2000000000000001e-220 or 4.20000000000000031e-27 < z Initial program 98.8%
Taylor expanded in x around inf 94.1%
Final simplification88.8%
(FPCore (x y z)
:precision binary64
(if (<= z -130.0)
(+ x (/ -1.0 x))
(if (<= z 0.0002)
(+ x (/ y (- (* 1.1283791670955126 (+ z 1.0)) (* x y))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -130.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0002) {
tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (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 <= (-130.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.0002d0) then
tmp = x + (y / ((1.1283791670955126d0 * (z + 1.0d0)) - (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 <= -130.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0002) {
tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -130.0: tmp = x + (-1.0 / x) elif z <= 0.0002: tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -130.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.0002) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * Float64(z + 1.0)) - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -130.0) tmp = x + (-1.0 / x); elseif (z <= 0.0002) tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -130.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0002], N[(x + N[(y / N[(N[(1.1283791670955126 * N[(z + 1.0), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -130:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.0002:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -130Initial program 88.2%
Taylor expanded in y around inf 100.0%
if -130 < z < 2.0000000000000001e-4Initial program 99.9%
Taylor expanded in z around 0 99.6%
*-commutative99.6%
Simplified99.6%
distribute-rgt1-in99.6%
Applied egg-rr99.6%
if 2.0000000000000001e-4 < z Initial program 98.1%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -230.0)
(+ x (/ -1.0 x))
(+
x
(/
y
(-
(+
1.1283791670955126
(* z (+ 1.1283791670955126 (* z 0.5641895835477563))))
(* x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -230.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * 0.5641895835477563)))) - (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 (z <= (-230.0d0)) then
tmp = x + ((-1.0d0) / x)
else
tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * 0.5641895835477563d0)))) - (x * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -230.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * 0.5641895835477563)))) - (x * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -230.0: tmp = x + (-1.0 / x) else: tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * 0.5641895835477563)))) - (x * y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -230.0) tmp = Float64(x + Float64(-1.0 / x)); else tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * 0.5641895835477563)))) - Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -230.0) tmp = x + (-1.0 / x); else tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * 0.5641895835477563)))) - (x * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -230.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * 0.5641895835477563), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -230:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot 0.5641895835477563\right)\right) - x \cdot y}\\
\end{array}
\end{array}
if z < -230Initial program 88.2%
Taylor expanded in y around inf 100.0%
if -230 < z Initial program 99.4%
Taylor expanded in z around 0 97.9%
*-commutative97.9%
Simplified97.9%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= z -122.0) (+ x (/ -1.0 x)) (if (<= z 0.0002) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -122.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0002) {
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 <= (-122.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.0002d0) 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 <= -122.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0002) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -122.0: tmp = x + (-1.0 / x) elif z <= 0.0002: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -122.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.0002) 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 <= -122.0) tmp = x + (-1.0 / x); elseif (z <= 0.0002) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -122.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0002], 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 -122:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.0002:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -122Initial program 88.2%
Taylor expanded in y around inf 100.0%
if -122 < z < 2.0000000000000001e-4Initial 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.3%
if 2.0000000000000001e-4 < z Initial program 98.1%
Taylor expanded in x around inf 100.0%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (<= x -4e-73) x (if (<= x 120.0) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e-73) {
tmp = x;
} else if (x <= 120.0) {
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 (x <= (-4d-73)) then
tmp = x
else if (x <= 120.0d0) 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 (x <= -4e-73) {
tmp = x;
} else if (x <= 120.0) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e-73: tmp = x elif x <= 120.0: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e-73) tmp = x; elseif (x <= 120.0) 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 (x <= -4e-73) tmp = x; elseif (x <= 120.0) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e-73], x, If[LessEqual[x, 120.0], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 120:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.99999999999999999e-73 or 120 < x Initial program 99.3%
Taylor expanded in x around inf 95.6%
if -3.99999999999999999e-73 < x < 120Initial program 93.8%
remove-double-neg93.8%
distribute-frac-neg93.8%
unsub-neg93.8%
distribute-frac-neg93.8%
distribute-neg-frac293.8%
neg-sub094.0%
associate--r-94.0%
neg-sub094.1%
+-commutative94.1%
fma-define94.1%
*-commutative94.1%
distribute-rgt-neg-in94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in z around 0 67.9%
Taylor expanded in y around 0 52.7%
*-commutative52.7%
Simplified52.7%
(FPCore (x y z) :precision binary64 (if (<= x -3.8e-119) x (if (<= x 5.2e-157) (/ y 1.1283791670955126) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e-119) {
tmp = x;
} else if (x <= 5.2e-157) {
tmp = 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 (x <= (-3.8d-119)) then
tmp = x
else if (x <= 5.2d-157) then
tmp = 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 (x <= -3.8e-119) {
tmp = x;
} else if (x <= 5.2e-157) {
tmp = y / 1.1283791670955126;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e-119: tmp = x elif x <= 5.2e-157: tmp = y / 1.1283791670955126 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e-119) tmp = x; elseif (x <= 5.2e-157) tmp = Float64(y / 1.1283791670955126); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.8e-119) tmp = x; elseif (x <= 5.2e-157) tmp = y / 1.1283791670955126; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e-119], x, If[LessEqual[x, 5.2e-157], N[(y / 1.1283791670955126), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.79999999999999975e-119 or 5.19999999999999977e-157 < x Initial program 97.6%
Taylor expanded in x around inf 81.3%
if -3.79999999999999975e-119 < x < 5.19999999999999977e-157Initial program 95.2%
remove-double-neg95.2%
distribute-frac-neg95.2%
unsub-neg95.2%
distribute-frac-neg95.2%
distribute-neg-frac295.2%
neg-sub095.4%
associate--r-95.4%
neg-sub095.5%
+-commutative95.5%
fma-define95.5%
*-commutative95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in z around 0 65.1%
Taylor expanded in x around 0 51.8%
*-commutative51.8%
Simplified51.8%
metadata-eval51.8%
distribute-rgt-neg-in51.8%
metadata-eval51.9%
div-inv52.0%
distribute-neg-frac252.0%
metadata-eval52.0%
Applied egg-rr52.0%
(FPCore (x y z) :precision binary64 (if (<= x -3.8e-119) x (if (<= x 1.3e-156) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.8e-119) {
tmp = x;
} else if (x <= 1.3e-156) {
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.8d-119)) then
tmp = x
else if (x <= 1.3d-156) 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.8e-119) {
tmp = x;
} else if (x <= 1.3e-156) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.8e-119: tmp = x elif x <= 1.3e-156: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.8e-119) tmp = x; elseif (x <= 1.3e-156) 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.8e-119) tmp = x; elseif (x <= 1.3e-156) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.8e-119], x, If[LessEqual[x, 1.3e-156], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-119}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-156}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.79999999999999975e-119 or 1.3e-156 < x Initial program 97.6%
Taylor expanded in x around inf 81.3%
if -3.79999999999999975e-119 < x < 1.3e-156Initial program 95.2%
remove-double-neg95.2%
distribute-frac-neg95.2%
unsub-neg95.2%
distribute-frac-neg95.2%
distribute-neg-frac295.2%
neg-sub095.4%
associate--r-95.4%
neg-sub095.5%
+-commutative95.5%
fma-define95.5%
*-commutative95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in z around 0 65.1%
Taylor expanded in x around 0 51.8%
*-commutative51.8%
Simplified51.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.0%
Taylor expanded in x around inf 67.4%
(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 2024091
(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)))))