
(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 13 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 (/ (* x (/ (/ y z) (+ z 1.0))) z))
double code(double x, double y, double z) {
return (x * ((y / z) / (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 * ((y / z) / (z + 1.0d0))) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y / z) / (z + 1.0))) / z;
}
def code(x, y, z): return (x * ((y / z) / (z + 1.0))) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y / z) / Float64(z + 1.0))) / z) end
function tmp = code(x, y, z) tmp = (x * ((y / z) / (z + 1.0))) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y / z), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\frac{y}{z}}{z + 1}}{z}
\end{array}
Initial program 82.9%
frac-times87.1%
associate-*l/86.0%
times-frac96.0%
Applied egg-rr96.0%
associate-*l/96.7%
associate-/l/94.9%
associate-/r*96.7%
Applied egg-rr96.7%
Final simplification96.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* (/ x z) (/ (/ y z) z)) (/ (/ x (/ z y)) 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 = (x / (z / y)) / 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 = (x / (z / y)) / 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 = (x / (z / y)) / 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 = (x / (z / y)) / 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(x / Float64(z / y)) / 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 = (x / (z / y)) / 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[(x / N[(z / y), $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{x}{\frac{z}{y}}}{z}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 83.1%
frac-times92.4%
associate-*l/90.3%
times-frac97.0%
Applied egg-rr97.0%
Taylor expanded in z around inf 95.8%
if -1 < z < 1Initial program 82.8%
frac-times83.2%
associate-*l/82.8%
times-frac95.3%
Applied egg-rr95.3%
associate-*l/96.5%
associate-/l/96.5%
associate-/r*96.5%
Applied egg-rr96.5%
Taylor expanded in x around 0 93.2%
associate-/r*93.2%
associate-*r/96.5%
+-commutative96.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around 0 94.0%
Final simplification94.8%
(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 82.9%
frac-times87.1%
associate-*l/86.0%
times-frac96.0%
Applied egg-rr96.0%
Final simplification96.0%
(FPCore (x y z) :precision binary64 (if (<= y 1.35e+79) (* (/ y z) (/ x z)) (* y (/ x (* z z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.35e+79) {
tmp = (y / z) * (x / 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 <= 1.35d+79) then
tmp = (y / z) * (x / 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 <= 1.35e+79) {
tmp = (y / z) * (x / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.35e+79: tmp = (y / z) * (x / z) else: tmp = y * (x / (z * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.35e+79) tmp = Float64(Float64(y / z) * Float64(x / 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 <= 1.35e+79) tmp = (y / z) * (x / z); else tmp = y * (x / (z * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.35e+79], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35 \cdot 10^{+79}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if y < 1.35e79Initial program 83.4%
frac-times87.1%
associate-*l/86.6%
times-frac97.0%
Applied egg-rr97.0%
Taylor expanded in z around 0 77.4%
if 1.35e79 < y Initial program 80.4%
sqr-neg80.4%
times-frac87.1%
sqr-neg87.1%
Simplified87.1%
Taylor expanded in z around 0 77.5%
Final simplification77.4%
(FPCore (x y z) :precision binary64 (if (<= y 2e-84) (* (/ y z) (/ x z)) (/ y (* z (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-84) {
tmp = (y / z) * (x / z);
} else {
tmp = y / (z * (z / 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 <= 2d-84) then
tmp = (y / z) * (x / z)
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-84) {
tmp = (y / z) * (x / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e-84: tmp = (y / z) * (x / z) else: tmp = y / (z * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e-84) tmp = Float64(Float64(y / z) * Float64(x / z)); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-84) tmp = (y / z) * (x / z); else tmp = y / (z * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e-84], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-84}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 2.0000000000000001e-84Initial program 82.2%
frac-times86.2%
associate-*l/86.1%
times-frac96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 76.3%
if 2.0000000000000001e-84 < y Initial program 84.4%
frac-times89.2%
associate-*l/85.7%
times-frac95.1%
Applied egg-rr95.1%
Taylor expanded in z around 0 77.8%
clear-num77.7%
frac-times82.6%
*-un-lft-identity82.6%
Applied egg-rr82.6%
Final simplification78.3%
(FPCore (x y z) :precision binary64 (if (<= y 1.02e-84) (/ (* x (/ y z)) z) (/ y (* z (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.02e-84) {
tmp = (x * (y / z)) / z;
} else {
tmp = y / (z * (z / 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 <= 1.02d-84) then
tmp = (x * (y / z)) / z
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.02e-84) {
tmp = (x * (y / z)) / z;
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.02e-84: tmp = (x * (y / z)) / z else: tmp = y / (z * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.02e-84) tmp = Float64(Float64(x * Float64(y / z)) / z); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.02e-84) tmp = (x * (y / z)) / z; else tmp = y / (z * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.02e-84], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{-84}:\\
\;\;\;\;\frac{x \cdot \frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 1.02000000000000004e-84Initial program 82.7%
frac-times86.4%
associate-*l/86.6%
times-frac96.4%
Applied egg-rr96.4%
associate-*l/97.3%
associate-/l/95.8%
associate-/r*97.3%
Applied egg-rr97.3%
Taylor expanded in z around 0 72.7%
associate-*r/77.1%
Simplified77.1%
if 1.02000000000000004e-84 < y Initial program 83.4%
frac-times88.6%
associate-*l/84.6%
times-frac95.2%
Applied egg-rr95.2%
Taylor expanded in z around 0 78.0%
clear-num78.0%
frac-times82.8%
*-un-lft-identity82.8%
Applied egg-rr82.8%
Final simplification78.9%
(FPCore (x y z) :precision binary64 (if (<= y 2e-83) (/ (/ x z) (/ z y)) (/ y (* z (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-83) {
tmp = (x / z) / (z / y);
} else {
tmp = y / (z * (z / 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 <= 2d-83) then
tmp = (x / z) / (z / y)
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-83) {
tmp = (x / z) / (z / y);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e-83: tmp = (x / z) / (z / y) else: tmp = y / (z * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e-83) tmp = Float64(Float64(x / z) / Float64(z / y)); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-83) tmp = (x / z) / (z / y); else tmp = y / (z * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e-83], N[(N[(x / z), $MachinePrecision] / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 2.0000000000000001e-83Initial program 82.3%
associate-*r/82.8%
sqr-neg82.8%
*-commutative82.8%
distribute-rgt1-in70.8%
sqr-neg70.8%
fma-def82.8%
sqr-neg82.8%
cube-unmult82.8%
Simplified82.8%
associate-*r/82.3%
fma-udef70.4%
cube-mult70.4%
distribute-rgt1-in82.3%
*-commutative82.3%
frac-times86.2%
*-commutative86.2%
associate-/r*92.1%
clear-num92.0%
frac-times96.1%
*-un-lft-identity96.1%
Applied egg-rr96.1%
Taylor expanded in z around 0 75.9%
if 2.0000000000000001e-83 < y Initial program 84.2%
frac-times89.1%
associate-*l/85.5%
times-frac95.1%
Applied egg-rr95.1%
Taylor expanded in z around 0 78.7%
clear-num78.7%
frac-times83.6%
*-un-lft-identity83.6%
Applied egg-rr83.6%
Final simplification78.3%
(FPCore (x y z) :precision binary64 (if (<= y 2e-52) (/ (/ x (/ z y)) z) (/ y (* z (/ z x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2e-52) {
tmp = (x / (z / y)) / z;
} else {
tmp = y / (z * (z / 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 <= 2d-52) then
tmp = (x / (z / y)) / z
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2e-52) {
tmp = (x / (z / y)) / z;
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2e-52: tmp = (x / (z / y)) / z else: tmp = y / (z * (z / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2e-52) tmp = Float64(Float64(x / Float64(z / y)) / z); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2e-52) tmp = (x / (z / y)) / z; else tmp = y / (z * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2e-52], N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{x}{\frac{z}{y}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 2e-52Initial program 82.2%
frac-times86.5%
associate-*l/85.9%
times-frac96.5%
Applied egg-rr96.5%
associate-*l/97.4%
associate-/l/95.9%
associate-/r*97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 90.1%
associate-/r*90.7%
associate-*r/97.6%
+-commutative97.6%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in z around 0 77.0%
if 2e-52 < y Initial program 84.7%
frac-times88.5%
associate-*l/86.0%
times-frac94.9%
Applied egg-rr94.9%
Taylor expanded in z around 0 78.5%
clear-num78.4%
frac-times83.6%
*-un-lft-identity83.6%
Applied egg-rr83.6%
Final simplification79.0%
(FPCore (x y z) :precision binary64 (if (<= z -5e-310) (* x (/ (- y) z)) (/ y (/ z x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5e-310) {
tmp = x * (-y / z);
} else {
tmp = y / (z / 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 (z <= (-5d-310)) then
tmp = x * (-y / z)
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e-310) {
tmp = x * (-y / z);
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e-310: tmp = x * (-y / z) else: tmp = y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e-310) tmp = Float64(x * Float64(Float64(-y) / z)); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e-310) tmp = x * (-y / z); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5e-310], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if z < -4.999999999999985e-310Initial program 82.2%
frac-times86.6%
associate-*l/85.3%
times-frac96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 68.6%
neg-mul-168.6%
+-commutative68.6%
unsub-neg68.6%
Simplified68.6%
Taylor expanded in z around inf 28.2%
associate-*r/35.8%
neg-mul-135.8%
distribute-rgt-neg-in35.8%
distribute-frac-neg35.8%
Simplified35.8%
if -4.999999999999985e-310 < z Initial program 83.6%
frac-times87.6%
associate-*l/86.6%
times-frac95.6%
Applied egg-rr95.6%
Taylor expanded in z around 0 70.4%
neg-mul-170.4%
+-commutative70.4%
unsub-neg70.4%
Simplified70.4%
Taylor expanded in z around inf 11.1%
associate-*r/14.7%
neg-mul-114.7%
distribute-rgt-neg-in14.7%
distribute-frac-neg14.7%
Simplified14.7%
associate-*r/11.1%
add-cube-cbrt11.1%
times-frac14.0%
add-sqr-sqrt6.0%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod19.2%
add-sqr-sqrt36.1%
times-frac28.9%
*-commutative28.9%
add-cube-cbrt28.9%
associate-/l*38.9%
Applied egg-rr38.9%
Final simplification37.4%
(FPCore (x y z) :precision binary64 (if (<= z -5e-310) (/ (- x) (/ z y)) (/ y (/ z x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5e-310) {
tmp = -x / (z / y);
} else {
tmp = y / (z / 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 (z <= (-5d-310)) then
tmp = -x / (z / y)
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e-310) {
tmp = -x / (z / y);
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e-310: tmp = -x / (z / y) else: tmp = y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e-310) tmp = Float64(Float64(-x) / Float64(z / y)); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e-310) tmp = -x / (z / y); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5e-310], N[((-x) / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if z < -4.999999999999985e-310Initial program 82.2%
frac-times86.6%
associate-*l/85.3%
times-frac96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 68.6%
neg-mul-168.6%
+-commutative68.6%
unsub-neg68.6%
Simplified68.6%
Taylor expanded in z around inf 28.2%
associate-*r/35.8%
neg-mul-135.8%
distribute-rgt-neg-in35.8%
distribute-frac-neg35.8%
Simplified35.8%
associate-*r/28.2%
distribute-rgt-neg-in28.2%
distribute-neg-frac28.2%
associate-/l*35.8%
distribute-neg-frac35.8%
Applied egg-rr35.8%
if -4.999999999999985e-310 < z Initial program 83.6%
frac-times87.6%
associate-*l/86.6%
times-frac95.6%
Applied egg-rr95.6%
Taylor expanded in z around 0 70.4%
neg-mul-170.4%
+-commutative70.4%
unsub-neg70.4%
Simplified70.4%
Taylor expanded in z around inf 11.1%
associate-*r/14.7%
neg-mul-114.7%
distribute-rgt-neg-in14.7%
distribute-frac-neg14.7%
Simplified14.7%
associate-*r/11.1%
add-cube-cbrt11.1%
times-frac14.0%
add-sqr-sqrt6.0%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod19.2%
add-sqr-sqrt36.1%
times-frac28.9%
*-commutative28.9%
add-cube-cbrt28.9%
associate-/l*38.9%
Applied egg-rr38.9%
Final simplification37.4%
(FPCore (x y z) :precision binary64 (if (<= y 1e+30) (/ x (/ z y)) (/ y (/ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1e+30) {
tmp = x / (z / y);
} else {
tmp = y / (z / 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 <= 1d+30) then
tmp = x / (z / y)
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1e+30) {
tmp = x / (z / y);
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1e+30: tmp = x / (z / y) else: tmp = y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1e+30) tmp = Float64(x / Float64(z / y)); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1e+30) tmp = x / (z / y); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1e+30], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+30}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < 1e30Initial program 83.4%
frac-times87.3%
associate-*l/86.8%
times-frac96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 68.9%
neg-mul-168.9%
+-commutative68.9%
unsub-neg68.9%
Simplified68.9%
Taylor expanded in z around inf 19.2%
associate-*r/24.8%
neg-mul-124.8%
distribute-rgt-neg-in24.8%
distribute-frac-neg24.8%
Simplified24.8%
add-sqr-sqrt13.0%
sqrt-unprod26.7%
sqr-neg26.7%
sqrt-unprod13.1%
add-sqr-sqrt28.7%
clear-num28.7%
div-inv28.2%
Applied egg-rr28.2%
if 1e30 < y Initial program 81.2%
frac-times86.4%
associate-*l/83.0%
times-frac93.0%
Applied egg-rr93.0%
Taylor expanded in z around 0 71.7%
neg-mul-171.7%
+-commutative71.7%
unsub-neg71.7%
Simplified71.7%
Taylor expanded in z around inf 20.9%
associate-*r/26.0%
neg-mul-126.0%
distribute-rgt-neg-in26.0%
distribute-frac-neg26.0%
Simplified26.0%
associate-*r/20.9%
add-cube-cbrt20.9%
times-frac25.9%
add-sqr-sqrt0.0%
sqrt-unprod19.2%
sqr-neg19.2%
sqrt-unprod24.8%
add-sqr-sqrt24.8%
times-frac18.3%
*-commutative18.3%
add-cube-cbrt18.3%
associate-/l*29.8%
Applied egg-rr29.8%
Final simplification28.6%
(FPCore (x y z) :precision binary64 (* (/ y z) (/ x z)))
double code(double x, double y, double z) {
return (y / z) * (x / 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) * (x / z)
end function
public static double code(double x, double y, double z) {
return (y / z) * (x / z);
}
def code(x, y, z): return (y / z) * (x / z)
function code(x, y, z) return Float64(Float64(y / z) * Float64(x / z)) end
function tmp = code(x, y, z) tmp = (y / z) * (x / z); end
code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{z} \cdot \frac{x}{z}
\end{array}
Initial program 82.9%
frac-times87.1%
associate-*l/86.0%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 76.8%
Final simplification76.8%
(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 82.9%
frac-times87.1%
associate-*l/86.0%
times-frac96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 69.5%
neg-mul-169.5%
+-commutative69.5%
unsub-neg69.5%
Simplified69.5%
Taylor expanded in z around inf 19.5%
associate-*r/25.1%
neg-mul-125.1%
distribute-rgt-neg-in25.1%
distribute-frac-neg25.1%
Simplified25.1%
add-sqr-sqrt10.2%
sqrt-unprod25.1%
sqr-neg25.1%
sqrt-unprod14.6%
add-sqr-sqrt26.8%
clear-num26.8%
div-inv26.5%
Applied egg-rr26.5%
Final simplification26.5%
(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 2023308
(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))))