
(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 9 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 89.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (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 simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (* (exp z) 1.1283791670955126) (* x y)))) (if (<= (+ x (/ y t_0)) 3e+157) (+ x (/ 1.0 (/ t_0 y))) (+ x (/ -1.0 x)))))
double code(double x, double y, double z) {
double t_0 = (exp(z) * 1.1283791670955126) - (x * y);
double tmp;
if ((x + (y / t_0)) <= 3e+157) {
tmp = x + (1.0 / (t_0 / y));
} 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 = (exp(z) * 1.1283791670955126d0) - (x * y)
if ((x + (y / t_0)) <= 3d+157) then
tmp = x + (1.0d0 / (t_0 / y))
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 = (Math.exp(z) * 1.1283791670955126) - (x * y);
double tmp;
if ((x + (y / t_0)) <= 3e+157) {
tmp = x + (1.0 / (t_0 / y));
} else {
tmp = x + (-1.0 / x);
}
return tmp;
}
def code(x, y, z): t_0 = (math.exp(z) * 1.1283791670955126) - (x * y) tmp = 0 if (x + (y / t_0)) <= 3e+157: tmp = x + (1.0 / (t_0 / y)) else: tmp = x + (-1.0 / x) return tmp
function code(x, y, z) t_0 = Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y)) tmp = 0.0 if (Float64(x + Float64(y / t_0)) <= 3e+157) tmp = Float64(x + Float64(1.0 / Float64(t_0 / y))); else tmp = Float64(x + Float64(-1.0 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (exp(z) * 1.1283791670955126) - (x * y); tmp = 0.0; if ((x + (y / t_0)) <= 3e+157) tmp = x + (1.0 / (t_0 / y)); else tmp = x + (-1.0 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x + N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], 3e+157], N[(x + N[(1.0 / N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{z} \cdot 1.1283791670955126 - x \cdot y\\
\mathbf{if}\;x + \frac{y}{t\_0} \leq 3 \cdot 10^{+157}:\\
\;\;\;\;x + \frac{1}{\frac{t\_0}{y}}\\
\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)))) < 3.0000000000000001e157Initial program 98.9%
clear-num98.9%
inv-pow98.9%
Applied egg-rr98.9%
unpow-198.9%
*-commutative98.9%
Simplified98.9%
if 3.0000000000000001e157 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 79.8%
Taylor expanded in y around inf 100.0%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))) (if (<= t_0 3e+157) 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 <= 3e+157) {
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 <= 3d+157) 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 <= 3e+157) {
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 <= 3e+157: 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 <= 3e+157) 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 <= 3e+157) 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, 3e+157], 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 3 \cdot 10^{+157}:\\
\;\;\;\;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)))) < 3.0000000000000001e157Initial program 98.9%
if 3.0000000000000001e157 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 79.8%
Taylor expanded in y around inf 100.0%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(if (<= (exp z) 0.0)
(+ x (/ -1.0 x))
(if (<= (exp z) 1.0000001)
(+ x (/ y (- 1.1283791670955126 (+ (* x y) (* z -1.1283791670955126)))))
x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (exp(z) <= 1.0000001) {
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 (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 1.0000001d0) 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 (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 1.0000001) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) elif math.exp(z) <= 1.0000001: tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (exp(z) <= 1.0000001) 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 (exp(z) <= 0.0) tmp = x + (-1.0 / x); elseif (exp(z) <= 1.0000001) tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 1.0000001], 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}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 1.0000001:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot -1.1283791670955126\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 89.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 1.00000010000000006Initial 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 1.00000010000000006 < (exp.f64 z) Initial program 90.2%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -1.2e-32)
x
(if (<= x -2.32e-206)
(/ -1.0 x)
(if (<= x 1.26e-161)
(- x (* y -0.8862269254527579))
(if (<= x 3.5e-39) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.2e-32) {
tmp = x;
} else if (x <= -2.32e-206) {
tmp = -1.0 / x;
} else if (x <= 1.26e-161) {
tmp = x - (y * -0.8862269254527579);
} else if (x <= 3.5e-39) {
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 <= (-1.2d-32)) then
tmp = x
else if (x <= (-2.32d-206)) then
tmp = (-1.0d0) / x
else if (x <= 1.26d-161) then
tmp = x - (y * (-0.8862269254527579d0))
else if (x <= 3.5d-39) 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 <= -1.2e-32) {
tmp = x;
} else if (x <= -2.32e-206) {
tmp = -1.0 / x;
} else if (x <= 1.26e-161) {
tmp = x - (y * -0.8862269254527579);
} else if (x <= 3.5e-39) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.2e-32: tmp = x elif x <= -2.32e-206: tmp = -1.0 / x elif x <= 1.26e-161: tmp = x - (y * -0.8862269254527579) elif x <= 3.5e-39: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.2e-32) tmp = x; elseif (x <= -2.32e-206) tmp = Float64(-1.0 / x); elseif (x <= 1.26e-161) tmp = Float64(x - Float64(y * -0.8862269254527579)); elseif (x <= 3.5e-39) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.2e-32) tmp = x; elseif (x <= -2.32e-206) tmp = -1.0 / x; elseif (x <= 1.26e-161) tmp = x - (y * -0.8862269254527579); elseif (x <= 3.5e-39) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.2e-32], x, If[LessEqual[x, -2.32e-206], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 1.26e-161], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-39], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.32 \cdot 10^{-206}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{-161}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-39}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.2000000000000001e-32 or 3.5e-39 < x Initial program 95.9%
Taylor expanded in x around inf 96.4%
if -1.2000000000000001e-32 < x < -2.32000000000000009e-206 or 1.26e-161 < x < 3.5e-39Initial program 94.5%
remove-double-neg94.5%
distribute-frac-neg94.5%
unsub-neg94.5%
distribute-frac-neg94.5%
distribute-neg-frac294.5%
neg-sub094.7%
associate--r-94.7%
neg-sub094.7%
+-commutative94.7%
fma-define94.8%
*-commutative94.8%
distribute-rgt-neg-in94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around inf 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around 0 64.2%
if -2.32000000000000009e-206 < x < 1.26e-161Initial program 92.6%
remove-double-neg92.6%
distribute-frac-neg92.6%
unsub-neg92.6%
distribute-frac-neg92.6%
distribute-neg-frac292.6%
neg-sub092.6%
associate--r-92.6%
neg-sub092.9%
+-commutative92.9%
fma-define92.9%
*-commutative92.9%
distribute-rgt-neg-in92.9%
metadata-eval92.9%
Simplified92.9%
Taylor expanded in z around 0 52.9%
*-commutative52.9%
fma-neg52.9%
metadata-eval52.9%
Simplified52.9%
Taylor expanded in y around 0 48.0%
*-commutative48.0%
Simplified48.0%
(FPCore (x y z)
:precision binary64
(if (<= x -4.2e-37)
x
(if (<= x -2.15e-206)
(/ -1.0 x)
(if (<= x 4e-161)
(* y 0.8862269254527579)
(if (<= x 3.4e-39) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e-37) {
tmp = x;
} else if (x <= -2.15e-206) {
tmp = -1.0 / x;
} else if (x <= 4e-161) {
tmp = y * 0.8862269254527579;
} else if (x <= 3.4e-39) {
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 <= (-4.2d-37)) then
tmp = x
else if (x <= (-2.15d-206)) then
tmp = (-1.0d0) / x
else if (x <= 4d-161) then
tmp = y * 0.8862269254527579d0
else if (x <= 3.4d-39) 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 <= -4.2e-37) {
tmp = x;
} else if (x <= -2.15e-206) {
tmp = -1.0 / x;
} else if (x <= 4e-161) {
tmp = y * 0.8862269254527579;
} else if (x <= 3.4e-39) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.2e-37: tmp = x elif x <= -2.15e-206: tmp = -1.0 / x elif x <= 4e-161: tmp = y * 0.8862269254527579 elif x <= 3.4e-39: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.2e-37) tmp = x; elseif (x <= -2.15e-206) tmp = Float64(-1.0 / x); elseif (x <= 4e-161) tmp = Float64(y * 0.8862269254527579); elseif (x <= 3.4e-39) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.2e-37) tmp = x; elseif (x <= -2.15e-206) tmp = -1.0 / x; elseif (x <= 4e-161) tmp = y * 0.8862269254527579; elseif (x <= 3.4e-39) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.2e-37], x, If[LessEqual[x, -2.15e-206], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 4e-161], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 3.4e-39], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-37}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-206}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-161}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-39}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.2000000000000002e-37 or 3.3999999999999999e-39 < x Initial program 95.9%
Taylor expanded in x around inf 96.4%
if -4.2000000000000002e-37 < x < -2.15000000000000012e-206 or 4.00000000000000011e-161 < x < 3.3999999999999999e-39Initial program 94.5%
remove-double-neg94.5%
distribute-frac-neg94.5%
unsub-neg94.5%
distribute-frac-neg94.5%
distribute-neg-frac294.5%
neg-sub094.7%
associate--r-94.7%
neg-sub094.7%
+-commutative94.7%
fma-define94.8%
*-commutative94.8%
distribute-rgt-neg-in94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around inf 59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around 0 64.2%
if -2.15000000000000012e-206 < x < 4.00000000000000011e-161Initial program 92.6%
remove-double-neg92.6%
distribute-frac-neg92.6%
unsub-neg92.6%
distribute-frac-neg92.6%
distribute-neg-frac292.6%
neg-sub092.6%
associate--r-92.6%
neg-sub092.9%
+-commutative92.9%
fma-define92.9%
*-commutative92.9%
distribute-rgt-neg-in92.9%
metadata-eval92.9%
Simplified92.9%
Taylor expanded in z around 0 52.9%
*-commutative52.9%
fma-neg52.9%
metadata-eval52.9%
Simplified52.9%
Taylor expanded in x around 0 43.2%
*-commutative43.2%
Simplified43.2%
(FPCore (x y z) :precision binary64 (if (<= z -8700000000000.0) (+ x (/ -1.0 x)) (if (<= z 1.35e-7) (+ x (/ 1.0 (- (/ 1.1283791670955126 y) x))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -8700000000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 1.35e-7) {
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 <= (-8700000000000.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 1.35d-7) 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 <= -8700000000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 1.35e-7) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8700000000000.0: tmp = x + (-1.0 / x) elif z <= 1.35e-7: tmp = x + (1.0 / ((1.1283791670955126 / y) - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8700000000000.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 1.35e-7) 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 <= -8700000000000.0) tmp = x + (-1.0 / x); elseif (z <= 1.35e-7) tmp = x + (1.0 / ((1.1283791670955126 / y) - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8700000000000.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e-7], 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 -8700000000000:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-7}:\\
\;\;\;\;x + \frac{1}{\frac{1.1283791670955126}{y} - x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.7e12Initial program 89.4%
Taylor expanded in y around inf 100.0%
if -8.7e12 < z < 1.35000000000000004e-7Initial program 99.8%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 99.3%
Taylor expanded in y around inf 99.3%
mul-1-neg99.3%
associate-*r/99.3%
metadata-eval99.3%
+-commutative99.3%
sub-neg99.3%
Simplified99.3%
if 1.35000000000000004e-7 < z Initial program 90.2%
Taylor expanded in x around inf 100.0%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= z -7.6e-202) (+ x (/ -1.0 x)) (if (<= z 2.8e-8) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.6e-202) {
tmp = x + (-1.0 / x);
} else if (z <= 2.8e-8) {
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 <= (-7.6d-202)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 2.8d-8) 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 <= -7.6e-202) {
tmp = x + (-1.0 / x);
} else if (z <= 2.8e-8) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.6e-202: tmp = x + (-1.0 / x) elif z <= 2.8e-8: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.6e-202) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 2.8e-8) 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 <= -7.6e-202) tmp = x + (-1.0 / x); elseif (z <= 2.8e-8) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.6e-202], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e-8], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-202}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-8}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.60000000000000028e-202Initial program 93.5%
Taylor expanded in y around inf 92.4%
if -7.60000000000000028e-202 < z < 2.7999999999999999e-8Initial 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.4%
*-commutative99.4%
fma-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 73.9%
*-commutative73.9%
Simplified73.9%
if 2.7999999999999999e-8 < z Initial program 90.2%
Taylor expanded in x around inf 100.0%
Final simplification87.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.9%
Taylor expanded in x around inf 66.8%
(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 2024137
(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)))))