
(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 13 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 84.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.4%
remove-double-neg98.4%
distribute-frac-neg98.4%
unsub-neg98.4%
distribute-frac-neg98.4%
distribute-neg-frac298.4%
neg-sub098.4%
associate--r-98.4%
neg-sub098.4%
+-commutative98.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))
(if (<= (exp z) 10.0)
(+
x
(/
y
(+
1.1283791670955126
(-
(*
z
(+
1.1283791670955126
(* z (- 0.5641895835477563 (* z -0.18806319451591877)))))
(* 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) <= 10.0) {
tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 + (z * (0.5641895835477563 - (z * -0.18806319451591877))))) - (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) <= 10.0d0) then
tmp = x + (y / (1.1283791670955126d0 + ((z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 - (z * (-0.18806319451591877d0)))))) - (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) <= 10.0) {
tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 + (z * (0.5641895835477563 - (z * -0.18806319451591877))))) - (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) <= 10.0: tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 + (z * (0.5641895835477563 - (z * -0.18806319451591877))))) - (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) <= 10.0) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 + Float64(Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 - Float64(z * -0.18806319451591877))))) - 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) <= 10.0) tmp = x + (y / (1.1283791670955126 + ((z * (1.1283791670955126 + (z * (0.5641895835477563 - (z * -0.18806319451591877))))) - (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], 10.0], N[(x + N[(y / N[(1.1283791670955126 + N[(N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 - N[(z * -0.18806319451591877), $MachinePrecision]), $MachinePrecision]), $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 10:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 + \left(z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 - z \cdot -0.18806319451591877\right)\right) - x \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 84.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 10Initial 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 10 < (exp.f64 z) Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification99.6%
(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 84.9%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.4%
Final simplification98.8%
(FPCore (x y z)
:precision binary64
(if (<= z -2.1e+17)
(+ x (/ -1.0 x))
(if (<= z 92.0)
(+
x
(/
y
(-
1.1283791670955126
(+ (* x y) (* z (- (* z -0.5641895835477563) 1.1283791670955126))))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 92.0) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * ((z * -0.5641895835477563) - 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.1d+17)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 92.0d0) then
tmp = x + (y / (1.1283791670955126d0 - ((x * y) + (z * ((z * (-0.5641895835477563d0)) - 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.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 92.0) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126)))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e+17: tmp = x + (-1.0 / x) elif z <= 92.0: tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e+17) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 92.0) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(Float64(x * y) + Float64(z * Float64(Float64(z * -0.5641895835477563) - 1.1283791670955126)))))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.1e+17) tmp = x + (-1.0 / x); elseif (z <= 92.0) tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e+17], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 92.0], N[(x + N[(y / N[(1.1283791670955126 - N[(N[(x * y), $MachinePrecision] + N[(z * N[(N[(z * -0.5641895835477563), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+17}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 92:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot \left(z \cdot -0.5641895835477563 - 1.1283791670955126\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.1e17Initial program 84.0%
Taylor expanded in y around inf 100.0%
if -2.1e17 < z < 92Initial 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 92 < z Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (<= x -5.8e-99)
x
(if (<= x -5.8e-126)
(/ -1.0 x)
(if (<= x 4.5e-268)
(/ y 1.1283791670955126)
(if (<= x 5.9e-182) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.8e-99) {
tmp = x;
} else if (x <= -5.8e-126) {
tmp = -1.0 / x;
} else if (x <= 4.5e-268) {
tmp = y / 1.1283791670955126;
} else if (x <= 5.9e-182) {
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 <= (-5.8d-99)) then
tmp = x
else if (x <= (-5.8d-126)) then
tmp = (-1.0d0) / x
else if (x <= 4.5d-268) then
tmp = y / 1.1283791670955126d0
else if (x <= 5.9d-182) 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 <= -5.8e-99) {
tmp = x;
} else if (x <= -5.8e-126) {
tmp = -1.0 / x;
} else if (x <= 4.5e-268) {
tmp = y / 1.1283791670955126;
} else if (x <= 5.9e-182) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.8e-99: tmp = x elif x <= -5.8e-126: tmp = -1.0 / x elif x <= 4.5e-268: tmp = y / 1.1283791670955126 elif x <= 5.9e-182: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.8e-99) tmp = x; elseif (x <= -5.8e-126) tmp = Float64(-1.0 / x); elseif (x <= 4.5e-268) tmp = Float64(y / 1.1283791670955126); elseif (x <= 5.9e-182) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.8e-99) tmp = x; elseif (x <= -5.8e-126) tmp = -1.0 / x; elseif (x <= 4.5e-268) tmp = y / 1.1283791670955126; elseif (x <= 5.9e-182) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.8e-99], x, If[LessEqual[x, -5.8e-126], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 4.5e-268], N[(y / 1.1283791670955126), $MachinePrecision], If[LessEqual[x, 5.9e-182], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-126}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-268}:\\
\;\;\;\;\frac{y}{1.1283791670955126}\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{-182}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.79999999999999971e-99 or 5.89999999999999968e-182 < x Initial program 98.3%
Taylor expanded in x around inf 84.2%
if -5.79999999999999971e-99 < x < -5.79999999999999975e-126 or 4.5000000000000001e-268 < x < 5.89999999999999968e-182Initial program 79.9%
remove-double-neg79.9%
distribute-frac-neg79.9%
unsub-neg79.9%
distribute-frac-neg79.9%
distribute-neg-frac279.9%
neg-sub079.9%
associate--r-79.9%
neg-sub080.6%
+-commutative80.6%
fma-define80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
Simplified80.6%
Taylor expanded in x around inf 42.2%
*-commutative42.2%
Simplified42.2%
Taylor expanded in x around 0 61.6%
if -5.79999999999999975e-126 < x < 4.5000000000000001e-268Initial program 95.3%
remove-double-neg95.3%
distribute-frac-neg95.3%
unsub-neg95.3%
distribute-frac-neg95.3%
distribute-neg-frac295.3%
neg-sub095.3%
associate--r-95.3%
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 74.7%
Taylor expanded in z around inf 72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in x around 0 59.2%
mul-1-neg59.2%
*-commutative59.2%
fmm-def59.2%
metadata-eval59.2%
distribute-neg-frac259.2%
fma-define59.2%
distribute-lft1-in59.2%
distribute-rgt-neg-in59.2%
metadata-eval59.2%
Simplified59.2%
Taylor expanded in z around 0 58.9%
(FPCore (x y z)
:precision binary64
(if (<= x -5.2e-99)
x
(if (<= x -3.3e-134)
(/ -1.0 x)
(if (<= x 5.2e-268)
(* y 0.8862269254527579)
(if (<= x 9e-177) (/ -1.0 x) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-99) {
tmp = x;
} else if (x <= -3.3e-134) {
tmp = -1.0 / x;
} else if (x <= 5.2e-268) {
tmp = y * 0.8862269254527579;
} else if (x <= 9e-177) {
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 <= (-5.2d-99)) then
tmp = x
else if (x <= (-3.3d-134)) then
tmp = (-1.0d0) / x
else if (x <= 5.2d-268) then
tmp = y * 0.8862269254527579d0
else if (x <= 9d-177) 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 <= -5.2e-99) {
tmp = x;
} else if (x <= -3.3e-134) {
tmp = -1.0 / x;
} else if (x <= 5.2e-268) {
tmp = y * 0.8862269254527579;
} else if (x <= 9e-177) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e-99: tmp = x elif x <= -3.3e-134: tmp = -1.0 / x elif x <= 5.2e-268: tmp = y * 0.8862269254527579 elif x <= 9e-177: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e-99) tmp = x; elseif (x <= -3.3e-134) tmp = Float64(-1.0 / x); elseif (x <= 5.2e-268) tmp = Float64(y * 0.8862269254527579); elseif (x <= 9e-177) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.2e-99) tmp = x; elseif (x <= -3.3e-134) tmp = -1.0 / x; elseif (x <= 5.2e-268) tmp = y * 0.8862269254527579; elseif (x <= 9e-177) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e-99], x, If[LessEqual[x, -3.3e-134], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 5.2e-268], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 9e-177], N[(-1.0 / x), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-134}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-268}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-177}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.2000000000000001e-99 or 9.0000000000000007e-177 < x Initial program 98.3%
Taylor expanded in x around inf 84.2%
if -5.2000000000000001e-99 < x < -3.30000000000000019e-134 or 5.20000000000000005e-268 < x < 9.0000000000000007e-177Initial program 79.9%
remove-double-neg79.9%
distribute-frac-neg79.9%
unsub-neg79.9%
distribute-frac-neg79.9%
distribute-neg-frac279.9%
neg-sub079.9%
associate--r-79.9%
neg-sub080.6%
+-commutative80.6%
fma-define80.6%
*-commutative80.6%
distribute-rgt-neg-in80.6%
metadata-eval80.6%
Simplified80.6%
Taylor expanded in x around inf 42.2%
*-commutative42.2%
Simplified42.2%
Taylor expanded in x around 0 61.6%
if -3.30000000000000019e-134 < x < 5.20000000000000005e-268Initial program 95.3%
remove-double-neg95.3%
distribute-frac-neg95.3%
unsub-neg95.3%
distribute-frac-neg95.3%
distribute-neg-frac295.3%
neg-sub095.3%
associate--r-95.3%
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 71.6%
Taylor expanded in x around 0 58.7%
Final simplification77.2%
(FPCore (x y z)
:precision binary64
(if (<= z -2.1e+17)
(+ x (/ -1.0 x))
(if (<= z 270.0)
(+ x (/ y (- 1.1283791670955126 (+ (* x y) (* z -1.1283791670955126)))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 270.0) {
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 <= (-2.1d+17)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 270.0d0) 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 <= -2.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 270.0) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e+17: tmp = x + (-1.0 / x) elif z <= 270.0: 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 <= -2.1e+17) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 270.0) 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 <= -2.1e+17) tmp = x + (-1.0 / x); elseif (z <= 270.0) 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, -2.1e+17], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 270.0], 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 -2.1 \cdot 10^{+17}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 270:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot -1.1283791670955126\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.1e17Initial program 84.0%
Taylor expanded in y around inf 100.0%
if -2.1e17 < z < 270Initial 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.2%
if 270 < z Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= z -2.1e+17) (+ x (/ -1.0 x)) (if (<= z 145.0) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 145.0) {
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 <= (-2.1d+17)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 145.0d0) 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 <= -2.1e+17) {
tmp = x + (-1.0 / x);
} else if (z <= 145.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e+17: tmp = x + (-1.0 / x) elif z <= 145.0: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e+17) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 145.0) 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 <= -2.1e+17) tmp = x + (-1.0 / x); elseif (z <= 145.0) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e+17], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 145.0], 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 -2.1 \cdot 10^{+17}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 145:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.1e17Initial program 84.0%
Taylor expanded in y around inf 100.0%
if -2.1e17 < z < 145Initial 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.0%
if 145 < z Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= z -0.94) (+ x (/ -1.0 x)) (if (<= z 6.8) (+ x (* 0.8862269254527579 (/ y (+ z 1.0)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.94) {
tmp = x + (-1.0 / x);
} else if (z <= 6.8) {
tmp = x + (0.8862269254527579 * (y / (z + 1.0)));
} 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.94d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 6.8d0) then
tmp = x + (0.8862269254527579d0 * (y / (z + 1.0d0)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.94) {
tmp = x + (-1.0 / x);
} else if (z <= 6.8) {
tmp = x + (0.8862269254527579 * (y / (z + 1.0)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.94: tmp = x + (-1.0 / x) elif z <= 6.8: tmp = x + (0.8862269254527579 * (y / (z + 1.0))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.94) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 6.8) tmp = Float64(x + Float64(0.8862269254527579 * Float64(y / Float64(z + 1.0)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.94) tmp = x + (-1.0 / x); elseif (z <= 6.8) tmp = x + (0.8862269254527579 * (y / (z + 1.0))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.94], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8], N[(x + N[(0.8862269254527579 * N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.94:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 6.8:\\
\;\;\;\;x + 0.8862269254527579 \cdot \frac{y}{z + 1}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.93999999999999995Initial program 84.9%
Taylor expanded in y around inf 100.0%
if -0.93999999999999995 < z < 6.79999999999999982Initial program 99.9%
Taylor expanded in z around 0 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 78.3%
Taylor expanded in z around 0 78.1%
if 6.79999999999999982 < z Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification87.9%
(FPCore (x y z) :precision binary64 (if (<= z -0.00088) (+ x (/ -1.0 x)) (if (<= z 13.5) (- x (/ y -1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.00088) {
tmp = x + (-1.0 / x);
} else if (z <= 13.5) {
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 <= (-0.00088d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 13.5d0) 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 <= -0.00088) {
tmp = x + (-1.0 / x);
} else if (z <= 13.5) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.00088: tmp = x + (-1.0 / x) elif z <= 13.5: tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.00088) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 13.5) 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 <= -0.00088) tmp = x + (-1.0 / x); elseif (z <= 13.5) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.00088], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 13.5], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00088:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 13.5:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.80000000000000031e-4Initial program 84.9%
Taylor expanded in y around inf 100.0%
if -8.80000000000000031e-4 < z < 13.5Initial program 99.9%
remove-double-neg99.9%
distribute-frac-neg99.9%
unsub-neg99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.0%
Taylor expanded in x around 0 78.0%
if 13.5 < z Initial program 95.2%
Taylor expanded in x around inf 100.0%
Final simplification87.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.25e-142) x (if (<= x 1.8e-250) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e-142) {
tmp = x;
} else if (x <= 1.8e-250) {
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.25d-142)) then
tmp = x
else if (x <= 1.8d-250) 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.25e-142) {
tmp = x;
} else if (x <= 1.8e-250) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.25e-142: tmp = x elif x <= 1.8e-250: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.25e-142) tmp = x; elseif (x <= 1.8e-250) 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.25e-142) tmp = x; elseif (x <= 1.8e-250) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.25e-142], x, If[LessEqual[x, 1.8e-250], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-142}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-250}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.2500000000000001e-142 or 1.79999999999999991e-250 < x Initial program 97.6%
Taylor expanded in x around inf 77.9%
if -1.2500000000000001e-142 < x < 1.79999999999999991e-250Initial program 88.3%
remove-double-neg88.3%
distribute-frac-neg88.3%
unsub-neg88.3%
distribute-frac-neg88.3%
distribute-neg-frac288.3%
neg-sub088.6%
associate--r-88.6%
neg-sub088.9%
+-commutative88.9%
fma-define88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in z around 0 65.9%
Taylor expanded in x around 0 54.7%
Final simplification73.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.1e-170) (+ x (/ -1.0 x)) x))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.1e-170) {
tmp = x + (-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 (z <= 1.1d-170) then
tmp = x + ((-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 (z <= 1.1e-170) {
tmp = x + (-1.0 / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.1e-170: tmp = x + (-1.0 / x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.1e-170) tmp = Float64(x + Float64(-1.0 / x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.1e-170) tmp = x + (-1.0 / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.1e-170], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.1 \cdot 10^{-170}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < 1.10000000000000007e-170Initial program 94.9%
Taylor expanded in y around inf 75.4%
if 1.10000000000000007e-170 < z Initial program 97.0%
Taylor expanded in x around inf 87.7%
Final simplification80.1%
(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 95.7%
Taylor expanded in x around inf 66.9%
(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 2024170
(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)))))