
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
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) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
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) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ y z) (/ (/ x (+ z 1.0)) z)))
assert(x < y && y < z);
double code(double x, double y, double z) {
return (y / z) * ((x / (z + 1.0)) / z);
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y / z) * ((x / (z + 1.0d0)) / z)
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return (y / z) * ((x / (z + 1.0)) / z);
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return (y / z) * ((x / (z + 1.0)) / z)
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(Float64(y / z) * Float64(Float64(x / Float64(z + 1.0)) / z)) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = (y / z) * ((x / (z + 1.0)) / z);
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(N[(x / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\frac{y}{z} \cdot \frac{\frac{x}{z + 1}}{z}
\end{array}
Initial program 83.7%
*-commutative83.7%
frac-times88.3%
associate-*l/86.9%
times-frac98.2%
Applied egg-rr98.2%
Final simplification98.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.043))) (* (/ y z) (/ (/ x z) z)) (/ y (* z (/ z x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (y / z) * ((x / z) / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) .or. (.not. (z <= 0.043d0))) then
tmp = (y / z) * ((x / z) / z)
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (y / z) * ((x / z) / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.043): tmp = (y / z) * ((x / z) / z) else: tmp = y / (z * (z / x)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.043)) tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z)); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 0.043)))
tmp = (y / z) * ((x / z) / z);
else
tmp = y / (z * (z / x));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.043]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.043\right):\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if z < -1 or 0.042999999999999997 < z Initial program 87.5%
*-commutative87.5%
frac-times93.9%
associate-*l/93.9%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 95.7%
if -1 < z < 0.042999999999999997Initial program 80.0%
*-commutative80.0%
associate-/l*81.3%
sqr-neg81.3%
associate-/r*81.3%
sqr-neg81.3%
Simplified81.3%
*-commutative81.3%
clear-num81.2%
associate-*l/81.2%
associate-/r/82.0%
frac-times82.9%
associate-/r*88.8%
frac-times98.2%
*-un-lft-identity98.2%
Applied egg-rr98.2%
associate-/r*97.9%
div-inv97.9%
clear-num98.0%
associate-*r/98.2%
associate-*l/96.6%
associate-/l*89.6%
associate-/l/89.6%
Applied egg-rr89.6%
Taylor expanded in z around 0 87.5%
clear-num87.5%
un-div-inv88.2%
div-inv88.2%
clear-num88.2%
Applied egg-rr88.2%
Final simplification91.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.043))) (/ (/ x z) (* z (/ z y))) (/ y (* z (/ z x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (x / z) / (z * (z / y));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) .or. (.not. (z <= 0.043d0))) then
tmp = (x / z) / (z * (z / y))
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (x / z) / (z * (z / y));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.043): tmp = (x / z) / (z * (z / y)) else: tmp = y / (z * (z / x)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.043)) tmp = Float64(Float64(x / z) / Float64(z * Float64(z / y))); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 0.043)))
tmp = (x / z) / (z * (z / y));
else
tmp = y / (z * (z / x));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.043]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.043\right):\\
\;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if z < -1 or 0.042999999999999997 < z Initial program 87.5%
*-commutative87.5%
frac-times93.9%
associate-*l/93.9%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 95.7%
clear-num95.7%
frac-times94.5%
*-un-lft-identity94.5%
Applied egg-rr94.5%
if -1 < z < 0.042999999999999997Initial program 80.0%
*-commutative80.0%
associate-/l*81.3%
sqr-neg81.3%
associate-/r*81.3%
sqr-neg81.3%
Simplified81.3%
*-commutative81.3%
clear-num81.2%
associate-*l/81.2%
associate-/r/82.0%
frac-times82.9%
associate-/r*88.8%
frac-times98.2%
*-un-lft-identity98.2%
Applied egg-rr98.2%
associate-/r*97.9%
div-inv97.9%
clear-num98.0%
associate-*r/98.2%
associate-*l/96.6%
associate-/l*89.6%
associate-/l/89.6%
Applied egg-rr89.6%
Taylor expanded in z around 0 87.5%
clear-num87.5%
un-div-inv88.2%
div-inv88.2%
clear-num88.2%
Applied egg-rr88.2%
Final simplification91.3%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.043))) (/ (/ x z) (/ z (/ y z))) (/ y (* z (/ z x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (x / z) / (z / (y / z));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-1.0d0)) .or. (.not. (z <= 0.043d0))) then
tmp = (x / z) / (z / (y / z))
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.043)) {
tmp = (x / z) / (z / (y / z));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.043): tmp = (x / z) / (z / (y / z)) else: tmp = y / (z * (z / x)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.043)) tmp = Float64(Float64(x / z) / Float64(z / Float64(y / z))); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 0.043)))
tmp = (x / z) / (z / (y / z));
else
tmp = y / (z * (z / x));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.043]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] / N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.043\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{\frac{y}{z}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if z < -1 or 0.042999999999999997 < z Initial program 87.5%
*-commutative87.5%
frac-times93.9%
associate-*l/93.9%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 95.7%
clear-num95.7%
frac-times94.5%
*-un-lft-identity94.5%
Applied egg-rr94.5%
*-commutative94.5%
clear-num94.5%
un-div-inv94.6%
Applied egg-rr94.6%
if -1 < z < 0.042999999999999997Initial program 80.0%
*-commutative80.0%
associate-/l*81.3%
sqr-neg81.3%
associate-/r*81.3%
sqr-neg81.3%
Simplified81.3%
*-commutative81.3%
clear-num81.2%
associate-*l/81.2%
associate-/r/82.0%
frac-times82.9%
associate-/r*88.8%
frac-times98.2%
*-un-lft-identity98.2%
Applied egg-rr98.2%
associate-/r*97.9%
div-inv97.9%
clear-num98.0%
associate-*r/98.2%
associate-*l/96.6%
associate-/l*89.6%
associate-/l/89.6%
Applied egg-rr89.6%
Taylor expanded in z around 0 87.5%
clear-num87.5%
un-div-inv88.2%
div-inv88.2%
clear-num88.2%
Applied egg-rr88.2%
Final simplification91.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1e-137) (* y (/ (/ x (* z z)) (+ z 1.0))) (if (<= z 0.043) (/ (* y (/ x z)) z) (/ (/ x z) (/ z (/ y z))))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -1e-137) {
tmp = y * ((x / (z * z)) / (z + 1.0));
} else if (z <= 0.043) {
tmp = (y * (x / z)) / z;
} else {
tmp = (x / z) / (z / (y / z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-1d-137)) then
tmp = y * ((x / (z * z)) / (z + 1.0d0))
else if (z <= 0.043d0) then
tmp = (y * (x / z)) / z
else
tmp = (x / z) / (z / (y / z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1e-137) {
tmp = y * ((x / (z * z)) / (z + 1.0));
} else if (z <= 0.043) {
tmp = (y * (x / z)) / z;
} else {
tmp = (x / z) / (z / (y / z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -1e-137: tmp = y * ((x / (z * z)) / (z + 1.0)) elif z <= 0.043: tmp = (y * (x / z)) / z else: tmp = (x / z) / (z / (y / z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -1e-137) tmp = Float64(y * Float64(Float64(x / Float64(z * z)) / Float64(z + 1.0))); elseif (z <= 0.043) tmp = Float64(Float64(y * Float64(x / z)) / z); else tmp = Float64(Float64(x / z) / Float64(z / Float64(y / z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1e-137)
tmp = y * ((x / (z * z)) / (z + 1.0));
elseif (z <= 0.043)
tmp = (y * (x / z)) / z;
else
tmp = (x / z) / (z / (y / z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1e-137], N[(y * N[(N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.043], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-137}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z \cdot z}}{z + 1}\\
\mathbf{elif}\;z \leq 0.043:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{\frac{y}{z}}}\\
\end{array}
\end{array}
if z < -9.99999999999999978e-138Initial program 88.5%
*-commutative88.5%
associate-/l*90.2%
sqr-neg90.2%
associate-/r*92.3%
sqr-neg92.3%
Simplified92.3%
if -9.99999999999999978e-138 < z < 0.042999999999999997Initial program 77.3%
*-commutative77.3%
sqr-neg77.3%
times-frac79.4%
sqr-neg79.4%
Simplified79.4%
Taylor expanded in z around 0 78.5%
associate-*l/76.4%
*-commutative76.4%
associate-/r*85.7%
*-commutative85.7%
associate-*r/97.1%
Applied egg-rr97.1%
if 0.042999999999999997 < z Initial program 87.2%
*-commutative87.2%
frac-times93.8%
associate-*l/94.0%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 96.0%
clear-num96.0%
frac-times93.1%
*-un-lft-identity93.1%
Applied egg-rr93.1%
*-commutative93.1%
clear-num93.1%
un-div-inv93.2%
Applied egg-rr93.2%
Final simplification94.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z 800000000000.0) (* y (/ (/ x (* z (+ z 1.0))) z)) (/ (/ x z) (/ z (/ y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= 800000000000.0) {
tmp = y * ((x / (z * (z + 1.0))) / z);
} else {
tmp = (x / z) / (z / (y / z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= 800000000000.0d0) then
tmp = y * ((x / (z * (z + 1.0d0))) / z)
else
tmp = (x / z) / (z / (y / z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= 800000000000.0) {
tmp = y * ((x / (z * (z + 1.0))) / z);
} else {
tmp = (x / z) / (z / (y / z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= 800000000000.0: tmp = y * ((x / (z * (z + 1.0))) / z) else: tmp = (x / z) / (z / (y / z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= 800000000000.0) tmp = Float64(y * Float64(Float64(x / Float64(z * Float64(z + 1.0))) / z)); else tmp = Float64(Float64(x / z) / Float64(z / Float64(y / z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= 800000000000.0)
tmp = y * ((x / (z * (z + 1.0))) / z);
else
tmp = (x / z) / (z / (y / z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, 800000000000.0], N[(y * N[(N[(x / N[(z * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 800000000000:\\
\;\;\;\;y \cdot \frac{\frac{x}{z \cdot \left(z + 1\right)}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{\frac{y}{z}}}\\
\end{array}
\end{array}
if z < 8e11Initial program 82.9%
*-commutative82.9%
associate-/l*85.2%
sqr-neg85.2%
associate-/r*86.2%
sqr-neg86.2%
Simplified86.2%
*-commutative86.2%
clear-num86.1%
associate-*l/86.1%
associate-/r/86.6%
frac-times86.8%
associate-/r*92.2%
frac-times98.1%
*-un-lft-identity98.1%
Applied egg-rr98.1%
associate-/r*98.1%
div-inv98.1%
clear-num98.2%
associate-*r/98.2%
associate-*l/97.6%
associate-/l*91.6%
associate-/l/91.5%
Applied egg-rr91.5%
if 8e11 < z Initial program 86.6%
*-commutative86.6%
frac-times93.5%
associate-*l/93.7%
times-frac98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 98.2%
clear-num98.2%
frac-times95.1%
*-un-lft-identity95.1%
Applied egg-rr95.1%
*-commutative95.1%
clear-num95.1%
un-div-inv95.2%
Applied egg-rr95.2%
Final simplification92.4%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* y (/ (/ x z) z)))
assert(x < y && y < z);
double code(double x, double y, double z) {
return y * ((x / z) / z);
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((x / z) / z)
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return y * ((x / z) / z);
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return y * ((x / z) / z)
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(y * Float64(Float64(x / z) / z)) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = y * ((x / z) / z);
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
y \cdot \frac{\frac{x}{z}}{z}
\end{array}
Initial program 83.7%
*-commutative83.7%
associate-/l*86.3%
sqr-neg86.3%
associate-/r*87.8%
sqr-neg87.8%
Simplified87.8%
*-commutative87.8%
clear-num87.7%
associate-*l/87.7%
associate-/r/88.1%
frac-times88.3%
associate-/r*93.1%
frac-times98.1%
*-un-lft-identity98.1%
Applied egg-rr98.1%
associate-/r*97.8%
div-inv97.8%
clear-num97.9%
associate-*r/98.2%
associate-*l/97.4%
associate-/l*92.3%
associate-/l/92.0%
Applied egg-rr92.0%
Taylor expanded in z around 0 74.0%
Final simplification74.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ y (* z (/ z x))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return y / (z * (z / x));
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (z * (z / x))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return y / (z * (z / x));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return y / (z * (z / x))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(y / Float64(z * Float64(z / x))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = y / (z * (z / x));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\frac{y}{z \cdot \frac{z}{x}}
\end{array}
Initial program 83.7%
*-commutative83.7%
associate-/l*86.3%
sqr-neg86.3%
associate-/r*87.8%
sqr-neg87.8%
Simplified87.8%
*-commutative87.8%
clear-num87.7%
associate-*l/87.7%
associate-/r/88.1%
frac-times88.3%
associate-/r*93.1%
frac-times98.1%
*-un-lft-identity98.1%
Applied egg-rr98.1%
associate-/r*97.8%
div-inv97.8%
clear-num97.9%
associate-*r/98.2%
associate-*l/97.4%
associate-/l*92.3%
associate-/l/92.0%
Applied egg-rr92.0%
Taylor expanded in z around 0 74.0%
clear-num74.6%
un-div-inv75.0%
div-inv75.0%
clear-num75.0%
Applied egg-rr75.0%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z)))
double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z < 249.6182814532307d0) then
tmp = (y * (x / z)) / (z + (z * z))
else
tmp = (((y / z) / (1.0d0 + z)) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < 249.6182814532307: tmp = (y * (x / z)) / (z + (z * z)) else: tmp = (((y / z) / (1.0 + z)) * x) / z return tmp
function code(x, y, z) tmp = 0.0 if (z < 249.6182814532307) tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z))); else tmp = Float64(Float64(Float64(Float64(y / z) / Float64(1.0 + z)) * x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < 249.6182814532307) tmp = (y * (x / z)) / (z + (z * z)); else tmp = (((y / z) / (1.0 + z)) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, 249.6182814532307], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / z), $MachinePrecision] / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\
\end{array}
\end{array}
herbie shell --seed 2024079
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:alt
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))