
(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 11 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.0000000000000004)
(+ 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) <= 1.0000000000000004) {
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) <= 1.0000000000000004d0) 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) <= 1.0000000000000004) {
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) <= 1.0000000000000004: 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) <= 1.0000000000000004) 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) <= 1.0000000000000004) 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], 1.0000000000000004], 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 1.0000000000000004:\\
\;\;\;\;x + \frac{-1}{x + \frac{-1.1283791670955126}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 91.1%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) < 1.0000000000000004Initial program 99.8%
Simplified99.9%
Taylor expanded in z around 0 99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
associate-*r/99.9%
metadata-eval99.9%
Simplified99.9%
if 1.0000000000000004 < (exp.f64 z) Initial program 95.2%
+-commutative95.2%
div-inv95.2%
fma-def95.2%
*-commutative95.2%
*-commutative95.2%
Applied egg-rr95.2%
Taylor expanded in y around 0 100.0%
Final simplification99.9%
(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%
Simplified99.9%
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%
div-sub96.9%
associate-*r/96.8%
/-rgt-identity96.8%
metadata-eval96.8%
associate-/l*96.8%
*-commutative96.8%
neg-mul-196.8%
associate-/l*96.8%
associate-*r*96.8%
*-commutative96.8%
neg-mul-196.8%
associate-/l*99.9%
*-inverses99.9%
/-rgt-identity99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -6.4e-6)
(+ x (/ -1.0 x))
(if (<= z -1.3e-175)
(- x (* y -0.8862269254527579))
(if (<= z -1.55e-303)
x
(if (<= z 3.9e-16) (+ x (/ -1.0 (/ -1.1283791670955126 y))) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e-6) {
tmp = x + (-1.0 / x);
} else if (z <= -1.3e-175) {
tmp = x - (y * -0.8862269254527579);
} else if (z <= -1.55e-303) {
tmp = x;
} else if (z <= 3.9e-16) {
tmp = x + (-1.0 / (-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 (z <= (-6.4d-6)) then
tmp = x + ((-1.0d0) / x)
else if (z <= (-1.3d-175)) then
tmp = x - (y * (-0.8862269254527579d0))
else if (z <= (-1.55d-303)) then
tmp = x
else if (z <= 3.9d-16) then
tmp = x + ((-1.0d0) / ((-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 (z <= -6.4e-6) {
tmp = x + (-1.0 / x);
} else if (z <= -1.3e-175) {
tmp = x - (y * -0.8862269254527579);
} else if (z <= -1.55e-303) {
tmp = x;
} else if (z <= 3.9e-16) {
tmp = x + (-1.0 / (-1.1283791670955126 / y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e-6: tmp = x + (-1.0 / x) elif z <= -1.3e-175: tmp = x - (y * -0.8862269254527579) elif z <= -1.55e-303: tmp = x elif z <= 3.9e-16: tmp = x + (-1.0 / (-1.1283791670955126 / y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e-6) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= -1.3e-175) tmp = Float64(x - Float64(y * -0.8862269254527579)); elseif (z <= -1.55e-303) tmp = x; elseif (z <= 3.9e-16) tmp = Float64(x + Float64(-1.0 / Float64(-1.1283791670955126 / y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e-6) tmp = x + (-1.0 / x); elseif (z <= -1.3e-175) tmp = x - (y * -0.8862269254527579); elseif (z <= -1.55e-303) tmp = x; elseif (z <= 3.9e-16) tmp = x + (-1.0 / (-1.1283791670955126 / y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e-6], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.3e-175], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.55e-303], x, If[LessEqual[z, 3.9e-16], N[(x + N[(-1.0 / N[(-1.1283791670955126 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{-6}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-175}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-303}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;x + \frac{-1}{\frac{-1.1283791670955126}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6.3999999999999997e-6Initial program 91.5%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -6.3999999999999997e-6 < z < -1.3e-175Initial program 99.7%
Simplified99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around 0 78.5%
*-commutative78.5%
Simplified78.5%
if -1.3e-175 < z < -1.55e-303 or 3.89999999999999977e-16 < z Initial program 96.8%
+-commutative96.8%
div-inv96.8%
fma-def96.7%
*-commutative96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in y around 0 94.8%
if -1.55e-303 < z < 3.89999999999999977e-16Initial program 99.8%
Simplified99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 83.7%
Final simplification90.5%
(FPCore (x y z)
:precision binary64
(if (<= x -2.05e-163)
x
(if (<= x 1.75e-164)
(* y 0.8862269254527579)
(if (<= x 1.5e-124)
x
(if (<= x 1.25e-121)
(* y 0.8862269254527579)
(if (<= x 5.2e-65) (/ -1.0 x) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.05e-163) {
tmp = x;
} else if (x <= 1.75e-164) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.5e-124) {
tmp = x;
} else if (x <= 1.25e-121) {
tmp = y * 0.8862269254527579;
} else if (x <= 5.2e-65) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.05d-163)) then
tmp = x
else if (x <= 1.75d-164) then
tmp = y * 0.8862269254527579d0
else if (x <= 1.5d-124) then
tmp = x
else if (x <= 1.25d-121) then
tmp = y * 0.8862269254527579d0
else if (x <= 5.2d-65) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.05e-163) {
tmp = x;
} else if (x <= 1.75e-164) {
tmp = y * 0.8862269254527579;
} else if (x <= 1.5e-124) {
tmp = x;
} else if (x <= 1.25e-121) {
tmp = y * 0.8862269254527579;
} else if (x <= 5.2e-65) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.05e-163: tmp = x elif x <= 1.75e-164: tmp = y * 0.8862269254527579 elif x <= 1.5e-124: tmp = x elif x <= 1.25e-121: tmp = y * 0.8862269254527579 elif x <= 5.2e-65: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.05e-163) tmp = x; elseif (x <= 1.75e-164) tmp = Float64(y * 0.8862269254527579); elseif (x <= 1.5e-124) tmp = x; elseif (x <= 1.25e-121) tmp = Float64(y * 0.8862269254527579); elseif (x <= 5.2e-65) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.05e-163) tmp = x; elseif (x <= 1.75e-164) tmp = y * 0.8862269254527579; elseif (x <= 1.5e-124) tmp = x; elseif (x <= 1.25e-121) tmp = y * 0.8862269254527579; elseif (x <= 5.2e-65) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.05e-163], x, If[LessEqual[x, 1.75e-164], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 1.5e-124], x, If[LessEqual[x, 1.25e-121], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 5.2e-65], N[(-1.0 / x), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-163}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-164}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-124}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-121}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.04999999999999991e-163 or 1.75e-164 < x < 1.5e-124 or 5.20000000000000019e-65 < x Initial program 97.8%
+-commutative97.8%
div-inv97.8%
fma-def97.8%
*-commutative97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in y around 0 86.3%
if -2.04999999999999991e-163 < x < 1.75e-164 or 1.5e-124 < x < 1.24999999999999997e-121Initial program 93.9%
Simplified99.8%
Taylor expanded in z around 0 68.2%
Taylor expanded in y around 0 68.4%
Taylor expanded in x around 0 51.6%
*-commutative51.6%
Simplified51.6%
if 1.24999999999999997e-121 < x < 5.20000000000000019e-65Initial program 99.6%
Simplified100.0%
Taylor expanded in x around inf 87.7%
Taylor expanded in x around 0 87.7%
Final simplification77.1%
(FPCore (x y z)
:precision binary64
(if (<= z -2.2e-6)
(+ x (/ -1.0 x))
(if (or (<= z -3e-175) (and (not (<= z -4.2e-301)) (<= z 3.25e-16)))
(- x (* y -0.8862269254527579))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.2e-6) {
tmp = x + (-1.0 / x);
} else if ((z <= -3e-175) || (!(z <= -4.2e-301) && (z <= 3.25e-16))) {
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.2d-6)) then
tmp = x + ((-1.0d0) / x)
else if ((z <= (-3d-175)) .or. (.not. (z <= (-4.2d-301))) .and. (z <= 3.25d-16)) 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.2e-6) {
tmp = x + (-1.0 / x);
} else if ((z <= -3e-175) || (!(z <= -4.2e-301) && (z <= 3.25e-16))) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.2e-6: tmp = x + (-1.0 / x) elif (z <= -3e-175) or (not (z <= -4.2e-301) and (z <= 3.25e-16)): tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.2e-6) tmp = Float64(x + Float64(-1.0 / x)); elseif ((z <= -3e-175) || (!(z <= -4.2e-301) && (z <= 3.25e-16))) 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.2e-6) tmp = x + (-1.0 / x); elseif ((z <= -3e-175) || (~((z <= -4.2e-301)) && (z <= 3.25e-16))) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.2e-6], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3e-175], And[N[Not[LessEqual[z, -4.2e-301]], $MachinePrecision], LessEqual[z, 3.25e-16]]], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-6}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-175} \lor \neg \left(z \leq -4.2 \cdot 10^{-301}\right) \land z \leq 3.25 \cdot 10^{-16}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.2000000000000001e-6Initial program 91.5%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -2.2000000000000001e-6 < z < -3e-175 or -4.1999999999999997e-301 < z < 3.25000000000000006e-16Initial program 99.8%
Simplified99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 81.4%
*-commutative81.4%
Simplified81.4%
if -3e-175 < z < -4.1999999999999997e-301 or 3.25000000000000006e-16 < z Initial program 96.8%
+-commutative96.8%
div-inv96.8%
fma-def96.7%
*-commutative96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in y around 0 94.8%
Final simplification90.4%
(FPCore (x y z)
:precision binary64
(if (<= z -8.5e-7)
(+ x (/ -1.0 x))
(if (<= z -3e-175)
(- x (* y -0.8862269254527579))
(if (<= z -4.2e-301)
x
(if (<= z 2.5e-16) (- x (/ y -1.1283791670955126)) x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.5e-7) {
tmp = x + (-1.0 / x);
} else if (z <= -3e-175) {
tmp = x - (y * -0.8862269254527579);
} else if (z <= -4.2e-301) {
tmp = x;
} else if (z <= 2.5e-16) {
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 <= (-8.5d-7)) then
tmp = x + ((-1.0d0) / x)
else if (z <= (-3d-175)) then
tmp = x - (y * (-0.8862269254527579d0))
else if (z <= (-4.2d-301)) then
tmp = x
else if (z <= 2.5d-16) 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 <= -8.5e-7) {
tmp = x + (-1.0 / x);
} else if (z <= -3e-175) {
tmp = x - (y * -0.8862269254527579);
} else if (z <= -4.2e-301) {
tmp = x;
} else if (z <= 2.5e-16) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.5e-7: tmp = x + (-1.0 / x) elif z <= -3e-175: tmp = x - (y * -0.8862269254527579) elif z <= -4.2e-301: tmp = x elif z <= 2.5e-16: tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.5e-7) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= -3e-175) tmp = Float64(x - Float64(y * -0.8862269254527579)); elseif (z <= -4.2e-301) tmp = x; elseif (z <= 2.5e-16) 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 <= -8.5e-7) tmp = x + (-1.0 / x); elseif (z <= -3e-175) tmp = x - (y * -0.8862269254527579); elseif (z <= -4.2e-301) tmp = x; elseif (z <= 2.5e-16) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.5e-7], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3e-175], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.2e-301], x, If[LessEqual[z, 2.5e-16], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-7}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-175}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-301}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-16}:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.50000000000000014e-7Initial program 91.5%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -8.50000000000000014e-7 < z < -3e-175Initial program 99.7%
Simplified99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around 0 78.5%
*-commutative78.5%
Simplified78.5%
if -3e-175 < z < -4.1999999999999997e-301 or 2.5000000000000002e-16 < z Initial program 96.8%
+-commutative96.8%
div-inv96.8%
fma-def96.7%
*-commutative96.7%
*-commutative96.7%
Applied egg-rr96.7%
Taylor expanded in y around 0 94.8%
if -4.1999999999999997e-301 < z < 2.5000000000000002e-16Initial program 99.8%
Simplified99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around 0 83.6%
*-commutative83.6%
Simplified83.6%
metadata-eval83.5%
div-inv83.6%
Applied egg-rr83.6%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (<= z -1150000.0) (+ x (/ -1.0 x)) (if (<= z 4e-16) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1150000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 4e-16) {
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 <= (-1150000.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 4d-16) 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 <= -1150000.0) {
tmp = x + (-1.0 / x);
} else if (z <= 4e-16) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1150000.0: tmp = x + (-1.0 / x) elif z <= 4e-16: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1150000.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 4e-16) 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 <= -1150000.0) tmp = x + (-1.0 / x); elseif (z <= 4e-16) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1150000.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-16], 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 -1150000:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-16}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.15e6Initial program 90.9%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1.15e6 < z < 3.9999999999999999e-16Initial program 99.8%
Taylor expanded in z around 0 99.8%
if 3.9999999999999999e-16 < z Initial program 95.3%
+-commutative95.3%
div-inv95.3%
fma-def95.3%
*-commutative95.3%
*-commutative95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= x -4e-162)
x
(if (<= x 2.55e-116)
(- x (* y -0.8862269254527579))
(if (<= x 1.2e-61) (/ -1.0 x) x))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e-162) {
tmp = x;
} else if (x <= 2.55e-116) {
tmp = x - (y * -0.8862269254527579);
} else if (x <= 1.2e-61) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-4d-162)) then
tmp = x
else if (x <= 2.55d-116) then
tmp = x - (y * (-0.8862269254527579d0))
else if (x <= 1.2d-61) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4e-162) {
tmp = x;
} else if (x <= 2.55e-116) {
tmp = x - (y * -0.8862269254527579);
} else if (x <= 1.2e-61) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e-162: tmp = x elif x <= 2.55e-116: tmp = x - (y * -0.8862269254527579) elif x <= 1.2e-61: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e-162) tmp = x; elseif (x <= 2.55e-116) tmp = Float64(x - Float64(y * -0.8862269254527579)); elseif (x <= 1.2e-61) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4e-162) tmp = x; elseif (x <= 2.55e-116) tmp = x - (y * -0.8862269254527579); elseif (x <= 1.2e-61) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e-162], x, If[LessEqual[x, 2.55e-116], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-61], N[(-1.0 / x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-162}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{-116}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-61}:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.99999999999999982e-162 or 1.2e-61 < x Initial program 97.6%
+-commutative97.6%
div-inv97.6%
fma-def97.6%
*-commutative97.6%
*-commutative97.6%
Applied egg-rr97.6%
Taylor expanded in y around 0 88.5%
if -3.99999999999999982e-162 < x < 2.5500000000000001e-116Initial program 94.9%
Simplified99.8%
Taylor expanded in z around 0 70.9%
Taylor expanded in x around 0 62.4%
*-commutative62.4%
Simplified62.4%
if 2.5500000000000001e-116 < x < 1.2e-61Initial program 99.6%
Simplified100.0%
Taylor expanded in x around inf 87.7%
Taylor expanded in x around 0 87.7%
Final simplification80.2%
(FPCore (x y z) :precision binary64 (if (<= x -3.2e-164) x (if (<= x 3.3e-163) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e-164) {
tmp = x;
} else if (x <= 3.3e-163) {
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 <= (-3.2d-164)) then
tmp = x
else if (x <= 3.3d-163) 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 <= -3.2e-164) {
tmp = x;
} else if (x <= 3.3e-163) {
tmp = y * 0.8862269254527579;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.2e-164: tmp = x elif x <= 3.3e-163: tmp = y * 0.8862269254527579 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.2e-164) tmp = x; elseif (x <= 3.3e-163) tmp = Float64(y * 0.8862269254527579); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.2e-164) tmp = x; elseif (x <= 3.3e-163) tmp = y * 0.8862269254527579; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.2e-164], x, If[LessEqual[x, 3.3e-163], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-164}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-163}:\\
\;\;\;\;y \cdot 0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.2e-164 or 3.30000000000000001e-163 < x Initial program 97.8%
+-commutative97.8%
div-inv97.8%
fma-def97.8%
*-commutative97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in y around 0 82.8%
if -3.2e-164 < x < 3.30000000000000001e-163Initial program 93.9%
Simplified99.8%
Taylor expanded in z around 0 67.8%
Taylor expanded in y around 0 67.9%
Taylor expanded in x around 0 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification74.4%
(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%
+-commutative96.8%
div-inv96.8%
fma-def96.8%
*-commutative96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in y around 0 69.0%
Final simplification69.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 2024013
(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)))))