
(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
double code(double x, double y, double z) {
return x + (exp((y * log((y / (z + y))))) / 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 + (exp((y * log((y / (z + y))))) / y)
end function
public static double code(double x, double y, double z) {
return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
def code(x, y, z): return x + (math.exp((y * math.log((y / (z + y))))) / y)
function code(x, y, z) return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y)) end
function tmp = code(x, y, z) tmp = x + (exp((y * log((y / (z + y))))) / y); end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
double code(double x, double y, double z) {
return x + (exp((y * log((y / (z + y))))) / 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 + (exp((y * log((y / (z + y))))) / y)
end function
public static double code(double x, double y, double z) {
return x + (Math.exp((y * Math.log((y / (z + y))))) / y);
}
def code(x, y, z): return x + (math.exp((y * math.log((y / (z + y))))) / y)
function code(x, y, z) return Float64(x + Float64(exp(Float64(y * log(Float64(y / Float64(z + y))))) / y)) end
function tmp = code(x, y, z) tmp = x + (exp((y * log((y / (z + y))))) / y); end
code[x_, y_, z_] := N[(x + N[(N[Exp[N[(y * N[Log[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -9e+76) (not (<= y 2e-14))) (+ x (/ (exp (- z)) y)) (+ x (/ (pow (exp y) (log (/ y (+ y z)))) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9e+76) || !(y <= 2e-14)) {
tmp = x + (exp(-z) / y);
} else {
tmp = x + (pow(exp(y), log((y / (y + z)))) / y);
}
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 ((y <= (-9d+76)) .or. (.not. (y <= 2d-14))) then
tmp = x + (exp(-z) / y)
else
tmp = x + ((exp(y) ** log((y / (y + z)))) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9e+76) || !(y <= 2e-14)) {
tmp = x + (Math.exp(-z) / y);
} else {
tmp = x + (Math.pow(Math.exp(y), Math.log((y / (y + z)))) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9e+76) or not (y <= 2e-14): tmp = x + (math.exp(-z) / y) else: tmp = x + (math.pow(math.exp(y), math.log((y / (y + z)))) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9e+76) || !(y <= 2e-14)) tmp = Float64(x + Float64(exp(Float64(-z)) / y)); else tmp = Float64(x + Float64((exp(y) ^ log(Float64(y / Float64(y + z)))) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9e+76) || ~((y <= 2e-14))) tmp = x + (exp(-z) / y); else tmp = x + ((exp(y) ^ log((y / (y + z)))) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9e+76], N[Not[LessEqual[y, 2e-14]], $MachinePrecision]], N[(x + N[(N[Exp[(-z)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Power[N[Exp[y], $MachinePrecision], N[Log[N[(y / N[(y + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+76} \lor \neg \left(y \leq 2 \cdot 10^{-14}\right):\\
\;\;\;\;x + \frac{e^{-z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{{\left(e^{y}\right)}^{\log \left(\frac{y}{y + z}\right)}}{y}\\
\end{array}
\end{array}
if y < -8.9999999999999995e76 or 2e-14 < y Initial program 83.1%
*-commutative83.1%
exp-to-pow83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
if -8.9999999999999995e76 < y < 2e-14Initial program 80.8%
exp-prod99.9%
+-commutative99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 3.5e-14))) (+ x (/ (exp (- z)) y)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 3.5e-14)) {
tmp = x + (exp(-z) / y);
} else {
tmp = x + (1.0 / y);
}
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 ((y <= (-1.0d0)) .or. (.not. (y <= 3.5d-14))) then
tmp = x + (exp(-z) / y)
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 3.5e-14)) {
tmp = x + (Math.exp(-z) / y);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 3.5e-14): tmp = x + (math.exp(-z) / y) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 3.5e-14)) tmp = Float64(x + Float64(exp(Float64(-z)) / y)); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 3.5e-14))) tmp = x + (exp(-z) / y); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 3.5e-14]], $MachinePrecision]], N[(x + N[(N[Exp[(-z)], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 3.5 \cdot 10^{-14}\right):\\
\;\;\;\;x + \frac{e^{-z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -1 or 3.5000000000000002e-14 < y Initial program 83.9%
*-commutative83.9%
exp-to-pow83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
if -1 < y < 3.5000000000000002e-14Initial program 79.5%
exp-prod99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 99.9%
+-commutative99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= z -2.45e+185) (/ (+ 1.0 (* y x)) y) (if (<= z -5200000.0) (/ (exp (- z)) y) (+ x (/ 1.0 y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.45e+185) {
tmp = (1.0 + (y * x)) / y;
} else if (z <= -5200000.0) {
tmp = exp(-z) / y;
} else {
tmp = x + (1.0 / y);
}
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.45d+185)) then
tmp = (1.0d0 + (y * x)) / y
else if (z <= (-5200000.0d0)) then
tmp = exp(-z) / y
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.45e+185) {
tmp = (1.0 + (y * x)) / y;
} else if (z <= -5200000.0) {
tmp = Math.exp(-z) / y;
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.45e+185: tmp = (1.0 + (y * x)) / y elif z <= -5200000.0: tmp = math.exp(-z) / y else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.45e+185) tmp = Float64(Float64(1.0 + Float64(y * x)) / y); elseif (z <= -5200000.0) tmp = Float64(exp(Float64(-z)) / y); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.45e+185) tmp = (1.0 + (y * x)) / y; elseif (z <= -5200000.0) tmp = exp(-z) / y; else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.45e+185], N[(N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[z, -5200000.0], N[(N[Exp[(-z)], $MachinePrecision] / y), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+185}:\\
\;\;\;\;\frac{1 + y \cdot x}{y}\\
\mathbf{elif}\;z \leq -5200000:\\
\;\;\;\;\frac{e^{-z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if z < -2.44999999999999992e185Initial program 40.2%
exp-prod89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in y around inf 58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in y around 0 73.8%
*-commutative73.8%
Simplified73.8%
if -2.44999999999999992e185 < z < -5.2e6Initial program 44.2%
*-commutative44.2%
exp-to-pow44.2%
+-commutative44.2%
Simplified44.2%
Taylor expanded in y around inf 68.4%
mul-1-neg68.4%
Simplified68.4%
Taylor expanded in x around 0 68.4%
if -5.2e6 < z Initial program 92.1%
exp-prod96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in y around inf 94.6%
+-commutative94.6%
Simplified94.6%
Final simplification89.7%
(FPCore (x y z)
:precision binary64
(if (<= y -3.2e+53)
(+
x
(+
(/ 1.0 y)
(*
z
(+
(* z (+ (* -0.16666666666666666 (/ z y)) (* (/ 1.0 y) 0.5)))
(/ -1.0 y)))))
(+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+53) {
tmp = x + ((1.0 / y) + (z * ((z * ((-0.16666666666666666 * (z / y)) + ((1.0 / y) * 0.5))) + (-1.0 / y))));
} else {
tmp = x + (1.0 / y);
}
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 (y <= (-3.2d+53)) then
tmp = x + ((1.0d0 / y) + (z * ((z * (((-0.16666666666666666d0) * (z / y)) + ((1.0d0 / y) * 0.5d0))) + ((-1.0d0) / y))))
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+53) {
tmp = x + ((1.0 / y) + (z * ((z * ((-0.16666666666666666 * (z / y)) + ((1.0 / y) * 0.5))) + (-1.0 / y))));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.2e+53: tmp = x + ((1.0 / y) + (z * ((z * ((-0.16666666666666666 * (z / y)) + ((1.0 / y) * 0.5))) + (-1.0 / y)))) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.2e+53) tmp = Float64(x + Float64(Float64(1.0 / y) + Float64(z * Float64(Float64(z * Float64(Float64(-0.16666666666666666 * Float64(z / y)) + Float64(Float64(1.0 / y) * 0.5))) + Float64(-1.0 / y))))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.2e+53) tmp = x + ((1.0 / y) + (z * ((z * ((-0.16666666666666666 * (z / y)) + ((1.0 / y) * 0.5))) + (-1.0 / y)))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+53], N[(x + N[(N[(1.0 / y), $MachinePrecision] + N[(z * N[(N[(z * N[(N[(-0.16666666666666666 * N[(z / y), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+53}:\\
\;\;\;\;x + \left(\frac{1}{y} + z \cdot \left(z \cdot \left(-0.16666666666666666 \cdot \frac{z}{y} + \frac{1}{y} \cdot 0.5\right) + \frac{-1}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -3.2e53Initial program 81.9%
*-commutative81.9%
exp-to-pow81.9%
+-commutative81.9%
Simplified81.9%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 80.6%
if -3.2e53 < y Initial program 82.2%
exp-prod94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in y around inf 90.7%
+-commutative90.7%
Simplified90.7%
Final simplification87.7%
(FPCore (x y z) :precision binary64 (if (<= y -0.86) (+ x (/ (+ 1.0 (* z (+ -1.0 (* z 0.5)))) y)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.86) {
tmp = x + ((1.0 + (z * (-1.0 + (z * 0.5)))) / y);
} else {
tmp = x + (1.0 / y);
}
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 (y <= (-0.86d0)) then
tmp = x + ((1.0d0 + (z * ((-1.0d0) + (z * 0.5d0)))) / y)
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -0.86) {
tmp = x + ((1.0 + (z * (-1.0 + (z * 0.5)))) / y);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.86: tmp = x + ((1.0 + (z * (-1.0 + (z * 0.5)))) / y) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.86) tmp = Float64(x + Float64(Float64(1.0 + Float64(z * Float64(-1.0 + Float64(z * 0.5)))) / y)); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.86) tmp = x + ((1.0 + (z * (-1.0 + (z * 0.5)))) / y); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.86], N[(x + N[(N[(1.0 + N[(z * N[(-1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.86:\\
\;\;\;\;x + \frac{1 + z \cdot \left(-1 + z \cdot 0.5\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -0.859999999999999987Initial program 82.6%
*-commutative82.6%
exp-to-pow82.6%
+-commutative82.6%
Simplified82.6%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 69.4%
Taylor expanded in y around 0 77.8%
if -0.859999999999999987 < y Initial program 81.9%
exp-prod94.1%
+-commutative94.1%
Simplified94.1%
Taylor expanded in y around inf 91.1%
+-commutative91.1%
Simplified91.1%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -6.2e+239) (/ (+ 1.0 (* z (+ -1.0 (* z 0.5)))) y) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+239) {
tmp = (1.0 + (z * (-1.0 + (z * 0.5)))) / y;
} else {
tmp = x + (1.0 / y);
}
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.2d+239)) then
tmp = (1.0d0 + (z * ((-1.0d0) + (z * 0.5d0)))) / y
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+239) {
tmp = (1.0 + (z * (-1.0 + (z * 0.5)))) / y;
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.2e+239: tmp = (1.0 + (z * (-1.0 + (z * 0.5)))) / y else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.2e+239) tmp = Float64(Float64(1.0 + Float64(z * Float64(-1.0 + Float64(z * 0.5)))) / y); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.2e+239) tmp = (1.0 + (z * (-1.0 + (z * 0.5)))) / y; else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.2e+239], N[(N[(1.0 + N[(z * N[(-1.0 + N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+239}:\\
\;\;\;\;\frac{1 + z \cdot \left(-1 + z \cdot 0.5\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if z < -6.20000000000000001e239Initial program 67.9%
*-commutative67.9%
exp-to-pow67.9%
+-commutative67.9%
Simplified67.9%
Taylor expanded in y around inf 79.0%
mul-1-neg79.0%
Simplified79.0%
Taylor expanded in z around 0 38.1%
Taylor expanded in y around 0 79.0%
Taylor expanded in y around 0 79.0%
if -6.20000000000000001e239 < z Initial program 82.6%
exp-prod90.7%
+-commutative90.7%
Simplified90.7%
Taylor expanded in y around inf 86.5%
+-commutative86.5%
Simplified86.5%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (if (<= y -7.6e-100) x (if (<= y 3.8e-6) (/ 1.0 y) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.6e-100) {
tmp = x;
} else if (y <= 3.8e-6) {
tmp = 1.0 / 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 (y <= (-7.6d-100)) then
tmp = x
else if (y <= 3.8d-6) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7.6e-100) {
tmp = x;
} else if (y <= 3.8e-6) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.6e-100: tmp = x elif y <= 3.8e-6: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.6e-100) tmp = x; elseif (y <= 3.8e-6) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7.6e-100) tmp = x; elseif (y <= 3.8e-6) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.6e-100], x, If[LessEqual[y, 3.8e-6], N[(1.0 / y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-100}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.59999999999999995e-100 or 3.8e-6 < y Initial program 85.1%
exp-prod85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in x around inf 63.9%
if -7.59999999999999995e-100 < y < 3.8e-6Initial program 76.9%
exp-prod99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 84.8%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 y)))
double code(double x, double y, double z) {
return x + (1.0 / 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 + (1.0d0 / y)
end function
public static double code(double x, double y, double z) {
return x + (1.0 / y);
}
def code(x, y, z): return x + (1.0 / y)
function code(x, y, z) return Float64(x + Float64(1.0 / y)) end
function tmp = code(x, y, z) tmp = x + (1.0 / y); end
code[x_, y_, z_] := N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{y}
\end{array}
Initial program 82.1%
exp-prod90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in y around inf 84.3%
+-commutative84.3%
Simplified84.3%
Final simplification84.3%
(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 82.1%
exp-prod90.6%
+-commutative90.6%
Simplified90.6%
Taylor expanded in x around inf 46.0%
Final simplification46.0%
(FPCore (x y z) :precision binary64 (if (< (/ y (+ z y)) 7.11541576e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y))))
double code(double x, double y, double z) {
double tmp;
if ((y / (z + y)) < 7.11541576e-315) {
tmp = x + (exp((-1.0 / z)) / y);
} else {
tmp = x + (exp(log(pow((y / (y + z)), y))) / y);
}
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 ((y / (z + y)) < 7.11541576d-315) then
tmp = x + (exp(((-1.0d0) / z)) / y)
else
tmp = x + (exp(log(((y / (y + z)) ** y))) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y / (z + y)) < 7.11541576e-315) {
tmp = x + (Math.exp((-1.0 / z)) / y);
} else {
tmp = x + (Math.exp(Math.log(Math.pow((y / (y + z)), y))) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y / (z + y)) < 7.11541576e-315: tmp = x + (math.exp((-1.0 / z)) / y) else: tmp = x + (math.exp(math.log(math.pow((y / (y + z)), y))) / y) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y / Float64(z + y)) < 7.11541576e-315) tmp = Float64(x + Float64(exp(Float64(-1.0 / z)) / y)); else tmp = Float64(x + Float64(exp(log((Float64(y / Float64(y + z)) ^ y))) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y / (z + y)) < 7.11541576e-315) tmp = x + (exp((-1.0 / z)) / y); else tmp = x + (exp(log(((y / (y + z)) ^ y))) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[N[(y / N[(z + y), $MachinePrecision]), $MachinePrecision], 7.11541576e-315], N[(x + N[(N[Exp[N[(-1.0 / z), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Exp[N[Log[N[Power[N[(y / N[(y + z), $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{y}{z + y} < 7.11541576 \cdot 10^{-315}:\\
\;\;\;\;x + \frac{e^{\frac{-1}{z}}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{e^{\log \left({\left(\frac{y}{y + z}\right)}^{y}\right)}}{y}\\
\end{array}
\end{array}
herbie shell --seed 2024071
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
:alt
(if (< (/ y (+ z y)) 7.11541576e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))