
(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 -5e+98) (not (<= y 0.0005))) (+ 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 <= -5e+98) || !(y <= 0.0005)) {
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 <= (-5d+98)) .or. (.not. (y <= 0.0005d0))) 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 <= -5e+98) || !(y <= 0.0005)) {
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 <= -5e+98) or not (y <= 0.0005): 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 <= -5e+98) || !(y <= 0.0005)) 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 <= -5e+98) || ~((y <= 0.0005))) 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, -5e+98], N[Not[LessEqual[y, 0.0005]], $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 -5 \cdot 10^{+98} \lor \neg \left(y \leq 0.0005\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 < -4.9999999999999998e98 or 5.0000000000000001e-4 < y Initial program 87.2%
*-commutative87.2%
exp-to-pow87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
if -4.9999999999999998e98 < y < 5.0000000000000001e-4Initial program 83.7%
exp-prod99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.8) (not (<= y 0.082))) (+ x (/ (exp (- z)) y)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.8) || !(y <= 0.082)) {
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 <= (-7.8d0)) .or. (.not. (y <= 0.082d0))) 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 <= -7.8) || !(y <= 0.082)) {
tmp = x + (Math.exp(-z) / y);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.8) or not (y <= 0.082): tmp = x + (math.exp(-z) / y) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.8) || !(y <= 0.082)) 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 <= -7.8) || ~((y <= 0.082))) tmp = x + (exp(-z) / y); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.8], N[Not[LessEqual[y, 0.082]], $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 -7.8 \lor \neg \left(y \leq 0.082\right):\\
\;\;\;\;x + \frac{e^{-z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -7.79999999999999982 or 0.0820000000000000034 < y Initial program 88.4%
*-commutative88.4%
exp-to-pow88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
if -7.79999999999999982 < y < 0.0820000000000000034Initial program 81.1%
exp-prod99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 98.8%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= z -2.6e+76) (/ (exp (- z)) y) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.6e+76) {
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.6d+76)) 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.6e+76) {
tmp = Math.exp(-z) / y;
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.6e+76: tmp = math.exp(-z) / y else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.6e+76) 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.6e+76) tmp = exp(-z) / y; else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.6e+76], 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.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{e^{-z}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if z < -2.5999999999999999e76Initial program 44.9%
*-commutative44.9%
exp-to-pow44.9%
+-commutative44.9%
Simplified44.9%
Taylor expanded in y around inf 66.8%
mul-1-neg66.8%
Simplified66.8%
Taylor expanded in x around 0 66.8%
if -2.5999999999999999e76 < z Initial program 93.2%
exp-prod96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in y around 0 93.7%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (if (<= y -7.8) (+ x (/ (+ (- 1.0 z) (* z (* z 0.5))) y)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.8) {
tmp = x + (((1.0 - z) + (z * (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 <= (-7.8d0)) then
tmp = x + (((1.0d0 - z) + (z * (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 <= -7.8) {
tmp = x + (((1.0 - z) + (z * (z * 0.5))) / y);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7.8: tmp = x + (((1.0 - z) + (z * (z * 0.5))) / y) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7.8) tmp = Float64(x + Float64(Float64(Float64(1.0 - z) + Float64(z * 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 <= -7.8) tmp = x + (((1.0 - z) + (z * (z * 0.5))) / y); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7.8], N[(x + N[(N[(N[(1.0 - z), $MachinePrecision] + N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8:\\
\;\;\;\;x + \frac{\left(1 - z\right) + z \cdot \left(z \cdot 0.5\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -7.79999999999999982Initial program 87.1%
exp-prod87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in y around inf 66.5%
associate-+r+66.5%
+-commutative66.5%
associate-*r/66.5%
distribute-rgt-out66.5%
metadata-eval66.5%
*-rgt-identity66.5%
associate-*l/66.5%
metadata-eval66.5%
associate-*r/66.5%
distribute-rgt-in82.9%
mul-1-neg82.9%
unsub-neg82.9%
unpow282.9%
associate-*r/82.9%
metadata-eval82.9%
Simplified82.9%
Taylor expanded in y around inf 82.9%
unpow282.9%
*-commutative82.9%
associate-*l*82.9%
Simplified82.9%
if -7.79999999999999982 < y Initial program 85.0%
exp-prod95.1%
+-commutative95.1%
Simplified95.1%
Taylor expanded in y around 0 91.3%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+150) (+ x (/ (* z (* z 0.5)) y)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+150) {
tmp = x + ((z * (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 <= (-3.8d+150)) then
tmp = x + ((z * (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 <= -3.8e+150) {
tmp = x + ((z * (z * 0.5)) / y);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+150: tmp = x + ((z * (z * 0.5)) / y) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+150) tmp = Float64(x + Float64(Float64(z * 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 <= -3.8e+150) tmp = x + ((z * (z * 0.5)) / y); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+150], N[(x + N[(N[(z * N[(z * 0.5), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+150}:\\
\;\;\;\;x + \frac{z \cdot \left(z \cdot 0.5\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -3.79999999999999989e150Initial program 82.9%
exp-prod82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in y around inf 61.5%
associate-+r+61.5%
+-commutative61.5%
associate-*r/61.5%
distribute-rgt-out61.5%
metadata-eval61.5%
*-rgt-identity61.5%
associate-*l/61.5%
metadata-eval61.5%
associate-*r/61.5%
distribute-rgt-in81.1%
mul-1-neg81.1%
unsub-neg81.1%
unpow281.1%
associate-*r/81.1%
metadata-eval81.1%
Simplified81.1%
Taylor expanded in y around inf 81.1%
unpow281.1%
*-commutative81.1%
associate-*l*81.1%
Simplified81.1%
Taylor expanded in z around inf 79.2%
unpow279.2%
*-commutative79.2%
associate-*r*79.2%
Simplified79.2%
if -3.79999999999999989e150 < y Initial program 86.4%
exp-prod95.1%
+-commutative95.1%
Simplified95.1%
Taylor expanded in y around 0 88.9%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -3.1e+229) (* (/ 0.5 y) (* z z)) (+ x (/ 1.0 y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e+229) {
tmp = (0.5 / y) * (z * z);
} 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 <= (-3.1d+229)) then
tmp = (0.5d0 / y) * (z * z)
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 <= -3.1e+229) {
tmp = (0.5 / y) * (z * z);
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e+229: tmp = (0.5 / y) * (z * z) else: tmp = x + (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e+229) tmp = Float64(Float64(0.5 / y) * Float64(z * z)); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e+229) tmp = (0.5 / y) * (z * z); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e+229], N[(N[(0.5 / y), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+229}:\\
\;\;\;\;\frac{0.5}{y} \cdot \left(z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if z < -3.10000000000000014e229Initial program 58.8%
exp-prod85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in y around inf 0.0%
associate-+r+0.0%
+-commutative0.0%
associate-*r/0.0%
distribute-rgt-out7.1%
metadata-eval7.1%
*-rgt-identity7.1%
associate-*l/7.1%
metadata-eval7.1%
associate-*r/7.1%
distribute-rgt-in71.5%
mul-1-neg71.5%
unsub-neg71.5%
unpow271.5%
associate-*r/71.5%
metadata-eval71.5%
Simplified71.5%
Taylor expanded in z around inf 71.5%
unpow271.5%
*-commutative71.5%
associate-*r/71.5%
metadata-eval71.5%
+-commutative71.5%
associate-*r/71.5%
metadata-eval71.5%
unpow271.5%
Simplified71.5%
Taylor expanded in y around inf 72.9%
if -3.10000000000000014e229 < z Initial program 87.2%
exp-prod93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in y around 0 87.8%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= y -3.2e+97) x (if (<= y 1.0) (/ 1.0 y) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.2e+97) {
tmp = x;
} else if (y <= 1.0) {
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 <= (-3.2d+97)) then
tmp = x
else if (y <= 1.0d0) 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 <= -3.2e+97) {
tmp = x;
} else if (y <= 1.0) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.2e+97: tmp = x elif y <= 1.0: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.2e+97) tmp = x; elseif (y <= 1.0) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.2e+97) tmp = x; elseif (y <= 1.0) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.2e+97], x, If[LessEqual[y, 1.0], N[(1.0 / y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+97}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.20000000000000016e97 or 1 < y Initial program 87.3%
*-commutative87.3%
exp-to-pow87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 69.8%
if -3.20000000000000016e97 < y < 1Initial program 83.5%
*-commutative83.5%
exp-to-pow83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in y around inf 65.3%
mul-1-neg65.3%
Simplified65.3%
Taylor expanded in x around 0 48.1%
Taylor expanded in z around 0 72.0%
Final simplification70.7%
(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 85.7%
exp-prod92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in y around 0 84.7%
Final simplification84.7%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.7%
*-commutative85.7%
exp-to-pow85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in y around inf 85.1%
mul-1-neg85.1%
Simplified85.1%
Taylor expanded in x around inf 50.1%
Final simplification50.1%
(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 2023290
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
:herbie-target
(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)))