
(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 10 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 (<= z -15500000000.0)
(+ x (/ -1.0 x))
(if (<= z 1.05e-34)
(+ x (/ y (- 1.1283791670955126 (* x y))))
(+ x (* 0.8862269254527579 (/ y (exp z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 1.05e-34) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x + (0.8862269254527579 * (y / 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 (z <= (-15500000000.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 1.05d-34) then
tmp = x + (y / (1.1283791670955126d0 - (x * y)))
else
tmp = x + (0.8862269254527579d0 * (y / exp(z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 1.05e-34) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x + (0.8862269254527579 * (y / Math.exp(z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -15500000000.0: tmp = x + (-1.0 / x) elif z <= 1.05e-34: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x + (0.8862269254527579 * (y / math.exp(z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -15500000000.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 1.05e-34) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y)))); else tmp = Float64(x + Float64(0.8862269254527579 * Float64(y / exp(z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -15500000000.0) tmp = x + (-1.0 / x); elseif (z <= 1.05e-34) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x + (0.8862269254527579 * (y / exp(z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -15500000000.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e-34], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(0.8862269254527579 * N[(y / N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -15500000000:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-34}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x + 0.8862269254527579 \cdot \frac{y}{e^{z}}\\
\end{array}
\end{array}
if z < -1.55e10Initial program 86.3%
*-lft-identity86.3%
metadata-eval86.3%
times-frac86.3%
neg-mul-186.3%
sub0-neg86.3%
associate-+l-86.3%
neg-sub086.6%
+-commutative86.6%
sub-neg86.6%
associate-/l*86.7%
div-sub86.6%
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 -1.55e10 < z < 1.05e-34Initial program 99.9%
Taylor expanded in z around 0 99.9%
if 1.05e-34 < z Initial program 91.6%
*-lft-identity91.6%
metadata-eval91.6%
times-frac91.6%
neg-mul-191.6%
sub0-neg91.6%
associate-+l-91.6%
neg-sub091.6%
+-commutative91.6%
sub-neg91.6%
associate-/l*91.6%
div-sub91.6%
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 y around 0 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y)))))) (if (<= t_0 1e+211) 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+211) {
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+211) 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+211) {
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+211: 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+211) 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+211) 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+211], 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^{+211}:\\
\;\;\;\;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.9999999999999996e210Initial program 98.5%
if 9.9999999999999996e210 < (+.f64 x (/.f64 y (-.f64 (*.f64 5641895835477563/5000000000000000 (exp.f64 z)) (*.f64 x y)))) Initial program 74.6%
*-lft-identity74.6%
metadata-eval74.6%
times-frac74.6%
neg-mul-174.6%
sub0-neg74.6%
associate-+l-74.6%
neg-sub074.9%
+-commutative74.9%
sub-neg74.9%
associate-/l*74.9%
div-sub74.9%
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 simplification98.7%
(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 94.9%
*-lft-identity94.9%
metadata-eval94.9%
times-frac94.9%
neg-mul-194.9%
sub0-neg94.9%
associate-+l-94.9%
neg-sub094.9%
+-commutative94.9%
sub-neg94.9%
associate-/l*94.9%
div-sub94.9%
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
(if (<= z -15500000000.0)
(+ x (/ -1.0 x))
(if (<= z 3.05)
(+ x (/ y (- (+ 1.1283791670955126 (* z 1.1283791670955126)) (* x y))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 3.05) {
tmp = x + (y / ((1.1283791670955126 + (z * 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 <= (-15500000000.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 3.05d0) then
tmp = x + (y / ((1.1283791670955126d0 + (z * 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 <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 3.05) {
tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -15500000000.0: tmp = x + (-1.0 / x) elif z <= 3.05: tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -15500000000.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 3.05) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * 1.1283791670955126)) - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -15500000000.0) tmp = x + (-1.0 / x); elseif (z <= 3.05) tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -15500000000.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * 1.1283791670955126), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -15500000000:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 3.05:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55e10Initial program 86.3%
*-lft-identity86.3%
metadata-eval86.3%
times-frac86.3%
neg-mul-186.3%
sub0-neg86.3%
associate-+l-86.3%
neg-sub086.6%
+-commutative86.6%
sub-neg86.6%
associate-/l*86.7%
div-sub86.6%
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 -1.55e10 < z < 3.0499999999999998Initial program 99.9%
Taylor expanded in z around 0 99.7%
if 3.0499999999999998 < z Initial program 91.2%
+-commutative91.2%
clear-num91.2%
associate-/r/91.2%
fma-def91.2%
*-commutative91.2%
*-commutative91.2%
Applied egg-rr91.2%
Taylor expanded in y around 0 100.0%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))))
(if (<= z -3e-11)
t_0
(if (<= z 8.2e-92)
(+ x (/ y 1.1283791670955126))
(if (<= z 9.5e-36)
t_0
(if (<= z 0.000205) (- x (* y -0.8862269254527579)) x))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -3e-11) {
tmp = t_0;
} else if (z <= 8.2e-92) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 9.5e-36) {
tmp = t_0;
} else if (z <= 0.000205) {
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) :: t_0
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
if (z <= (-3d-11)) then
tmp = t_0
else if (z <= 8.2d-92) then
tmp = x + (y / 1.1283791670955126d0)
else if (z <= 9.5d-36) then
tmp = t_0
else if (z <= 0.000205d0) 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 t_0 = x + (-1.0 / x);
double tmp;
if (z <= -3e-11) {
tmp = t_0;
} else if (z <= 8.2e-92) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 9.5e-36) {
tmp = t_0;
} else if (z <= 0.000205) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) tmp = 0 if z <= -3e-11: tmp = t_0 elif z <= 8.2e-92: tmp = x + (y / 1.1283791670955126) elif z <= 9.5e-36: tmp = t_0 elif z <= 0.000205: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) tmp = 0.0 if (z <= -3e-11) tmp = t_0; elseif (z <= 8.2e-92) tmp = Float64(x + Float64(y / 1.1283791670955126)); elseif (z <= 9.5e-36) tmp = t_0; elseif (z <= 0.000205) tmp = Float64(x - Float64(y * -0.8862269254527579)); 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 <= -3e-11) tmp = t_0; elseif (z <= 8.2e-92) tmp = x + (y / 1.1283791670955126); elseif (z <= 9.5e-36) tmp = t_0; elseif (z <= 0.000205) tmp = x - (y * -0.8862269254527579); 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, -3e-11], t$95$0, If[LessEqual[z, 8.2e-92], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.5e-36], t$95$0, If[LessEqual[z, 0.000205], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
\mathbf{if}\;z \leq -3 \cdot 10^{-11}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-92}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 0.000205:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3e-11 or 8.2000000000000005e-92 < z < 9.5000000000000003e-36Initial program 89.4%
*-lft-identity89.4%
metadata-eval89.4%
times-frac89.4%
neg-mul-189.4%
sub0-neg89.4%
associate-+l-89.4%
neg-sub089.7%
+-commutative89.7%
sub-neg89.7%
associate-/l*89.7%
div-sub89.6%
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 98.5%
if -3e-11 < z < 8.2000000000000005e-92Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 81.2%
if 9.5000000000000003e-36 < z < 2.05e-4Initial program 99.6%
*-lft-identity99.6%
metadata-eval99.6%
times-frac99.6%
neg-mul-199.6%
sub0-neg99.6%
associate-+l-99.6%
neg-sub099.6%
+-commutative99.6%
sub-neg99.6%
associate-/l*99.6%
div-sub99.6%
associate-*r/99.6%
*-inverses99.6%
*-rgt-identity99.6%
associate-*l/99.2%
cancel-sign-sub-inv99.2%
distribute-lft-neg-in99.2%
distribute-rgt-neg-in99.2%
associate-*l/99.6%
distribute-rgt-neg-in99.6%
Simplified99.2%
Taylor expanded in z around 0 85.2%
Taylor expanded in x around 0 85.6%
*-commutative85.6%
Simplified85.6%
if 2.05e-4 < z Initial program 91.2%
+-commutative91.2%
clear-num91.2%
associate-/r/91.2%
fma-def91.2%
*-commutative91.2%
*-commutative91.2%
Applied egg-rr91.2%
Taylor expanded in y around 0 100.0%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (if (<= z -15500000000.0) (+ x (/ -1.0 x)) (if (<= z 3.05) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 3.05) {
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 <= (-15500000000.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 3.05d0) 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 <= -15500000000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 3.05) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -15500000000.0: tmp = x + (-1.0 / x) elif z <= 3.05: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -15500000000.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 3.05) 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 <= -15500000000.0) tmp = x + (-1.0 / x); elseif (z <= 3.05) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -15500000000.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.05], 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 -15500000000:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 3.05:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.55e10Initial program 86.3%
*-lft-identity86.3%
metadata-eval86.3%
times-frac86.3%
neg-mul-186.3%
sub0-neg86.3%
associate-+l-86.3%
neg-sub086.6%
+-commutative86.6%
sub-neg86.6%
associate-/l*86.7%
div-sub86.6%
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 -1.55e10 < z < 3.0499999999999998Initial program 99.9%
Taylor expanded in z around 0 99.5%
if 3.0499999999999998 < z Initial program 91.2%
+-commutative91.2%
clear-num91.2%
associate-/r/91.2%
fma-def91.2%
*-commutative91.2%
*-commutative91.2%
Applied egg-rr91.2%
Taylor expanded in y around 0 100.0%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= z -5.3e+121) (/ -1.0 x) (if (<= z -2.7e-21) x (if (<= z 0.17) (+ x (/ y 1.1283791670955126)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.3e+121) {
tmp = -1.0 / x;
} else if (z <= -2.7e-21) {
tmp = x;
} else if (z <= 0.17) {
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 <= (-5.3d+121)) then
tmp = (-1.0d0) / x
else if (z <= (-2.7d-21)) then
tmp = x
else if (z <= 0.17d0) 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 <= -5.3e+121) {
tmp = -1.0 / x;
} else if (z <= -2.7e-21) {
tmp = x;
} else if (z <= 0.17) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.3e+121: tmp = -1.0 / x elif z <= -2.7e-21: tmp = x elif z <= 0.17: tmp = x + (y / 1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.3e+121) tmp = Float64(-1.0 / x); elseif (z <= -2.7e-21) tmp = x; elseif (z <= 0.17) 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 <= -5.3e+121) tmp = -1.0 / x; elseif (z <= -2.7e-21) tmp = x; elseif (z <= 0.17) tmp = x + (y / 1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.3e+121], N[(-1.0 / x), $MachinePrecision], If[LessEqual[z, -2.7e-21], x, If[LessEqual[z, 0.17], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+121}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.30000000000000009e121Initial program 86.5%
*-lft-identity86.5%
metadata-eval86.5%
times-frac86.5%
neg-mul-186.5%
sub0-neg86.4%
associate-+l-86.4%
neg-sub086.8%
+-commutative86.8%
sub-neg86.8%
associate-/l*86.9%
div-sub86.8%
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 99.9%
Taylor expanded in x around 0 67.1%
if -5.30000000000000009e121 < z < -2.7000000000000001e-21 or 0.170000000000000012 < z Initial program 90.8%
+-commutative90.8%
clear-num90.8%
associate-/r/90.8%
fma-def90.8%
*-commutative90.8%
*-commutative90.8%
Applied egg-rr90.8%
Taylor expanded in y around 0 88.9%
if -2.7000000000000001e-21 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 99.4%
Taylor expanded in y around 0 79.3%
Final simplification81.5%
(FPCore (x y z) :precision binary64 (if (<= x -1.9e-168) x (if (<= x 1.45e-142) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.9e-168) {
tmp = x;
} else if (x <= 1.45e-142) {
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.9d-168)) then
tmp = x
else if (x <= 1.45d-142) 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.9e-168) {
tmp = x;
} else if (x <= 1.45e-142) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.9e-168: tmp = x elif x <= 1.45e-142: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.9e-168) tmp = x; elseif (x <= 1.45e-142) 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.9e-168) tmp = x; elseif (x <= 1.45e-142) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.9e-168], x, If[LessEqual[x, 1.45e-142], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-168}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-142}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.9e-168 or 1.44999999999999995e-142 < x Initial program 95.3%
+-commutative95.3%
clear-num95.3%
associate-/r/94.8%
fma-def94.8%
*-commutative94.8%
*-commutative94.8%
Applied egg-rr94.8%
Taylor expanded in y around 0 83.5%
if -1.9e-168 < x < 1.44999999999999995e-142Initial program 93.5%
+-commutative93.5%
clear-num93.5%
associate-/r/93.4%
fma-def93.4%
*-commutative93.4%
*-commutative93.4%
Applied egg-rr93.4%
Taylor expanded in x around 0 46.6%
associate-*r/46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in z around 0 46.0%
*-commutative46.0%
metadata-eval46.0%
associate-*l*46.0%
associate-*r*46.0%
*-commutative46.0%
distribute-lft-out46.0%
*-commutative46.0%
Simplified46.0%
Taylor expanded in z around 0 46.1%
*-commutative46.1%
Simplified46.1%
Final simplification74.5%
(FPCore (x y z) :precision binary64 (if (<= z -4e+121) (/ -1.0 x) x))
double code(double x, double y, double z) {
double tmp;
if (z <= -4e+121) {
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 (z <= (-4d+121)) 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 (z <= -4e+121) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4e+121: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4e+121) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4e+121) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4e+121], N[(-1.0 / x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+121}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.00000000000000015e121Initial program 86.5%
*-lft-identity86.5%
metadata-eval86.5%
times-frac86.5%
neg-mul-186.5%
sub0-neg86.4%
associate-+l-86.4%
neg-sub086.8%
+-commutative86.8%
sub-neg86.8%
associate-/l*86.9%
div-sub86.8%
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 99.9%
Taylor expanded in x around 0 67.1%
if -4.00000000000000015e121 < z Initial program 96.0%
+-commutative96.0%
clear-num95.9%
associate-/r/95.9%
fma-def95.9%
*-commutative95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in y around 0 74.3%
Final simplification73.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.9%
+-commutative94.9%
clear-num94.9%
associate-/r/94.5%
fma-def94.5%
*-commutative94.5%
*-commutative94.5%
Applied egg-rr94.5%
Taylor expanded in y around 0 69.6%
Final simplification69.6%
(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 2023195
(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)))))