
(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 10 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}
(FPCore (x y z) :precision binary64 (/ (* (/ y (+ z 1.0)) (/ x z)) z))
double code(double x, double y, double z) {
return ((y / (z + 1.0)) * (x / z)) / z;
}
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 + 1.0d0)) * (x / z)) / z
end function
public static double code(double x, double y, double z) {
return ((y / (z + 1.0)) * (x / z)) / z;
}
def code(x, y, z): return ((y / (z + 1.0)) * (x / z)) / z
function code(x, y, z) return Float64(Float64(Float64(y / Float64(z + 1.0)) * Float64(x / z)) / z) end
function tmp = code(x, y, z) tmp = ((y / (z + 1.0)) * (x / z)) / z; end
code[x_, y_, z_] := N[(N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}
\end{array}
Initial program 80.6%
associate-*l/82.5%
*-commutative82.5%
sqr-neg82.5%
*-commutative82.5%
distribute-rgt1-in72.3%
sqr-neg72.3%
fma-def82.5%
sqr-neg82.5%
cube-unmult82.5%
Simplified82.5%
associate-*r/80.6%
fma-udef71.2%
cube-mult71.2%
distribute-rgt1-in80.6%
frac-times87.5%
associate-/r*92.8%
associate-*r/97.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* (/ x z) (/ (/ y z) z)) (/ (/ y (/ z x)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = (y / (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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / z) * ((y / z) / z)
else
tmp = (y / (z / x)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = (y / (z / x)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = (x / z) * ((y / z) / z) else: tmp = (y / (z / x)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(y / Float64(z / x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = (x / z) * ((y / z) / z); else tmp = (y / (z / x)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 79.1%
frac-times93.1%
associate-*l/95.5%
times-frac95.5%
Applied egg-rr95.5%
Taylor expanded in z around inf 95.0%
if -1 < z < 1Initial program 82.1%
sqr-neg82.1%
times-frac82.1%
sqr-neg82.1%
Simplified82.1%
Taylor expanded in z around 0 80.6%
*-commutative80.6%
associate-/r*88.8%
associate-*r/97.4%
clear-num97.2%
un-div-inv97.3%
Applied egg-rr97.3%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ (/ (* x (/ y z)) z) z) (/ (/ y (/ z x)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((x * (y / z)) / z) / z;
} else {
tmp = (y / (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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((x * (y / z)) / z) / z
else
tmp = (y / (z / x)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = ((x * (y / z)) / z) / z;
} else {
tmp = (y / (z / x)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = ((x * (y / z)) / z) / z else: tmp = (y / (z / x)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(Float64(Float64(x * Float64(y / z)) / z) / z); else tmp = Float64(Float64(y / Float64(z / x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = ((x * (y / z)) / z) / z; else tmp = (y / (z / x)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\frac{x \cdot \frac{y}{z}}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 79.1%
associate-*l/82.9%
*-commutative82.9%
sqr-neg82.9%
*-commutative82.9%
distribute-rgt1-in62.0%
sqr-neg62.0%
fma-def82.9%
sqr-neg82.9%
cube-unmult82.9%
Simplified82.9%
associate-*r/79.1%
*-commutative79.1%
fma-udef59.9%
cube-mult59.8%
distribute-rgt1-in79.1%
*-commutative79.1%
frac-times93.1%
associate-*l/95.5%
associate-/r*97.0%
Applied egg-rr97.0%
Taylor expanded in z around inf 96.5%
if -1 < z < 1Initial program 82.1%
sqr-neg82.1%
times-frac82.1%
sqr-neg82.1%
Simplified82.1%
Taylor expanded in z around 0 80.6%
*-commutative80.6%
associate-/r*88.8%
associate-*r/97.4%
clear-num97.2%
un-div-inv97.3%
Applied egg-rr97.3%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (* (/ x z) (/ (/ y z) z)) (if (<= z 1.0) (/ (/ y (/ z x)) z) (/ (* (/ x z) (/ y z)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * ((y / z) / z);
} else if (z <= 1.0) {
tmp = (y / (z / x)) / z;
} else {
tmp = ((x / z) * (y / z)) / 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 <= (-1.0d0)) then
tmp = (x / z) * ((y / z) / z)
else if (z <= 1.0d0) then
tmp = (y / (z / x)) / z
else
tmp = ((x / z) * (y / z)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * ((y / z) / z);
} else if (z <= 1.0) {
tmp = (y / (z / x)) / z;
} else {
tmp = ((x / z) * (y / z)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (x / z) * ((y / z) / z) elif z <= 1.0: tmp = (y / (z / x)) / z else: tmp = ((x / z) * (y / z)) / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); elseif (z <= 1.0) tmp = Float64(Float64(y / Float64(z / x)) / z); else tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = (x / z) * ((y / z) / z); elseif (z <= 1.0) tmp = (y / (z / x)) / z; else tmp = ((x / z) * (y / z)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{\frac{y}{\frac{z}{x}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 78.3%
frac-times87.6%
associate-*l/90.5%
times-frac94.9%
Applied egg-rr94.9%
Taylor expanded in z around inf 94.8%
if -1 < z < 1Initial program 82.1%
sqr-neg82.1%
times-frac82.1%
sqr-neg82.1%
Simplified82.1%
Taylor expanded in z around 0 80.6%
*-commutative80.6%
associate-/r*88.8%
associate-*r/97.4%
clear-num97.2%
un-div-inv97.3%
Applied egg-rr97.3%
if 1 < z Initial program 79.7%
associate-*l/85.0%
*-commutative85.0%
sqr-neg85.0%
*-commutative85.0%
distribute-rgt1-in84.9%
sqr-neg84.9%
fma-def84.9%
sqr-neg84.9%
cube-unmult85.0%
Simplified85.0%
associate-*r/79.7%
fma-udef79.7%
cube-mult79.7%
distribute-rgt1-in79.7%
frac-times97.8%
associate-/r*97.7%
associate-*r/98.8%
Applied egg-rr98.8%
Taylor expanded in z around inf 97.9%
Final simplification96.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (/ z x))))
(if (<= z -1.0)
t_0
(if (<= z -4e-310)
(* x (/ (- y) z))
(if (<= z 2e-75) (/ x (/ z y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= -4e-310) {
tmp = x * (-y / z);
} else if (z <= 2e-75) {
tmp = x / (z / y);
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = y / (z / x)
if (z <= (-1.0d0)) then
tmp = t_0
else if (z <= (-4d-310)) then
tmp = x * (-y / z)
else if (z <= 2d-75) then
tmp = x / (z / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (z <= -1.0) {
tmp = t_0;
} else if (z <= -4e-310) {
tmp = x * (-y / z);
} else if (z <= 2e-75) {
tmp = x / (z / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y / (z / x) tmp = 0 if z <= -1.0: tmp = t_0 elif z <= -4e-310: tmp = x * (-y / z) elif z <= 2e-75: tmp = x / (z / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y / Float64(z / x)) tmp = 0.0 if (z <= -1.0) tmp = t_0; elseif (z <= -4e-310) tmp = Float64(x * Float64(Float64(-y) / z)); elseif (z <= 2e-75) tmp = Float64(x / Float64(z / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (z / x); tmp = 0.0; if (z <= -1.0) tmp = t_0; elseif (z <= -4e-310) tmp = x * (-y / z); elseif (z <= 2e-75) tmp = x / (z / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$0, If[LessEqual[z, -4e-310], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-75], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\frac{z}{x}}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-75}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1 or 1.9999999999999999e-75 < z Initial program 81.0%
associate-*l/83.8%
*-commutative83.8%
sqr-neg83.8%
*-commutative83.8%
distribute-rgt1-in64.8%
sqr-neg64.8%
fma-def83.8%
sqr-neg83.8%
cube-unmult83.8%
Simplified83.8%
associate-*r/81.0%
fma-udef63.6%
cube-mult63.6%
distribute-rgt1-in81.0%
frac-times93.0%
associate-/r*95.1%
associate-*r/96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 33.6%
mul-1-neg33.6%
distribute-rgt-neg-out33.6%
+-commutative33.6%
associate-*r/33.0%
distribute-lft-out34.4%
unsub-neg34.4%
Simplified34.4%
Taylor expanded in z around inf 27.6%
mul-1-neg27.6%
associate-*r/32.4%
distribute-rgt-neg-in32.4%
distribute-frac-neg32.4%
Simplified32.4%
*-commutative32.4%
add-sqr-sqrt13.9%
sqrt-unprod35.3%
sqr-neg35.3%
sqrt-unprod20.9%
add-sqr-sqrt36.1%
associate-/r/34.1%
Applied egg-rr34.1%
if -1 < z < -3.999999999999988e-310Initial program 83.0%
associate-*l/86.0%
*-commutative86.0%
sqr-neg86.0%
*-commutative86.0%
distribute-rgt1-in86.0%
sqr-neg86.0%
fma-def86.0%
sqr-neg86.0%
cube-unmult86.0%
Simplified86.0%
associate-*r/83.0%
fma-udef83.0%
cube-mult83.0%
distribute-rgt1-in83.0%
frac-times86.0%
associate-/r*95.7%
associate-*r/99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 90.8%
mul-1-neg90.8%
distribute-rgt-neg-out90.8%
+-commutative90.8%
associate-*r/96.9%
distribute-lft-out96.9%
unsub-neg96.9%
Simplified96.9%
Taylor expanded in z around inf 43.4%
mul-1-neg43.4%
associate-*r/47.4%
distribute-rgt-neg-in47.4%
distribute-frac-neg47.4%
Simplified47.4%
if -3.999999999999988e-310 < z < 1.9999999999999999e-75Initial program 75.8%
associate-*l/73.3%
*-commutative73.3%
sqr-neg73.3%
*-commutative73.3%
distribute-rgt1-in73.3%
sqr-neg73.3%
fma-def73.3%
sqr-neg73.3%
cube-unmult73.3%
Simplified73.3%
associate-*r/75.8%
fma-udef75.8%
cube-mult75.8%
distribute-rgt1-in75.8%
frac-times73.3%
associate-/r*81.3%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 72.1%
mul-1-neg72.1%
distribute-rgt-neg-out72.1%
+-commutative72.1%
associate-*r/86.8%
distribute-lft-out97.6%
unsub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 2.9%
mul-1-neg2.9%
associate-*r/2.8%
distribute-rgt-neg-in2.8%
distribute-frac-neg2.8%
Simplified2.8%
clear-num2.8%
un-div-inv2.8%
add-sqr-sqrt0.3%
sqrt-unprod23.5%
sqr-neg23.5%
sqrt-unprod21.2%
add-sqr-sqrt40.2%
Applied egg-rr40.2%
Final simplification38.9%
(FPCore (x y z) :precision binary64 (if (<= (* y x) 1e-69) (* (/ x z) (/ y z)) (* y (/ x (* z z)))))
double code(double x, double y, double z) {
double tmp;
if ((y * x) <= 1e-69) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * 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 ((y * x) <= 1d-69) then
tmp = (x / z) * (y / z)
else
tmp = y * (x / (z * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y * x) <= 1e-69) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y * x) <= 1e-69: tmp = (x / z) * (y / z) else: tmp = y * (x / (z * z)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(y * x) <= 1e-69) tmp = Float64(Float64(x / z) * Float64(y / z)); else tmp = Float64(y * Float64(x / Float64(z * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * x) <= 1e-69) tmp = (x / z) * (y / z); else tmp = y * (x / (z * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(y * x), $MachinePrecision], 1e-69], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq 10^{-69}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if (*.f64 x y) < 9.9999999999999996e-70Initial program 80.8%
frac-times83.7%
associate-*l/84.1%
times-frac97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 81.5%
if 9.9999999999999996e-70 < (*.f64 x y) Initial program 80.2%
sqr-neg80.2%
times-frac95.7%
sqr-neg95.7%
Simplified95.7%
Taylor expanded in z around 0 71.5%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (* (/ x z) (/ (/ y (+ z 1.0)) z)))
double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
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
public static double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
def code(x, y, z): return (x / z) * ((y / (z + 1.0)) / z)
function code(x, y, z) return Float64(Float64(x / z) * Float64(Float64(y / Float64(z + 1.0)) / z)) end
function tmp = code(x, y, z) tmp = (x / z) * ((y / (z + 1.0)) / z); end
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}
\end{array}
Initial program 80.6%
frac-times87.5%
associate-*l/88.6%
times-frac96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x y z) :precision binary64 (* (/ x z) (/ y z)))
double code(double x, double y, double z) {
return (x / z) * (y / z);
}
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
public static double code(double x, double y, double z) {
return (x / z) * (y / z);
}
def code(x, y, z): return (x / z) * (y / z)
function code(x, y, z) return Float64(Float64(x / z) * Float64(y / z)) end
function tmp = code(x, y, z) tmp = (x / z) * (y / z); end
code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z} \cdot \frac{y}{z}
\end{array}
Initial program 80.6%
frac-times87.5%
associate-*l/88.6%
times-frac96.6%
Applied egg-rr96.6%
Taylor expanded in z around 0 73.3%
Final simplification73.3%
(FPCore (x y z) :precision binary64 (/ x (/ z y)))
double code(double x, double y, double z) {
return x / (z / 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 / (z / y)
end function
public static double code(double x, double y, double z) {
return x / (z / y);
}
def code(x, y, z): return x / (z / y)
function code(x, y, z) return Float64(x / Float64(z / y)) end
function tmp = code(x, y, z) tmp = x / (z / y); end
code[x_, y_, z_] := N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{y}}
\end{array}
Initial program 80.6%
associate-*l/82.5%
*-commutative82.5%
sqr-neg82.5%
*-commutative82.5%
distribute-rgt1-in72.3%
sqr-neg72.3%
fma-def82.5%
sqr-neg82.5%
cube-unmult82.5%
Simplified82.5%
associate-*r/80.6%
fma-udef71.2%
cube-mult71.2%
distribute-rgt1-in80.6%
frac-times87.5%
associate-/r*92.8%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 56.6%
mul-1-neg56.6%
distribute-rgt-neg-out56.6%
+-commutative56.6%
associate-*r/60.6%
distribute-lft-out63.3%
unsub-neg63.3%
Simplified63.3%
Taylor expanded in z around inf 27.6%
mul-1-neg27.6%
associate-*r/31.3%
distribute-rgt-neg-in31.3%
distribute-frac-neg31.3%
Simplified31.3%
clear-num32.4%
un-div-inv31.7%
add-sqr-sqrt14.9%
sqrt-unprod31.1%
sqr-neg31.1%
sqrt-unprod15.9%
add-sqr-sqrt28.8%
Applied egg-rr28.8%
Final simplification28.8%
(FPCore (x y z) :precision binary64 (/ y (/ z x)))
double code(double x, double y, double z) {
return y / (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 = y / (z / x)
end function
public static double code(double x, double y, double z) {
return y / (z / x);
}
def code(x, y, z): return y / (z / x)
function code(x, y, z) return Float64(y / Float64(z / x)) end
function tmp = code(x, y, z) tmp = y / (z / x); end
code[x_, y_, z_] := N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{z}{x}}
\end{array}
Initial program 80.6%
associate-*l/82.5%
*-commutative82.5%
sqr-neg82.5%
*-commutative82.5%
distribute-rgt1-in72.3%
sqr-neg72.3%
fma-def82.5%
sqr-neg82.5%
cube-unmult82.5%
Simplified82.5%
associate-*r/80.6%
fma-udef71.2%
cube-mult71.2%
distribute-rgt1-in80.6%
frac-times87.5%
associate-/r*92.8%
associate-*r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around 0 56.6%
mul-1-neg56.6%
distribute-rgt-neg-out56.6%
+-commutative56.6%
associate-*r/60.6%
distribute-lft-out63.3%
unsub-neg63.3%
Simplified63.3%
Taylor expanded in z around inf 27.6%
mul-1-neg27.6%
associate-*r/31.3%
distribute-rgt-neg-in31.3%
distribute-frac-neg31.3%
Simplified31.3%
*-commutative31.3%
add-sqr-sqrt14.6%
sqrt-unprod30.7%
sqr-neg30.7%
sqrt-unprod15.6%
add-sqr-sqrt27.7%
associate-/r/27.3%
Applied egg-rr27.3%
Final simplification27.3%
(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 2023322
(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))))