
(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.96) (+ 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.96) {
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.96) 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.96], 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.96:\\
\;\;\;\;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.95999999999999996Initial program 94.3%
Taylor expanded in y around inf 100.0%
if 0.95999999999999996 < (exp.f64 z) Initial program 97.7%
remove-double-neg97.7%
distribute-frac-neg97.7%
unsub-neg97.7%
distribute-frac-neg97.7%
distribute-neg-frac297.7%
neg-sub097.7%
associate--r-97.7%
neg-sub097.7%
+-commutative97.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
(if (<= (exp z) 0.96)
(+ x (/ -1.0 x))
(if (<= (exp z) 2.0)
(-
x
(/
y
(-
(+
(* x y)
(*
z
(-
(* z (- (* z -0.18806319451591877) 0.5641895835477563))
1.1283791670955126)))
1.1283791670955126)))
x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.96) {
tmp = x + (-1.0 / x);
} else if (exp(z) <= 2.0) {
tmp = x - (y / (((x * y) + (z * ((z * ((z * -0.18806319451591877) - 0.5641895835477563)) - 1.1283791670955126))) - 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 (exp(z) <= 0.96d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 2.0d0) then
tmp = x - (y / (((x * y) + (z * ((z * ((z * (-0.18806319451591877d0)) - 0.5641895835477563d0)) - 1.1283791670955126d0))) - 1.1283791670955126d0))
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.96) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 2.0) {
tmp = x - (y / (((x * y) + (z * ((z * ((z * -0.18806319451591877) - 0.5641895835477563)) - 1.1283791670955126))) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.96: tmp = x + (-1.0 / x) elif math.exp(z) <= 2.0: tmp = x - (y / (((x * y) + (z * ((z * ((z * -0.18806319451591877) - 0.5641895835477563)) - 1.1283791670955126))) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.96) tmp = Float64(x + Float64(-1.0 / x)); elseif (exp(z) <= 2.0) tmp = Float64(x - Float64(y / Float64(Float64(Float64(x * y) + Float64(z * Float64(Float64(z * Float64(Float64(z * -0.18806319451591877) - 0.5641895835477563)) - 1.1283791670955126))) - 1.1283791670955126))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.96) tmp = x + (-1.0 / x); elseif (exp(z) <= 2.0) tmp = x - (y / (((x * y) + (z * ((z * ((z * -0.18806319451591877) - 0.5641895835477563)) - 1.1283791670955126))) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.96], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 2.0], N[(x - N[(y / N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(N[(z * N[(N[(z * -0.18806319451591877), $MachinePrecision] - 0.5641895835477563), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0.96:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 2:\\
\;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot \left(z \cdot \left(z \cdot -0.18806319451591877 - 0.5641895835477563\right) - 1.1283791670955126\right)\right) - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.95999999999999996Initial program 94.3%
Taylor expanded in y around inf 100.0%
if 0.95999999999999996 < (exp.f64 z) < 2Initial 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.6%
if 2 < (exp.f64 z) Initial program 92.3%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))) (if (<= t_0 2e+222) t_0 (+ x (/ -1.0 x)))))
double code(double x, double y, double z) {
double t_0 = x + (y / ((exp(z) * 1.1283791670955126) - (x * y)));
double tmp;
if (t_0 <= 2e+222) {
tmp = t_0;
} else {
tmp = x + (-1.0 / 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 + (y / ((exp(z) * 1.1283791670955126d0) - (x * y)))
if (t_0 <= 2d+222) then
tmp = t_0
else
tmp = x + ((-1.0d0) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y / ((Math.exp(z) * 1.1283791670955126) - (x * y)));
double tmp;
if (t_0 <= 2e+222) {
tmp = t_0;
} else {
tmp = x + (-1.0 / x);
}
return tmp;
}
def code(x, y, z): t_0 = x + (y / ((math.exp(z) * 1.1283791670955126) - (x * y))) tmp = 0 if t_0 <= 2e+222: tmp = t_0 else: tmp = x + (-1.0 / x) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y / Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y)))) tmp = 0.0 if (t_0 <= 2e+222) tmp = t_0; else tmp = Float64(x + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y / ((exp(z) * 1.1283791670955126) - (x * y))); tmp = 0.0; if (t_0 <= 2e+222) tmp = t_0; else tmp = x + (-1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y / N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+222], t$95$0, N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+222}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{x}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 2.0000000000000001e222Initial program 99.0%
if 2.0000000000000001e222 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 74.1%
Taylor expanded in y around inf 100.0%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(if (<= z -0.044)
(+ x (/ -1.0 x))
(if (<= z 7.2)
(-
x
(/
y
(-
(+ (* x y) (* z (- (* z -0.5641895835477563) 1.1283791670955126)))
1.1283791670955126)))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 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 <= (-0.044d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 7.2d0) then
tmp = x - (y / (((x * y) + (z * ((z * (-0.5641895835477563d0)) - 1.1283791670955126d0))) - 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 <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.044: tmp = x + (-1.0 / x) elif z <= 7.2: tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.044) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 7.2) tmp = Float64(x - Float64(y / Float64(Float64(Float64(x * y) + Float64(z * Float64(Float64(z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.044) tmp = x + (-1.0 / x); elseif (z <= 7.2) tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.044], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2], N[(x - N[(y / N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(N[(z * -0.5641895835477563), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.044:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 7.2:\\
\;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot \left(z \cdot -0.5641895835477563 - 1.1283791670955126\right)\right) - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.043999999999999997Initial program 94.3%
Taylor expanded in y around inf 100.0%
if -0.043999999999999997 < z < 7.20000000000000018Initial 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.4%
if 7.20000000000000018 < z Initial program 92.3%
Taylor expanded in x around inf 100.0%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<= x -0.35)
x
(if (<= x -1.16e-177)
(/ -1.0 x)
(if (<= x 8.8e-219)
(* y 0.8862269254527579)
(if (<= x 1.22e-23) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.35) {
tmp = x;
} else if (x <= -1.16e-177) {
tmp = -1.0 / x;
} else if (x <= 8.8e-219) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.22e-23) {
tmp = -1.0 / 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 (x <= (-0.35d0)) then
tmp = x
else if (x <= (-1.16d-177)) then
tmp = (-1.0d0) / x
else if (x <= 8.8d-219) then
tmp = y * 0.8862269254527579d0
else if (x <= 1.22d-23) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.35) {
tmp = x;
} else if (x <= -1.16e-177) {
tmp = -1.0 / x;
} else if (x <= 8.8e-219) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.22e-23) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.35: tmp = x elif x <= -1.16e-177: tmp = -1.0 / x elif x <= 8.8e-219: tmp = y * 0.8862269254527579 elif x <= 1.22e-23: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.35) tmp = x; elseif (x <= -1.16e-177) tmp = Float64(-1.0 / x); elseif (x <= 8.8e-219) tmp = Float64(y * 0.8862269254527579); elseif (x <= 1.22e-23) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.35) tmp = x; elseif (x <= -1.16e-177) tmp = -1.0 / x; elseif (x <= 8.8e-219) tmp = y * 0.8862269254527579; elseif (x <= 1.22e-23) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.35], x, If[LessEqual[x, -1.16e-177], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 8.8e-219], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 1.22e-23], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.35:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.16 \cdot 10^{-177}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-219}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-23}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.34999999999999998 or 1.22000000000000007e-23 < x Initial program 96.8%
Taylor expanded in x around inf 97.0%
if -0.34999999999999998 < x < -1.1599999999999999e-177 or 8.7999999999999998e-219 < x < 1.22000000000000007e-23Initial program 97.2%
remove-double-neg97.2%
distribute-frac-neg97.2%
unsub-neg97.2%
distribute-frac-neg97.2%
distribute-neg-frac297.2%
neg-sub097.1%
associate--r-97.1%
neg-sub097.2%
+-commutative97.2%
fma-define97.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
metadata-eval97.2%
Simplified97.2%
Taylor expanded in x around inf 57.5%
*-commutative57.5%
Simplified57.5%
Taylor expanded in x around 0 59.4%
if -1.1599999999999999e-177 < x < 8.7999999999999998e-219Initial program 95.8%
Taylor expanded in x around 0 59.5%
Taylor expanded in z around 0 56.1%
*-commutative56.1%
Simplified56.1%
(FPCore (x y z)
:precision binary64
(if (<= z -0.044)
(+ x (/ -1.0 x))
(if (<= z 7.2)
(- x (/ y (- (+ (* x y) (* z -1.1283791670955126)) 1.1283791670955126)))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / (((x * y) + (z * -1.1283791670955126)) - 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 <= (-0.044d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 7.2d0) then
tmp = x - (y / (((x * y) + (z * (-1.1283791670955126d0))) - 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 <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / (((x * y) + (z * -1.1283791670955126)) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.044: tmp = x + (-1.0 / x) elif z <= 7.2: tmp = x - (y / (((x * y) + (z * -1.1283791670955126)) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.044) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 7.2) tmp = Float64(x - Float64(y / Float64(Float64(Float64(x * y) + Float64(z * -1.1283791670955126)) - 1.1283791670955126))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.044) tmp = x + (-1.0 / x); elseif (z <= 7.2) tmp = x - (y / (((x * y) + (z * -1.1283791670955126)) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.044], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2], N[(x - N[(y / N[(N[(N[(x * y), $MachinePrecision] + N[(z * -1.1283791670955126), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.044:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 7.2:\\
\;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot -1.1283791670955126\right) - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.043999999999999997Initial program 94.3%
Taylor expanded in y around inf 100.0%
if -0.043999999999999997 < z < 7.20000000000000018Initial 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 98.8%
if 7.20000000000000018 < z Initial program 92.3%
Taylor expanded in x around inf 100.0%
Final simplification99.4%
(FPCore (x y z)
:precision binary64
(if (<= z -2.65e+184)
x
(if (<= z -3.9e-21)
(/ -1.0 x)
(if (<= z 0.47) (- x (* y -0.8862269254527579)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.65e+184) {
tmp = x;
} else if (z <= -3.9e-21) {
tmp = -1.0 / x;
} else if (z <= 0.47) {
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 <= (-2.65d+184)) then
tmp = x
else if (z <= (-3.9d-21)) then
tmp = (-1.0d0) / x
else if (z <= 0.47d0) 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 <= -2.65e+184) {
tmp = x;
} else if (z <= -3.9e-21) {
tmp = -1.0 / x;
} else if (z <= 0.47) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.65e+184: tmp = x elif z <= -3.9e-21: tmp = -1.0 / x elif z <= 0.47: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.65e+184) tmp = x; elseif (z <= -3.9e-21) tmp = Float64(-1.0 / x); elseif (z <= 0.47) 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 <= -2.65e+184) tmp = x; elseif (z <= -3.9e-21) tmp = -1.0 / x; elseif (z <= 0.47) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.65e+184], x, If[LessEqual[z, -3.9e-21], N[(-1.0 / x), $MachinePrecision], If[LessEqual[z, 0.47], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{+184}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-21}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.47:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.65000000000000011e184 or 0.46999999999999997 < z Initial program 93.8%
Taylor expanded in x around inf 86.6%
if -2.65000000000000011e184 < z < -3.9000000000000001e-21Initial 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.0%
+-commutative94.0%
fma-define94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
metadata-eval94.0%
Simplified94.0%
Taylor expanded in x around inf 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in x around 0 66.7%
if -3.9000000000000001e-21 < z < 0.46999999999999997Initial 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 98.5%
Taylor expanded in y around 0 77.3%
*-commutative77.3%
Simplified77.3%
(FPCore (x y z) :precision binary64 (if (<= z -0.044) (+ x (/ -1.0 x)) (if (<= z 7.2) (- x (/ y (- (* x y) 1.1283791670955126))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / ((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 <= (-0.044d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 7.2d0) then
tmp = x - (y / ((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 <= -0.044) {
tmp = x + (-1.0 / x);
} else if (z <= 7.2) {
tmp = x - (y / ((x * y) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.044: tmp = x + (-1.0 / x) elif z <= 7.2: tmp = x - (y / ((x * y) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.044) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 7.2) tmp = Float64(x - Float64(y / Float64(Float64(x * y) - 1.1283791670955126))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.044) tmp = x + (-1.0 / x); elseif (z <= 7.2) tmp = x - (y / ((x * y) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.044], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2], N[(x - N[(y / N[(N[(x * y), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.044:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 7.2:\\
\;\;\;\;x - \frac{y}{x \cdot y - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.043999999999999997Initial program 94.3%
Taylor expanded in y around inf 100.0%
if -0.043999999999999997 < z < 7.20000000000000018Initial 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 98.1%
if 7.20000000000000018 < z Initial program 92.3%
Taylor expanded in x around inf 100.0%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= z -4.8e-25) (+ x (/ -1.0 x)) (if (<= z 0.34) (- x (/ y -1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.8e-25) {
tmp = x + (-1.0 / x);
} else if (z <= 0.34) {
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 <= (-4.8d-25)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.34d0) 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 <= -4.8e-25) {
tmp = x + (-1.0 / x);
} else if (z <= 0.34) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.8e-25: tmp = x + (-1.0 / x) elif z <= 0.34: tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.8e-25) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.34) 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 <= -4.8e-25) tmp = x + (-1.0 / x); elseif (z <= 0.34) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.8e-25], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.34], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-25}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.34:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.80000000000000018e-25Initial program 94.7%
Taylor expanded in y around inf 97.7%
if -4.80000000000000018e-25 < z < 0.340000000000000024Initial 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 98.5%
Taylor expanded in x around 0 77.4%
if 0.340000000000000024 < z Initial program 92.5%
Taylor expanded in x around inf 98.1%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= z -3e-48) (+ x (/ -1.0 x)) (if (<= z 0.23) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -3e-48) {
tmp = x + (-1.0 / x);
} else if (z <= 0.23) {
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 <= (-3d-48)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.23d0) 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 <= -3e-48) {
tmp = x + (-1.0 / x);
} else if (z <= 0.23) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3e-48: tmp = x + (-1.0 / x) elif z <= 0.23: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3e-48) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.23) 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 <= -3e-48) tmp = x + (-1.0 / x); elseif (z <= 0.23) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3e-48], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.23], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{-48}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.23:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.9999999999999999e-48Initial program 95.1%
Taylor expanded in y around inf 95.6%
if -2.9999999999999999e-48 < z < 0.23000000000000001Initial 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 98.4%
Taylor expanded in y around 0 77.6%
*-commutative77.6%
Simplified77.6%
if 0.23000000000000001 < z Initial program 92.5%
Taylor expanded in x around inf 98.1%
Final simplification88.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.06e-213) x (if (<= x 6.5e-218) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.06e-213) {
tmp = x;
} else if (x <= 6.5e-218) {
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 <= (-1.06d-213)) then
tmp = x
else if (x <= 6.5d-218) 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 <= -1.06e-213) {
tmp = x;
} else if (x <= 6.5e-218) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.06e-213: tmp = x elif x <= 6.5e-218: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.06e-213) tmp = x; elseif (x <= 6.5e-218) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.06e-213) tmp = x; elseif (x <= 6.5e-218) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.06e-213], x, If[LessEqual[x, 6.5e-218], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{-213}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-218}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.06000000000000001e-213 or 6.49999999999999983e-218 < x Initial program 97.1%
Taylor expanded in x around inf 69.2%
if -1.06000000000000001e-213 < x < 6.49999999999999983e-218Initial program 94.6%
Taylor expanded in x around 0 65.2%
Taylor expanded in z around 0 62.5%
*-commutative62.5%
Simplified62.5%
(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 96.7%
Taylor expanded in x around inf 62.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 2024141
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ 1 (- (* (/ 5641895835477563/5000000000000000 y) (exp z)) x))))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))