
(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 9 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 and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (* (/ x z) (/ y (+ z 1.0))) z))
assert(x < y);
double code(double x, double y, double z) {
return ((x / z) * (y / (z + 1.0))) / z;
}
NOTE: x and y 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 = ((x / z) * (y / (z + 1.0d0))) / z
end function
assert x < y;
public static double code(double x, double y, double z) {
return ((x / z) * (y / (z + 1.0))) / z;
}
[x, y] = sort([x, y]) def code(x, y, z): return ((x / z) * (y / (z + 1.0))) / z
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(x / z) * Float64(y / Float64(z + 1.0))) / z) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((x / z) * (y / (z + 1.0))) / z;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(N[(x / z), $MachinePrecision] * N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{z} \cdot \frac{y}{z + 1}}{z}
\end{array}
Initial program 83.7%
times-frac88.4%
associate-/r*93.9%
Simplified93.9%
associate-*l/96.7%
Applied egg-rr96.7%
Final simplification96.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 3.2e-16))) (* (/ x z) (/ (/ y z) z)) (/ (* (/ x z) y) z)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 3.2e-16)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = ((x / z) * y) / z;
}
return tmp;
}
NOTE: x and y 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 <= 3.2d-16))) then
tmp = (x / z) * ((y / z) / z)
else
tmp = ((x / z) * y) / z
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 3.2e-16)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = ((x / z) * y) / z;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 3.2e-16): tmp = (x / z) * ((y / z) / z) else: tmp = ((x / z) * y) / z return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 3.2e-16)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(Float64(x / z) * y) / z); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 3.2e-16)))
tmp = (x / z) * ((y / z) / z);
else
tmp = ((x / z) * y) / z;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 3.2e-16]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 3.2 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{z}\\
\end{array}
\end{array}
if z < -1 or 3.20000000000000023e-16 < z Initial program 85.4%
times-frac95.3%
associate-*l/95.3%
times-frac95.2%
Applied egg-rr95.2%
Taylor expanded in z around inf 93.4%
if -1 < z < 3.20000000000000023e-16Initial program 82.0%
times-frac81.8%
associate-/r*90.5%
Simplified90.5%
associate-*l/94.6%
Applied egg-rr94.6%
Taylor expanded in z around 0 92.0%
Final simplification92.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.35e-21))) (/ (* (/ x z) (/ y z)) z) (/ (* (/ x z) y) z)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.35e-21)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = ((x / z) * y) / z;
}
return tmp;
}
NOTE: x and y 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 <= 1.35d-21))) then
tmp = ((x / z) * (y / z)) / z
else
tmp = ((x / z) * y) / z
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.35e-21)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = ((x / z) * y) / z;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.35e-21): tmp = ((x / z) * (y / z)) / z else: tmp = ((x / z) * y) / z return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.35e-21)) tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); else tmp = Float64(Float64(Float64(x / z) * y) / z); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.35e-21)))
tmp = ((x / z) * (y / z)) / z;
else
tmp = ((x / z) * y) / z;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.35e-21]], $MachinePrecision]], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.35 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{z}\\
\end{array}
\end{array}
if z < -1 or 1.3500000000000001e-21 < z Initial program 85.5%
times-frac95.3%
associate-/r*97.4%
Simplified97.4%
associate-*l/98.9%
Applied egg-rr98.9%
Taylor expanded in z around inf 97.1%
if -1 < z < 1.3500000000000001e-21Initial program 81.8%
times-frac81.6%
associate-/r*90.4%
Simplified90.4%
associate-*l/94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 92.0%
Final simplification94.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (* (/ y z) (/ x (* z z))) (if (<= z 3.2e-16) (/ (* (/ x z) y) z) (* (/ x z) (/ (/ y z) z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (y / z) * (x / (z * z));
} else if (z <= 3.2e-16) {
tmp = ((x / z) * y) / z;
} else {
tmp = (x / z) * ((y / z) / z);
}
return tmp;
}
NOTE: x and y 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)) then
tmp = (y / z) * (x / (z * z))
else if (z <= 3.2d-16) then
tmp = ((x / z) * y) / z
else
tmp = (x / z) * ((y / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (y / z) * (x / (z * z));
} else if (z <= 3.2e-16) {
tmp = ((x / z) * y) / z;
} else {
tmp = (x / z) * ((y / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (y / z) * (x / (z * z)) elif z <= 3.2e-16: tmp = ((x / z) * y) / z else: tmp = (x / z) * ((y / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(y / z) * Float64(x / Float64(z * z))); elseif (z <= 3.2e-16) tmp = Float64(Float64(Float64(x / z) * y) / z); else tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1.0)
tmp = (y / z) * (x / (z * z));
elseif (z <= 3.2e-16)
tmp = ((x / z) * y) / z;
else
tmp = (x / z) * ((y / z) / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(y / z), $MachinePrecision] * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-16], N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z \cdot z}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-16}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 84.9%
times-frac97.2%
Simplified97.2%
Taylor expanded in z around inf 94.5%
if -1 < z < 3.20000000000000023e-16Initial program 82.0%
times-frac81.8%
associate-/r*90.5%
Simplified90.5%
associate-*l/94.6%
Applied egg-rr94.6%
Taylor expanded in z around 0 92.0%
if 3.20000000000000023e-16 < z Initial program 85.9%
times-frac93.6%
associate-*l/93.0%
times-frac93.6%
Applied egg-rr93.6%
Taylor expanded in z around inf 92.6%
Final simplification92.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ x z) (/ (/ y (+ z 1.0)) z)))
assert(x < y);
double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
NOTE: x and y 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 = (x / z) * ((y / (z + 1.0d0)) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return (x / z) * ((y / (z + 1.0)) / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(x / z) * Float64(Float64(y / Float64(z + 1.0)) / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (x / z) * ((y / (z + 1.0)) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}
\end{array}
Initial program 83.7%
times-frac88.4%
associate-*l/88.5%
times-frac95.0%
Applied egg-rr95.0%
Final simplification95.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 5.6e-35) (* (/ x z) (/ y z)) (* y (/ x (* z z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (y <= 5.6e-35) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
NOTE: x and y 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 (y <= 5.6d-35) then
tmp = (x / z) * (y / z)
else
tmp = y * (x / (z * z))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.6e-35) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if y <= 5.6e-35: tmp = (x / z) * (y / z) else: tmp = y * (x / (z * z)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (y <= 5.6e-35) tmp = Float64(Float64(x / z) * Float64(y / z)); else tmp = Float64(y * Float64(x / Float64(z * z))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 5.6e-35)
tmp = (x / z) * (y / z);
else
tmp = y * (x / (z * z));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 5.6e-35], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{-35}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if y < 5.5999999999999999e-35Initial program 82.7%
times-frac86.5%
associate-*l/86.8%
times-frac93.5%
Applied egg-rr93.5%
Taylor expanded in z around 0 75.1%
if 5.5999999999999999e-35 < y Initial program 86.2%
times-frac93.6%
Simplified93.6%
Taylor expanded in z around 0 71.5%
Final simplification74.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 1.5e+28) (* (/ x z) (/ y z)) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e+28) {
tmp = (x / z) * (y / z);
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
NOTE: x and y 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 (y <= 1.5d+28) then
tmp = (x / z) * (y / z)
else
tmp = y * ((x / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.5e+28) {
tmp = (x / z) * (y / z);
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if y <= 1.5e+28: tmp = (x / z) * (y / z) else: tmp = y * ((x / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (y <= 1.5e+28) tmp = Float64(Float64(x / z) * Float64(y / z)); else tmp = Float64(y * Float64(Float64(x / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 1.5e+28)
tmp = (x / z) * (y / z);
else
tmp = y * ((x / z) / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 1.5e+28], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.5 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if y < 1.5e28Initial program 83.2%
times-frac87.1%
associate-*l/87.0%
times-frac94.1%
Applied egg-rr94.1%
Taylor expanded in z around 0 74.9%
if 1.5e28 < y Initial program 85.4%
times-frac93.3%
associate-/r*95.1%
Simplified95.1%
Taylor expanded in z around 0 69.2%
Final simplification73.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 4.3e+18) (/ x (* z (/ z y))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+18) {
tmp = x / (z * (z / y));
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
NOTE: x and y 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 (y <= 4.3d+18) then
tmp = x / (z * (z / y))
else
tmp = y * ((x / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4.3e+18) {
tmp = x / (z * (z / y));
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if y <= 4.3e+18: tmp = x / (z * (z / y)) else: tmp = y * ((x / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (y <= 4.3e+18) tmp = Float64(x / Float64(z * Float64(z / y))); else tmp = Float64(y * Float64(Float64(x / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 4.3e+18)
tmp = x / (z * (z / y));
else
tmp = y * ((x / z) / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 4.3e+18], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{+18}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if y < 4.3e18Initial program 83.4%
times-frac87.4%
Simplified87.4%
Taylor expanded in z around 0 69.7%
associate-*l/69.4%
times-frac75.3%
clear-num76.2%
frac-times76.8%
*-commutative76.8%
*-un-lft-identity76.8%
Applied egg-rr76.8%
if 4.3e18 < y Initial program 84.5%
times-frac92.0%
associate-/r*95.3%
Simplified95.3%
Taylor expanded in z around 0 67.9%
Final simplification74.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ x z) (/ y z)))
assert(x < y);
double code(double x, double y, double z) {
return (x / z) * (y / z);
}
NOTE: x and y 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 = (x / z) * (y / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return (x / z) * (y / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return (x / z) * (y / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(x / z) * Float64(y / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (x / z) * (y / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \frac{y}{z}
\end{array}
Initial program 83.7%
times-frac88.4%
associate-*l/88.5%
times-frac95.0%
Applied egg-rr95.0%
Taylor expanded in z around 0 71.9%
Final simplification71.9%
(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 2023301
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))