
(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 85.6%
associate-*r/86.6%
sqr-neg86.6%
*-commutative86.6%
distribute-rgt1-in76.4%
sqr-neg76.4%
fma-def86.6%
sqr-neg86.6%
cube-unmult86.6%
Simplified86.6%
associate-*r/85.7%
fma-udef76.7%
cube-mult76.6%
distribute-rgt1-in85.6%
*-commutative85.6%
frac-times88.1%
*-commutative88.1%
associate-/r*93.7%
associate-*r/97.7%
Applied egg-rr97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.76))) (* (/ y z) (/ x (* z z))) (* (/ x z) (- (/ y z) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.76)) {
tmp = (y / z) * (x / (z * z));
} else {
tmp = (x / z) * ((y / z) - y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 0.76d0))) then
tmp = (y / z) * (x / (z * z))
else
tmp = (x / z) * ((y / z) - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.76)) {
tmp = (y / z) * (x / (z * z));
} else {
tmp = (x / z) * ((y / z) - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.76): tmp = (y / z) * (x / (z * z)) else: tmp = (x / z) * ((y / z) - y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.76)) tmp = Float64(Float64(y / z) * Float64(x / Float64(z * z))); else tmp = Float64(Float64(x / z) * Float64(Float64(y / z) - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 0.76))) tmp = (y / z) * (x / (z * z)); else tmp = (x / z) * ((y / z) - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.76]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.76\right):\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} - y\right)\\
\end{array}
\end{array}
if z < -1 or 0.76000000000000001 < z Initial program 89.6%
sqr-neg89.6%
times-frac93.9%
sqr-neg93.9%
Simplified93.9%
Taylor expanded in z around inf 92.2%
if -1 < z < 0.76000000000000001Initial program 81.3%
frac-times81.8%
associate-*l/81.3%
times-frac97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.75))) (/ (* (/ x z) (/ y z)) z) (* (/ x z) (- (/ y z) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.75)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = (x / z) * ((y / z) - y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 0.75d0))) then
tmp = ((x / z) * (y / z)) / z
else
tmp = (x / z) * ((y / z) - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 0.75)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = (x / z) * ((y / z) - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 0.75): tmp = ((x / z) * (y / z)) / z else: tmp = (x / z) * ((y / z) - y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.75)) tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); else tmp = Float64(Float64(x / z) * Float64(Float64(y / z) - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 0.75))) tmp = ((x / z) * (y / z)) / z; else tmp = (x / z) * ((y / z) - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.75]], $MachinePrecision]], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.75\right):\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} - y\right)\\
\end{array}
\end{array}
if z < -1 or 0.75 < z Initial program 89.6%
associate-*r/92.1%
sqr-neg92.1%
*-commutative92.1%
distribute-rgt1-in72.5%
sqr-neg72.5%
fma-def92.1%
sqr-neg92.1%
cube-unmult92.1%
Simplified92.1%
associate-*r/89.6%
fma-udef72.3%
cube-mult72.3%
distribute-rgt1-in89.6%
*-commutative89.6%
frac-times93.9%
*-commutative93.9%
associate-/r*97.2%
associate-*r/97.8%
Applied egg-rr97.8%
Taylor expanded in z around inf 95.9%
if -1 < z < 0.75Initial program 81.3%
frac-times81.8%
associate-*l/81.3%
times-frac97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ x z) (* z (/ z y))) (if (<= z 0.76) (* (/ x z) (- (/ y z) y)) (/ (* (/ x z) (/ y z)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) / (z * (z / y));
} else if (z <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} 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) / (z * (z / y))
else if (z <= 0.76d0) then
tmp = (x / z) * ((y / z) - y)
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) / (z * (z / y));
} else if (z <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} else {
tmp = ((x / z) * (y / z)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (x / z) / (z * (z / y)) elif z <= 0.76: tmp = (x / z) * ((y / z) - y) 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(z * Float64(z / y))); elseif (z <= 0.76) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) - y)); 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) / (z * (z / y)); elseif (z <= 0.76) tmp = (x / z) * ((y / z) - y); 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[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $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{\frac{x}{z}}{z \cdot \frac{z}{y}}\\
\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 88.5%
sqr-neg88.5%
times-frac95.9%
sqr-neg95.9%
Simplified95.9%
Taylor expanded in z around inf 95.4%
associate-/r*97.0%
clear-num97.0%
frac-times97.2%
*-commutative97.2%
*-un-lft-identity97.2%
Applied egg-rr97.2%
if -1 < z < 0.76000000000000001Initial program 81.3%
frac-times81.8%
associate-*l/81.3%
times-frac97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
if 0.76000000000000001 < z Initial program 90.5%
associate-*r/91.0%
sqr-neg91.0%
*-commutative91.0%
distribute-rgt1-in91.0%
sqr-neg91.0%
fma-def91.0%
sqr-neg91.0%
cube-unmult91.0%
Simplified91.0%
associate-*r/90.5%
fma-udef90.5%
cube-mult90.5%
distribute-rgt1-in90.5%
*-commutative90.5%
frac-times92.2%
*-commutative92.2%
associate-/r*97.0%
associate-*r/98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 96.0%
Final simplification96.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ (* x (/ y z)) z) z) (if (<= z 0.76) (* (/ x z) (- (/ y z) y)) (/ (* (/ x z) (/ y z)) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = ((x * (y / z)) / z) / z;
} else if (z <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} 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 * (y / z)) / z) / z
else if (z <= 0.76d0) then
tmp = (x / z) * ((y / z) - y)
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 * (y / z)) / z) / z;
} else if (z <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} else {
tmp = ((x / z) * (y / z)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = ((x * (y / z)) / z) / z elif z <= 0.76: tmp = (x / z) * ((y / z) - y) else: tmp = ((x / z) * (y / z)) / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(Float64(x * Float64(y / z)) / z) / z); elseif (z <= 0.76) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) - y)); 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 * (y / z)) / z) / z; elseif (z <= 0.76) tmp = (x / z) * ((y / z) - y); else tmp = ((x / z) * (y / z)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $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{\frac{x \cdot \frac{y}{z}}{z}}{z}\\
\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 88.5%
associate-*r/93.5%
sqr-neg93.5%
*-commutative93.5%
distribute-rgt1-in50.0%
sqr-neg50.0%
fma-def93.4%
sqr-neg93.4%
cube-unmult93.4%
Simplified93.4%
associate-*r/88.5%
fma-udef50.2%
cube-mult50.1%
distribute-rgt1-in88.5%
*-commutative88.5%
frac-times95.9%
associate-*l/95.1%
associate-/r*96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 95.7%
if -1 < z < 0.76000000000000001Initial program 81.3%
frac-times81.8%
associate-*l/81.3%
times-frac97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
if 0.76000000000000001 < z Initial program 90.5%
associate-*r/91.0%
sqr-neg91.0%
*-commutative91.0%
distribute-rgt1-in91.0%
sqr-neg91.0%
fma-def91.0%
sqr-neg91.0%
cube-unmult91.0%
Simplified91.0%
associate-*r/90.5%
fma-udef90.5%
cube-mult90.5%
distribute-rgt1-in90.5%
*-commutative90.5%
frac-times92.2%
*-commutative92.2%
associate-/r*97.0%
associate-*r/98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 96.0%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ (/ x (/ z y)) z) z) (if (<= z 0.76) (* (/ x z) (- (/ y z) y)) (/ (* (/ 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 <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} 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 <= 0.76d0) then
tmp = (x / z) * ((y / z) - y)
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 <= 0.76) {
tmp = (x / z) * ((y / z) - y);
} 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 <= 0.76: tmp = (x / z) * ((y / z) - y) else: tmp = ((x / z) * (y / z)) / z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(Float64(x / Float64(z / y)) / z) / z); elseif (z <= 0.76) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) - y)); 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 <= 0.76) tmp = (x / z) * ((y / z) - y); else tmp = ((x / z) * (y / z)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $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{\frac{\frac{x}{\frac{z}{y}}}{z}}{z}\\
\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{x}{z} \cdot \left(\frac{y}{z} - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 88.5%
associate-*r/93.5%
sqr-neg93.5%
*-commutative93.5%
distribute-rgt1-in50.0%
sqr-neg50.0%
fma-def93.4%
sqr-neg93.4%
cube-unmult93.4%
Simplified93.4%
associate-*r/88.5%
fma-udef50.2%
cube-mult50.1%
distribute-rgt1-in88.5%
*-commutative88.5%
frac-times95.9%
associate-*l/95.1%
associate-/r*96.7%
Applied egg-rr96.7%
Taylor expanded in z around inf 95.7%
associate-*r/89.1%
associate-/l*95.7%
Applied egg-rr95.7%
if -1 < z < 0.76000000000000001Initial program 81.3%
frac-times81.8%
associate-*l/81.3%
times-frac97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
mul-1-neg97.1%
unsub-neg97.1%
Simplified97.1%
if 0.76000000000000001 < z Initial program 90.5%
associate-*r/91.0%
sqr-neg91.0%
*-commutative91.0%
distribute-rgt1-in91.0%
sqr-neg91.0%
fma-def91.0%
sqr-neg91.0%
cube-unmult91.0%
Simplified91.0%
associate-*r/90.5%
fma-udef90.5%
cube-mult90.5%
distribute-rgt1-in90.5%
*-commutative90.5%
frac-times92.2%
*-commutative92.2%
associate-/r*97.0%
associate-*r/98.7%
Applied egg-rr98.7%
Taylor expanded in z around inf 96.0%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (<= y 1.8e-222) (/ x (* z (/ z y))) (if (<= y 13000.0) (* (/ x z) (/ y z)) (* y (/ x (* z z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.8e-222) {
tmp = x / (z * (z / y));
} else if (y <= 13000.0) {
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 <= 1.8d-222) then
tmp = x / (z * (z / y))
else if (y <= 13000.0d0) 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 <= 1.8e-222) {
tmp = x / (z * (z / y));
} else if (y <= 13000.0) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.8e-222: tmp = x / (z * (z / y)) elif y <= 13000.0: tmp = (x / z) * (y / z) else: tmp = y * (x / (z * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.8e-222) tmp = Float64(x / Float64(z * Float64(z / y))); elseif (y <= 13000.0) 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 <= 1.8e-222) tmp = x / (z * (z / y)); elseif (y <= 13000.0) tmp = (x / z) * (y / z); else tmp = y * (x / (z * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.8e-222], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 13000.0], 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 \leq 1.8 \cdot 10^{-222}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\
\mathbf{elif}\;y \leq 13000:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if y < 1.79999999999999987e-222Initial program 85.5%
frac-times87.0%
associate-*l/86.8%
times-frac97.0%
Applied egg-rr97.0%
Taylor expanded in z around 0 77.9%
associate-/r/77.2%
div-inv77.2%
clear-num77.2%
Applied egg-rr77.2%
if 1.79999999999999987e-222 < y < 13000Initial program 86.9%
frac-times87.7%
associate-*l/86.9%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 84.3%
if 13000 < y Initial program 85.2%
sqr-neg85.2%
times-frac91.3%
sqr-neg91.3%
Simplified91.3%
Taylor expanded in z around 0 72.3%
Final simplification77.2%
(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 85.6%
frac-times88.1%
associate-*l/87.3%
times-frac97.3%
Applied egg-rr97.3%
Final simplification97.3%
(FPCore (x y z) :precision binary64 (if (<= y 23000.0) (* (/ x z) (/ y z)) (* y (/ x (* z z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 23000.0) {
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 <= 23000.0d0) 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 <= 23000.0) {
tmp = (x / z) * (y / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 23000.0: tmp = (x / z) * (y / z) else: tmp = y * (x / (z * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 23000.0) 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 <= 23000.0) tmp = (x / z) * (y / z); else tmp = y * (x / (z * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 23000.0], 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 \leq 23000:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if y < 23000Initial program 85.8%
frac-times87.1%
associate-*l/86.8%
times-frac97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 79.1%
if 23000 < y Initial program 85.2%
sqr-neg85.2%
times-frac91.3%
sqr-neg91.3%
Simplified91.3%
Taylor expanded in z around 0 72.3%
Final simplification77.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 85.6%
frac-times88.1%
associate-*l/87.3%
times-frac97.3%
Applied egg-rr97.3%
Taylor expanded in z around 0 74.6%
Final simplification74.6%
(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 2023320
(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))))