
(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 8 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 (+ x (/ -1.0 (fma (exp z) (/ -1.1283791670955126 y) x))))
double code(double x, double y, double z) {
return x + (-1.0 / fma(exp(z), (-1.1283791670955126 / y), x));
}
function code(x, y, z) return Float64(x + Float64(-1.0 / fma(exp(z), Float64(-1.1283791670955126 / y), x))) end
code[x_, y_, z_] := N[(x + N[(-1.0 / N[(N[Exp[z], $MachinePrecision] * N[(-1.1283791670955126 / y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}
\end{array}
Initial program 97.9%
*-lft-identity97.9%
metadata-eval97.9%
times-frac97.9%
neg-mul-197.9%
sub0-neg97.9%
associate-+l-97.9%
neg-sub098.0%
+-commutative98.0%
sub-neg98.0%
associate-/l*98.0%
div-sub98.0%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))) (if (<= t_0 1e+225) 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 <= 1e+225) {
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 <= 1d+225) 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 <= 1e+225) {
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 <= 1e+225: 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 <= 1e+225) 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 <= 1e+225) 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, 1e+225], 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 10^{+225}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{x}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 y (-.f64 (*.f64 5641895835477563/5000000000000000 (exp.f64 z)) (*.f64 x y)))) < 9.99999999999999928e224Initial program 99.9%
if 9.99999999999999928e224 < (+.f64 x (/.f64 y (-.f64 (*.f64 5641895835477563/5000000000000000 (exp.f64 z)) (*.f64 x y)))) Initial program 69.2%
*-lft-identity69.2%
metadata-eval69.2%
times-frac69.2%
neg-mul-169.2%
sub0-neg69.1%
associate-+l-69.1%
neg-sub069.5%
+-commutative69.5%
sub-neg69.5%
associate-/l*69.5%
div-sub69.5%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (if (<= (exp z) 2.0) (- x (/ 1.0 (+ x (/ -1.1283791670955126 y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (exp(z) <= 2.0) {
tmp = x - (1.0 / (x + (-1.1283791670955126 / y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 2.0d0) then
tmp = x - (1.0d0 / (x + ((-1.1283791670955126d0) / y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 2.0) {
tmp = x - (1.0 / (x + (-1.1283791670955126 / y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) elif math.exp(z) <= 2.0: tmp = x - (1.0 / (x + (-1.1283791670955126 / y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (exp(z) <= 2.0) tmp = Float64(x - Float64(1.0 / Float64(x + Float64(-1.1283791670955126 / y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); elseif (exp(z) <= 2.0) tmp = x - (1.0 / (x + (-1.1283791670955126 / y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 2.0], N[(x - N[(1.0 / N[(x + N[(-1.1283791670955126 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 2:\\
\;\;\;\;x - \frac{1}{x + \frac{-1.1283791670955126}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 96.6%
*-lft-identity96.6%
metadata-eval96.6%
times-frac96.6%
neg-mul-196.6%
sub0-neg96.6%
associate-+l-96.6%
neg-sub096.7%
+-commutative96.7%
sub-neg96.7%
associate-/l*96.7%
div-sub96.7%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) < 2Initial program 99.8%
*-lft-identity99.8%
metadata-eval99.8%
times-frac99.8%
neg-mul-199.8%
sub0-neg99.8%
associate-+l-99.8%
neg-sub099.8%
+-commutative99.8%
sub-neg99.8%
associate-/l*99.8%
div-sub99.8%
associate-*r/99.8%
*-inverses99.8%
*-rgt-identity99.8%
associate-*l/99.8%
cancel-sign-sub-inv99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
associate-*l/99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in z around 0 99.0%
cancel-sign-sub-inv99.0%
metadata-eval99.0%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
if 2 < (exp.f64 z) Initial program 95.4%
*-lft-identity95.4%
metadata-eval95.4%
times-frac95.4%
neg-mul-195.4%
sub0-neg95.4%
associate-+l-95.4%
neg-sub095.4%
+-commutative95.4%
sub-neg95.4%
associate-/l*95.4%
div-sub95.4%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(if (<= z -2.9e+232)
x
(if (<= z -2.85e+187)
(/ -1.0 x)
(if (<= z -3.8e-19)
x
(if (<= z 6.6e-134) (+ x (/ y 1.1283791670955126)) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e+232) {
tmp = x;
} else if (z <= -2.85e+187) {
tmp = -1.0 / x;
} else if (z <= -3.8e-19) {
tmp = x;
} else if (z <= 6.6e-134) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.9d+232)) then
tmp = x
else if (z <= (-2.85d+187)) then
tmp = (-1.0d0) / x
else if (z <= (-3.8d-19)) then
tmp = x
else if (z <= 6.6d-134) then
tmp = x + (y / 1.1283791670955126d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e+232) {
tmp = x;
} else if (z <= -2.85e+187) {
tmp = -1.0 / x;
} else if (z <= -3.8e-19) {
tmp = x;
} else if (z <= 6.6e-134) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.9e+232: tmp = x elif z <= -2.85e+187: tmp = -1.0 / x elif z <= -3.8e-19: tmp = x elif z <= 6.6e-134: tmp = x + (y / 1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.9e+232) tmp = x; elseif (z <= -2.85e+187) tmp = Float64(-1.0 / x); elseif (z <= -3.8e-19) tmp = x; elseif (z <= 6.6e-134) tmp = Float64(x + Float64(y / 1.1283791670955126)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.9e+232) tmp = x; elseif (z <= -2.85e+187) tmp = -1.0 / x; elseif (z <= -3.8e-19) tmp = x; elseif (z <= 6.6e-134) tmp = x + (y / 1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.9e+232], x, If[LessEqual[z, -2.85e+187], N[(-1.0 / x), $MachinePrecision], If[LessEqual[z, -3.8e-19], x, If[LessEqual[z, 6.6e-134], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+232}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{+187}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-134}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.90000000000000023e232 or -2.8500000000000002e187 < z < -3.8e-19 or 6.60000000000000038e-134 < z Initial program 97.4%
*-lft-identity97.4%
metadata-eval97.4%
times-frac97.4%
neg-mul-197.4%
sub0-neg97.4%
associate-+l-97.4%
neg-sub097.4%
+-commutative97.4%
sub-neg97.4%
associate-/l*97.5%
div-sub97.5%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 77.9%
if -2.90000000000000023e232 < z < -2.8500000000000002e187Initial program 88.7%
*-lft-identity88.7%
metadata-eval88.7%
times-frac88.7%
neg-mul-188.7%
sub0-neg89.3%
associate-+l-89.3%
neg-sub089.3%
+-commutative89.3%
sub-neg89.3%
associate-/l*89.1%
div-sub89.1%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around 0 78.1%
if -3.8e-19 < z < 6.60000000000000038e-134Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 83.5%
Final simplification79.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))))
(if (<= z -1.38e-14)
t_0
(if (<= z 1.9e-94)
(+ x (/ y (+ 1.1283791670955126 (* z 1.1283791670955126))))
(if (<= z 0.00049) t_0 x)))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.38e-14) {
tmp = t_0;
} else if (z <= 1.9e-94) {
tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126)));
} else if (z <= 0.00049) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
if (z <= (-1.38d-14)) then
tmp = t_0
else if (z <= 1.9d-94) then
tmp = x + (y / (1.1283791670955126d0 + (z * 1.1283791670955126d0)))
else if (z <= 0.00049d0) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.38e-14) {
tmp = t_0;
} else if (z <= 1.9e-94) {
tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126)));
} else if (z <= 0.00049) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) tmp = 0 if z <= -1.38e-14: tmp = t_0 elif z <= 1.9e-94: tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126))) elif z <= 0.00049: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) tmp = 0.0 if (z <= -1.38e-14) tmp = t_0; elseif (z <= 1.9e-94) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 + Float64(z * 1.1283791670955126)))); elseif (z <= 0.00049) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); tmp = 0.0; if (z <= -1.38e-14) tmp = t_0; elseif (z <= 1.9e-94) tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126))); elseif (z <= 0.00049) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.38e-14], t$95$0, If[LessEqual[z, 1.9e-94], N[(x + N[(y / N[(1.1283791670955126 + N[(z * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00049], t$95$0, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
\mathbf{if}\;z \leq -1.38 \cdot 10^{-14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-94}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 + z \cdot 1.1283791670955126}\\
\mathbf{elif}\;z \leq 0.00049:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.38000000000000002e-14 or 1.9e-94 < z < 4.8999999999999998e-4Initial program 97.6%
*-lft-identity97.6%
metadata-eval97.6%
times-frac97.6%
neg-mul-197.6%
sub0-neg97.5%
associate-+l-97.5%
neg-sub097.6%
+-commutative97.6%
sub-neg97.6%
associate-/l*97.7%
div-sub97.7%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 96.5%
if -1.38000000000000002e-14 < z < 1.9e-94Initial program 99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 81.4%
if 4.8999999999999998e-4 < z Initial program 95.4%
*-lft-identity95.4%
metadata-eval95.4%
times-frac95.4%
neg-mul-195.4%
sub0-neg95.4%
associate-+l-95.4%
neg-sub095.4%
+-commutative95.4%
sub-neg95.4%
associate-/l*95.4%
div-sub95.4%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (<= z -300.0) (+ x (/ -1.0 x)) (if (<= z 305.0) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 305.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 <= (-300.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 305.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 <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 305.0) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -300.0: tmp = x + (-1.0 / x) elif z <= 305.0: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -300.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 305.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 <= -300.0) tmp = x + (-1.0 / x); elseif (z <= 305.0) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -300.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 305.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 -300:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 305:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -300Initial program 96.6%
*-lft-identity96.6%
metadata-eval96.6%
times-frac96.6%
neg-mul-196.6%
sub0-neg96.6%
associate-+l-96.6%
neg-sub096.7%
+-commutative96.7%
sub-neg96.7%
associate-/l*96.7%
div-sub96.7%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -300 < z < 305Initial program 99.8%
Taylor expanded in z around 0 99.1%
if 305 < z Initial program 95.4%
*-lft-identity95.4%
metadata-eval95.4%
times-frac95.4%
neg-mul-195.4%
sub0-neg95.4%
associate-+l-95.4%
neg-sub095.4%
+-commutative95.4%
sub-neg95.4%
associate-/l*95.4%
div-sub95.4%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))))
(if (<= z -1.5e-14)
t_0
(if (<= z 2.8e-93)
(+ x (/ y 1.1283791670955126))
(if (<= z 0.0078) t_0 x)))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.5e-14) {
tmp = t_0;
} else if (z <= 2.8e-93) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 0.0078) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
if (z <= (-1.5d-14)) then
tmp = t_0
else if (z <= 2.8d-93) then
tmp = x + (y / 1.1283791670955126d0)
else if (z <= 0.0078d0) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -1.5e-14) {
tmp = t_0;
} else if (z <= 2.8e-93) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 0.0078) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) tmp = 0 if z <= -1.5e-14: tmp = t_0 elif z <= 2.8e-93: tmp = x + (y / 1.1283791670955126) elif z <= 0.0078: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) tmp = 0.0 if (z <= -1.5e-14) tmp = t_0; elseif (z <= 2.8e-93) tmp = Float64(x + Float64(y / 1.1283791670955126)); elseif (z <= 0.0078) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); tmp = 0.0; if (z <= -1.5e-14) tmp = t_0; elseif (z <= 2.8e-93) tmp = x + (y / 1.1283791670955126); elseif (z <= 0.0078) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e-14], t$95$0, If[LessEqual[z, 2.8e-93], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0078], t$95$0, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{-14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-93}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{elif}\;z \leq 0.0078:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4999999999999999e-14 or 2.79999999999999998e-93 < z < 0.0077999999999999996Initial program 97.6%
*-lft-identity97.6%
metadata-eval97.6%
times-frac97.6%
neg-mul-197.6%
sub0-neg97.5%
associate-+l-97.5%
neg-sub097.6%
+-commutative97.6%
sub-neg97.6%
associate-/l*97.7%
div-sub97.7%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 96.5%
if -1.4999999999999999e-14 < z < 2.79999999999999998e-93Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in y around 0 81.4%
if 0.0077999999999999996 < z Initial program 95.4%
*-lft-identity95.4%
metadata-eval95.4%
times-frac95.4%
neg-mul-195.4%
sub0-neg95.4%
associate-+l-95.4%
neg-sub095.4%
+-commutative95.4%
sub-neg95.4%
associate-/l*95.4%
div-sub95.4%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification91.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 97.9%
*-lft-identity97.9%
metadata-eval97.9%
times-frac97.9%
neg-mul-197.9%
sub0-neg97.9%
associate-+l-97.9%
neg-sub098.0%
+-commutative98.0%
sub-neg98.0%
associate-/l*98.0%
div-sub98.0%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around inf 68.4%
Final simplification68.4%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
}
def code(x, y, z): return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
\end{array}
herbie shell --seed 2023171
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))