
(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 (+ 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 96.8%
remove-double-neg96.8%
neg-mul-196.8%
associate-/l*96.9%
neg-mul-196.9%
associate-/r*96.9%
div-sub96.9%
metadata-eval96.9%
associate-/l*96.9%
*-commutative96.9%
associate-*l*96.9%
neg-mul-196.9%
/-rgt-identity96.9%
div-sub96.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= (exp z) 0.0)
(+ x (/ -1.0 x))
(if (<= (exp z) 5e+19)
(+
x
(/
-1.0
(+ x (- (* -1.1283791670955126 (/ z y)) (/ 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) <= 5e+19) {
tmp = x + (-1.0 / (x + ((-1.1283791670955126 * (z / y)) - (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) <= 5d+19) then
tmp = x + ((-1.0d0) / (x + (((-1.1283791670955126d0) * (z / y)) - (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) <= 5e+19) {
tmp = x + (-1.0 / (x + ((-1.1283791670955126 * (z / y)) - (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) <= 5e+19: tmp = x + (-1.0 / (x + ((-1.1283791670955126 * (z / y)) - (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) <= 5e+19) tmp = Float64(x + Float64(-1.0 / Float64(x + Float64(Float64(-1.1283791670955126 * Float64(z / y)) - 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) <= 5e+19) tmp = x + (-1.0 / (x + ((-1.1283791670955126 * (z / y)) - (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], 5e+19], N[(x + N[(-1.0 / N[(x + N[(N[(-1.1283791670955126 * N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(1.1283791670955126 / 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 5 \cdot 10^{+19}:\\
\;\;\;\;x + \frac{-1}{x + \left(-1.1283791670955126 \cdot \frac{z}{y} - \frac{1.1283791670955126}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 90.9%
remove-double-neg90.9%
neg-mul-190.9%
associate-/l*91.0%
neg-mul-191.0%
associate-/r*91.0%
div-sub91.3%
metadata-eval91.3%
associate-/l*91.3%
*-commutative91.3%
associate-*l*91.3%
neg-mul-191.3%
/-rgt-identity91.3%
div-sub91.2%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 5e19Initial program 99.8%
remove-double-neg99.8%
neg-mul-199.8%
associate-/l*99.8%
neg-mul-199.8%
associate-/r*99.8%
div-sub99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l*99.8%
neg-mul-199.8%
/-rgt-identity99.8%
div-sub99.9%
Simplified99.9%
Taylor expanded in z around 0 99.8%
associate--l+99.8%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
if 5e19 < (exp.f64 z) Initial program 96.6%
remove-double-neg96.6%
neg-mul-196.6%
associate-/l*96.6%
neg-mul-196.6%
associate-/r*96.6%
div-sub96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
associate-*l*96.6%
neg-mul-196.6%
/-rgt-identity96.6%
div-sub96.6%
Simplified100.0%
Taylor expanded in y around inf 39.8%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (* 1.1283791670955126 (/ (exp z) y)) x))))
double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 * (exp(z) / y)) - 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 * (exp(z) / y)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 * (Math.exp(z) / y)) - x));
}
def code(x, y, z): return x + (1.0 / ((1.1283791670955126 * (math.exp(z) / y)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 * Float64(exp(z) / y)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / ((1.1283791670955126 * (exp(z) / y)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{1.1283791670955126 \cdot \frac{e^{z}}{y} - x}
\end{array}
Initial program 96.8%
*-lft-identity96.8%
associate-/l*96.9%
remove-double-neg96.9%
neg-mul-196.9%
associate-/r*96.9%
div-sub96.9%
metadata-eval96.9%
associate-/l*96.9%
*-commutative96.9%
associate-*l*96.9%
neg-mul-196.9%
/-rgt-identity96.9%
div-sub96.9%
associate-/r*96.9%
neg-mul-196.9%
remove-double-neg96.9%
associate-*r/96.9%
distribute-lft-neg-out96.9%
neg-mul-196.9%
*-commutative96.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -6.4e+18)
(+ x (/ -1.0 x))
(if (<= z 330.0)
(+ x (/ y (- (+ 1.1283791670955126 (* z 1.1283791670955126)) (* x y))))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+18) {
tmp = x + (-1.0 / x);
} else if (z <= 330.0) {
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 <= (-6.4d+18)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 330.0d0) 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 <= -6.4e+18) {
tmp = x + (-1.0 / x);
} else if (z <= 330.0) {
tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+18: tmp = x + (-1.0 / x) elif z <= 330.0: 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 <= -6.4e+18) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 330.0) 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 <= -6.4e+18) tmp = x + (-1.0 / x); elseif (z <= 330.0) 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, -6.4e+18], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 330.0], 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 -6.4 \cdot 10^{+18}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 330:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.4e18Initial program 90.3%
remove-double-neg90.3%
neg-mul-190.3%
associate-/l*90.5%
neg-mul-190.5%
associate-/r*90.5%
div-sub90.7%
metadata-eval90.7%
associate-/l*90.7%
*-commutative90.7%
associate-*l*90.7%
neg-mul-190.7%
/-rgt-identity90.7%
div-sub90.6%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -6.4e18 < z < 330Initial program 99.9%
Taylor expanded in z around 0 99.8%
if 330 < z Initial program 96.6%
remove-double-neg96.6%
neg-mul-196.6%
associate-/l*96.6%
neg-mul-196.6%
associate-/r*96.6%
div-sub96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
associate-*l*96.6%
neg-mul-196.6%
/-rgt-identity96.6%
div-sub96.6%
Simplified100.0%
Taylor expanded in y around inf 39.8%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -6.4e+18) (+ x (/ -1.0 x)) (if (<= z 320.0) (+ x (/ 1.0 (- (/ 1.1283791670955126 y) x))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+18) {
tmp = x + (-1.0 / x);
} else if (z <= 320.0) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-6.4d+18)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 320.0d0) then
tmp = x + (1.0d0 / ((1.1283791670955126d0 / y) - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+18) {
tmp = x + (-1.0 / x);
} else if (z <= 320.0) {
tmp = x + (1.0 / ((1.1283791670955126 / y) - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+18: tmp = x + (-1.0 / x) elif z <= 320.0: tmp = x + (1.0 / ((1.1283791670955126 / y) - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+18) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 320.0) tmp = Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 / y) - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e+18) tmp = x + (-1.0 / x); elseif (z <= 320.0) tmp = x + (1.0 / ((1.1283791670955126 / y) - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+18], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 320.0], N[(x + N[(1.0 / N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+18}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 320:\\
\;\;\;\;x + \frac{1}{\frac{1.1283791670955126}{y} - x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.4e18Initial program 90.3%
remove-double-neg90.3%
neg-mul-190.3%
associate-/l*90.5%
neg-mul-190.5%
associate-/r*90.5%
div-sub90.7%
metadata-eval90.7%
associate-/l*90.7%
*-commutative90.7%
associate-*l*90.7%
neg-mul-190.7%
/-rgt-identity90.7%
div-sub90.6%
Simplified100.0%
Taylor expanded in y around inf 100.0%
if -6.4e18 < z < 320Initial program 99.9%
*-lft-identity99.9%
associate-/l*99.8%
remove-double-neg99.8%
neg-mul-199.8%
associate-/r*99.8%
div-sub99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l*99.8%
neg-mul-199.8%
/-rgt-identity99.8%
div-sub99.9%
associate-/r*99.9%
neg-mul-199.9%
remove-double-neg99.9%
associate-*r/99.8%
distribute-lft-neg-out99.8%
neg-mul-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
if 320 < z Initial program 96.6%
remove-double-neg96.6%
neg-mul-196.6%
associate-/l*96.6%
neg-mul-196.6%
associate-/r*96.6%
div-sub96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
associate-*l*96.6%
neg-mul-196.6%
/-rgt-identity96.6%
div-sub96.6%
Simplified100.0%
Taylor expanded in y around inf 39.8%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.6e-208) x (if (<= x 5.5e-172) (+ x (* y 0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.6e-208) {
tmp = x;
} else if (x <= 5.5e-172) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.6d-208)) then
tmp = x
else if (x <= 5.5d-172) then
tmp = x + (y * 0.8862269254527579d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.6e-208) {
tmp = x;
} else if (x <= 5.5e-172) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.6e-208: tmp = x elif x <= 5.5e-172: tmp = x + (y * 0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.6e-208) tmp = x; elseif (x <= 5.5e-172) tmp = Float64(x + Float64(y * 0.8862269254527579)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.6e-208) tmp = x; elseif (x <= 5.5e-172) tmp = x + (y * 0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.6e-208], x, If[LessEqual[x, 5.5e-172], N[(x + N[(y * 0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-208}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-172}:\\
\;\;\;\;x + y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.6000000000000001e-208 or 5.5000000000000004e-172 < x Initial program 97.4%
remove-double-neg97.4%
neg-mul-197.4%
associate-/l*97.4%
neg-mul-197.4%
associate-/r*97.4%
div-sub97.5%
metadata-eval97.5%
associate-/l*97.5%
*-commutative97.5%
associate-*l*97.5%
neg-mul-197.5%
/-rgt-identity97.5%
div-sub97.5%
Simplified100.0%
Taylor expanded in y around inf 75.8%
Taylor expanded in x around inf 82.8%
if -1.6000000000000001e-208 < x < 5.5000000000000004e-172Initial program 95.1%
*-lft-identity95.1%
associate-/l*95.0%
remove-double-neg95.0%
neg-mul-195.0%
associate-/r*95.0%
div-sub95.3%
metadata-eval95.3%
associate-/l*95.3%
*-commutative95.3%
associate-*l*95.3%
neg-mul-195.3%
/-rgt-identity95.3%
div-sub95.2%
associate-/r*95.2%
neg-mul-195.2%
remove-double-neg95.2%
associate-*r/95.0%
distribute-lft-neg-out95.0%
neg-mul-195.0%
*-commutative95.0%
Simplified99.6%
Taylor expanded in z around 0 71.8%
Taylor expanded in y around 0 59.4%
*-commutative59.4%
Simplified59.4%
Final simplification77.2%
(FPCore (x y z) :precision binary64 (if (<= z -2.75e-45) (+ x (/ -1.0 x)) (if (<= z 46.0) (+ x (* y 0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.75e-45) {
tmp = x + (-1.0 / x);
} else if (z <= 46.0) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.75d-45)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 46.0d0) then
tmp = x + (y * 0.8862269254527579d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.75e-45) {
tmp = x + (-1.0 / x);
} else if (z <= 46.0) {
tmp = x + (y * 0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.75e-45: tmp = x + (-1.0 / x) elif z <= 46.0: tmp = x + (y * 0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.75e-45) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 46.0) tmp = Float64(x + Float64(y * 0.8862269254527579)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.75e-45) tmp = x + (-1.0 / x); elseif (z <= 46.0) tmp = x + (y * 0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.75e-45], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 46.0], N[(x + N[(y * 0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{-45}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 46:\\
\;\;\;\;x + y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.75000000000000015e-45Initial program 91.7%
remove-double-neg91.7%
neg-mul-191.7%
associate-/l*91.8%
neg-mul-191.8%
associate-/r*91.8%
div-sub92.1%
metadata-eval92.1%
associate-/l*92.1%
*-commutative92.1%
associate-*l*92.1%
neg-mul-192.1%
/-rgt-identity92.1%
div-sub91.9%
Simplified100.0%
Taylor expanded in y around inf 97.5%
if -2.75000000000000015e-45 < z < 46Initial program 99.8%
*-lft-identity99.8%
associate-/l*99.8%
remove-double-neg99.8%
neg-mul-199.8%
associate-/r*99.8%
div-sub99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l*99.8%
neg-mul-199.8%
/-rgt-identity99.8%
div-sub99.8%
associate-/r*99.8%
neg-mul-199.8%
remove-double-neg99.8%
associate-*r/99.8%
distribute-lft-neg-out99.8%
neg-mul-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 74.8%
*-commutative74.8%
Simplified74.8%
if 46 < z Initial program 96.6%
remove-double-neg96.6%
neg-mul-196.6%
associate-/l*96.6%
neg-mul-196.6%
associate-/r*96.6%
div-sub96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
associate-*l*96.6%
neg-mul-196.6%
/-rgt-identity96.6%
div-sub96.6%
Simplified100.0%
Taylor expanded in y around inf 39.8%
Taylor expanded in x around inf 100.0%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= z -9.5e-45) (+ x (/ -1.0 x)) (if (<= z 55.0) (+ x (/ y 1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.5e-45) {
tmp = x + (-1.0 / x);
} else if (z <= 55.0) {
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 <= (-9.5d-45)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 55.0d0) 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 <= -9.5e-45) {
tmp = x + (-1.0 / x);
} else if (z <= 55.0) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.5e-45: tmp = x + (-1.0 / x) elif z <= 55.0: tmp = x + (y / 1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.5e-45) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 55.0) 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 <= -9.5e-45) tmp = x + (-1.0 / x); elseif (z <= 55.0) tmp = x + (y / 1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.5e-45], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 55.0], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-45}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 55:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.5000000000000002e-45Initial program 91.7%
remove-double-neg91.7%
neg-mul-191.7%
associate-/l*91.8%
neg-mul-191.8%
associate-/r*91.8%
div-sub92.1%
metadata-eval92.1%
associate-/l*92.1%
*-commutative92.1%
associate-*l*92.1%
neg-mul-192.1%
/-rgt-identity92.1%
div-sub91.9%
Simplified100.0%
Taylor expanded in y around inf 97.5%
if -9.5000000000000002e-45 < z < 55Initial program 99.8%
*-lft-identity99.8%
associate-/l*99.8%
remove-double-neg99.8%
neg-mul-199.8%
associate-/r*99.8%
div-sub99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
associate-*l*99.8%
neg-mul-199.8%
/-rgt-identity99.8%
div-sub99.8%
associate-/r*99.8%
neg-mul-199.8%
remove-double-neg99.8%
associate-*r/99.8%
distribute-lft-neg-out99.8%
neg-mul-199.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 74.8%
*-commutative74.8%
Simplified74.8%
metadata-eval74.9%
div-inv75.0%
Applied egg-rr75.0%
if 55 < z Initial program 96.6%
remove-double-neg96.6%
neg-mul-196.6%
associate-/l*96.6%
neg-mul-196.6%
associate-/r*96.6%
div-sub96.6%
metadata-eval96.6%
associate-/l*96.6%
*-commutative96.6%
associate-*l*96.6%
neg-mul-196.6%
/-rgt-identity96.6%
div-sub96.6%
Simplified100.0%
Taylor expanded in y around inf 39.8%
Taylor expanded in x around inf 100.0%
Final simplification86.9%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.8%
remove-double-neg96.8%
neg-mul-196.8%
associate-/l*96.9%
neg-mul-196.9%
associate-/r*96.9%
div-sub96.9%
metadata-eval96.9%
associate-/l*96.9%
*-commutative96.9%
associate-*l*96.9%
neg-mul-196.9%
/-rgt-identity96.9%
div-sub96.9%
Simplified99.9%
Taylor expanded in y around inf 64.2%
Taylor expanded in x around inf 68.0%
Final simplification68.0%
(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 2024018
(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)))))