
(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))
(if (<= (exp z) 1.000000002)
(+ x (/ y (- 1.1283791670955126 (+ (* x y) (* z -1.1283791670955126)))))
(+ x (/ (* y 0.8862269254527579) (exp z))))))
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.000000002) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x + ((y * 0.8862269254527579) / exp(z));
}
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.000000002d0) then
tmp = x + (y / (1.1283791670955126d0 - ((x * y) + (z * (-1.1283791670955126d0)))))
else
tmp = x + ((y * 0.8862269254527579d0) / exp(z))
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.000000002) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x + ((y * 0.8862269254527579) / Math.exp(z));
}
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.000000002: tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))) else: tmp = x + ((y * 0.8862269254527579) / math.exp(z)) 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.000000002) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(Float64(x * y) + Float64(z * -1.1283791670955126))))); else tmp = Float64(x + Float64(Float64(y * 0.8862269254527579) / exp(z))); 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.000000002) tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126)))); else tmp = x + ((y * 0.8862269254527579) / exp(z)); 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.000000002], N[(x + N[(y / N[(1.1283791670955126 - N[(N[(x * y), $MachinePrecision] + N[(z * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * 0.8862269254527579), $MachinePrecision] / N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;e^{z} \leq 1.000000002:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot -1.1283791670955126\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot 0.8862269254527579}{e^{z}}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 95.7%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 1.00000000199999994Initial 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.00000000199999994 < (exp.f64 z) Initial program 95.7%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))) (if (<= t_0 5e+110) 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 <= 5e+110) {
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 <= 5d+110) 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 <= 5e+110) {
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 <= 5e+110: 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 <= 5e+110) 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 <= 5e+110) 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, 5e+110], 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 5 \cdot 10^{+110}:\\
\;\;\;\;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)))) < 4.99999999999999978e110Initial program 99.4%
if 4.99999999999999978e110 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) Initial program 91.1%
Taylor expanded in y around inf 100.0%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (- x (/ y (fma x y (* (exp z) -1.1283791670955126)))))
double code(double x, double y, double z) {
return x - (y / fma(x, y, (exp(z) * -1.1283791670955126)));
}
function code(x, y, z) return Float64(x - Float64(y / fma(x, y, Float64(exp(z) * -1.1283791670955126)))) end
code[x_, y_, z_] := N[(x - N[(y / N[(x * y + N[(N[Exp[z], $MachinePrecision] * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}
\end{array}
Initial program 97.6%
remove-double-neg97.6%
distribute-frac-neg97.6%
unsub-neg97.6%
distribute-frac-neg97.6%
distribute-neg-frac297.6%
neg-sub097.6%
associate--r-97.6%
neg-sub097.6%
+-commutative97.6%
fma-define98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Simplified98.8%
(FPCore (x y z)
:precision binary64
(if (<= z -6e-27)
(+ x (/ -1.0 x))
(if (or (<= z -1.12e-251) (and (not (<= z 1.4e-238)) (<= z 5e-12)))
(+ x (* 0.8862269254527579 (- y (* y z))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6e-27) {
tmp = x + (-1.0 / x);
} else if ((z <= -1.12e-251) || (!(z <= 1.4e-238) && (z <= 5e-12))) {
tmp = x + (0.8862269254527579 * (y - (y * z)));
} 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 <= (-6d-27)) then
tmp = x + ((-1.0d0) / x)
else if ((z <= (-1.12d-251)) .or. (.not. (z <= 1.4d-238)) .and. (z <= 5d-12)) then
tmp = x + (0.8862269254527579d0 * (y - (y * z)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6e-27) {
tmp = x + (-1.0 / x);
} else if ((z <= -1.12e-251) || (!(z <= 1.4e-238) && (z <= 5e-12))) {
tmp = x + (0.8862269254527579 * (y - (y * z)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6e-27: tmp = x + (-1.0 / x) elif (z <= -1.12e-251) or (not (z <= 1.4e-238) and (z <= 5e-12)): tmp = x + (0.8862269254527579 * (y - (y * z))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6e-27) tmp = Float64(x + Float64(-1.0 / x)); elseif ((z <= -1.12e-251) || (!(z <= 1.4e-238) && (z <= 5e-12))) tmp = Float64(x + Float64(0.8862269254527579 * Float64(y - Float64(y * z)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6e-27) tmp = x + (-1.0 / x); elseif ((z <= -1.12e-251) || (~((z <= 1.4e-238)) && (z <= 5e-12))) tmp = x + (0.8862269254527579 * (y - (y * z))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6e-27], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.12e-251], And[N[Not[LessEqual[z, 1.4e-238]], $MachinePrecision], LessEqual[z, 5e-12]]], N[(x + N[(0.8862269254527579 * N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-27}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-251} \lor \neg \left(z \leq 1.4 \cdot 10^{-238}\right) \land z \leq 5 \cdot 10^{-12}:\\
\;\;\;\;x + 0.8862269254527579 \cdot \left(y - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.0000000000000002e-27Initial program 96.0%
Taylor expanded in y around inf 98.7%
if -6.0000000000000002e-27 < z < -1.12000000000000007e-251 or 1.40000000000000002e-238 < z < 4.9999999999999997e-12Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 77.9%
Taylor expanded in z around 0 77.9%
+-commutative77.9%
metadata-eval77.9%
cancel-sign-sub-inv77.9%
distribute-lft-out--77.9%
Simplified77.9%
if -1.12000000000000007e-251 < z < 1.40000000000000002e-238 or 4.9999999999999997e-12 < z Initial program 96.7%
Taylor expanded in x around inf 98.0%
Final simplification91.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.1e-26)
(+ x (/ -1.0 x))
(if (or (<= z -6.5e-251) (and (not (<= z 2.9e-241)) (<= z 7e-11)))
(- x (/ y -1.1283791670955126))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.1e-26) {
tmp = x + (-1.0 / x);
} else if ((z <= -6.5e-251) || (!(z <= 2.9e-241) && (z <= 7e-11))) {
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 <= (-1.1d-26)) then
tmp = x + ((-1.0d0) / x)
else if ((z <= (-6.5d-251)) .or. (.not. (z <= 2.9d-241)) .and. (z <= 7d-11)) 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 <= -1.1e-26) {
tmp = x + (-1.0 / x);
} else if ((z <= -6.5e-251) || (!(z <= 2.9e-241) && (z <= 7e-11))) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.1e-26: tmp = x + (-1.0 / x) elif (z <= -6.5e-251) or (not (z <= 2.9e-241) and (z <= 7e-11)): tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.1e-26) tmp = Float64(x + Float64(-1.0 / x)); elseif ((z <= -6.5e-251) || (!(z <= 2.9e-241) && (z <= 7e-11))) 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 <= -1.1e-26) tmp = x + (-1.0 / x); elseif ((z <= -6.5e-251) || (~((z <= 2.9e-241)) && (z <= 7e-11))) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.1e-26], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -6.5e-251], And[N[Not[LessEqual[z, 2.9e-241]], $MachinePrecision], LessEqual[z, 7e-11]]], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{-26}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-251} \lor \neg \left(z \leq 2.9 \cdot 10^{-241}\right) \land z \leq 7 \cdot 10^{-11}:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.1e-26Initial program 96.0%
Taylor expanded in y around inf 98.7%
if -1.1e-26 < z < -6.5000000000000002e-251 or 2.8999999999999999e-241 < z < 7.00000000000000038e-11Initial 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.7%
*-commutative99.7%
fma-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 77.8%
if -6.5000000000000002e-251 < z < 2.8999999999999999e-241 or 7.00000000000000038e-11 < z Initial program 96.7%
Taylor expanded in x around inf 98.0%
Final simplification91.0%
(FPCore (x y z)
:precision binary64
(if (<= z -170.0)
(+ x (/ -1.0 x))
(if (<= z 5.5e-6)
(+ x (/ y (- 1.1283791670955126 (+ (* x y) (* z -1.1283791670955126)))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -170.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.5e-6) {
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 <= (-170.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 5.5d-6) 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 <= -170.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.5e-6) {
tmp = x + (y / (1.1283791670955126 - ((x * y) + (z * -1.1283791670955126))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -170.0: tmp = x + (-1.0 / x) elif z <= 5.5e-6: 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 <= -170.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 5.5e-6) 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 <= -170.0) tmp = x + (-1.0 / x); elseif (z <= 5.5e-6) 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, -170.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e-6], 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 -170:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-6}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - \left(x \cdot y + z \cdot -1.1283791670955126\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -170Initial program 95.7%
Taylor expanded in y around inf 100.0%
if -170 < z < 5.4999999999999999e-6Initial 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 5.4999999999999999e-6 < z Initial program 95.6%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -230.0) (+ x (/ -1.0 x)) (if (<= z 5.5e-6) (- x (/ y (- (* x y) 1.1283791670955126))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -230.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.5e-6) {
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 <= (-230.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 5.5d-6) 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 <= -230.0) {
tmp = x + (-1.0 / x);
} else if (z <= 5.5e-6) {
tmp = x - (y / ((x * y) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -230.0: tmp = x + (-1.0 / x) elif z <= 5.5e-6: tmp = x - (y / ((x * y) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -230.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 5.5e-6) 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 <= -230.0) tmp = x + (-1.0 / x); elseif (z <= 5.5e-6) tmp = x - (y / ((x * y) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -230.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e-6], 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 -230:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-6}:\\
\;\;\;\;x - \frac{y}{x \cdot y - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -230Initial program 95.7%
Taylor expanded in y around inf 100.0%
if -230 < z < 5.4999999999999999e-6Initial 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.5%
if 5.4999999999999999e-6 < z Initial program 95.6%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -3.45e-252) (+ x (/ -1.0 x)) x))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.45e-252) {
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 <= (-3.45d-252)) 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 <= -3.45e-252) {
tmp = x + (-1.0 / x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.45e-252: tmp = x + (-1.0 / x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.45e-252) 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 <= -3.45e-252) tmp = x + (-1.0 / x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.45e-252], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.45 \cdot 10^{-252}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.45000000000000016e-252Initial program 97.6%
Taylor expanded in y around inf 83.3%
if -3.45000000000000016e-252 < z Initial program 97.6%
Taylor expanded in x around inf 90.2%
Final simplification86.7%
(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.6%
Taylor expanded in x around inf 76.1%
(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 2024101
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:alt
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))