
(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}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (/ (/ x z) (/ z y)) (+ z 1.0)))
assert(x < y);
double code(double x, double y, double z) {
return ((x / z) / (z / y)) / (z + 1.0);
}
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) / (z / y)) / (z + 1.0d0)
end function
assert x < y;
public static double code(double x, double y, double z) {
return ((x / z) / (z / y)) / (z + 1.0);
}
[x, y] = sort([x, y]) def code(x, y, z): return ((x / z) / (z / y)) / (z + 1.0)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(x / z) / Float64(z / y)) / Float64(z + 1.0)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((x / z) / (z / y)) / (z + 1.0);
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[(z / y), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{x}{z}}{\frac{z}{y}}}{z + 1}
\end{array}
Initial program 81.9%
associate-*l*81.9%
times-frac94.7%
distribute-lft-in94.7%
fma-def94.8%
*-rgt-identity94.8%
Simplified94.8%
fma-udef94.7%
*-rgt-identity94.7%
distribute-lft-in94.7%
times-frac81.9%
associate-*l*81.9%
associate-/r*84.5%
times-frac97.2%
Applied egg-rr97.2%
clear-num97.2%
un-div-inv97.3%
Applied egg-rr97.3%
Final simplification97.3%
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.0))) (* (/ 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.0)) {
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.0d0))) 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.0)) {
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.0): 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.0)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(x / Float64(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.0)))
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.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}
[x, y] = \mathsf{sort}([x, y])\\
\\
\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 80.0%
associate-*l*80.0%
times-frac93.2%
distribute-lft-in93.2%
fma-def93.2%
*-rgt-identity93.2%
Simplified93.2%
Taylor expanded in z around inf 91.8%
unpow291.8%
associate-/r*96.9%
Simplified96.9%
if -1 < z < 1Initial program 83.7%
associate-*l*83.7%
times-frac96.2%
distribute-lft-in96.2%
fma-def96.2%
*-rgt-identity96.2%
Simplified96.2%
Taylor expanded in z around 0 82.4%
unpow282.4%
associate-/l/93.9%
associate-*r/95.4%
associate-*l/94.9%
Simplified94.9%
*-commutative94.9%
associate-*l/97.5%
Applied egg-rr97.5%
clear-num97.4%
un-div-inv97.5%
Applied egg-rr97.5%
Final simplification97.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ y z) (/ (/ x z) (+ z 1.0))))
assert(x < y);
double code(double x, double y, double z) {
return (y / z) * ((x / z) / (z + 1.0));
}
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 = (y / z) * ((x / z) / (z + 1.0d0))
end function
assert x < y;
public static double code(double x, double y, double z) {
return (y / z) * ((x / z) / (z + 1.0));
}
[x, y] = sort([x, y]) def code(x, y, z): return (y / z) * ((x / z) / (z + 1.0))
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(y / z) * Float64(Float64(x / z) / Float64(z + 1.0))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (y / z) * ((x / z) / (z + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y}{z} \cdot \frac{\frac{x}{z}}{z + 1}
\end{array}
Initial program 81.9%
associate-*l*81.9%
times-frac94.7%
distribute-lft-in94.7%
fma-def94.8%
*-rgt-identity94.8%
Simplified94.8%
fma-udef94.7%
*-rgt-identity94.7%
distribute-lft-in94.7%
times-frac81.9%
associate-*l*81.9%
associate-/r*84.5%
times-frac97.2%
Applied egg-rr97.2%
associate-/l*97.2%
associate-/r/96.6%
Applied egg-rr96.6%
Final simplification96.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (* (/ x z) (/ y z)) (+ z 1.0)))
assert(x < y);
double code(double x, double y, double z) {
return ((x / z) * (y / z)) / (z + 1.0);
}
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)) / (z + 1.0d0)
end function
assert x < y;
public static double code(double x, double y, double z) {
return ((x / z) * (y / z)) / (z + 1.0);
}
[x, y] = sort([x, y]) def code(x, y, z): return ((x / z) * (y / z)) / (z + 1.0)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(x / z) * Float64(y / z)) / Float64(z + 1.0)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((x / z) * (y / z)) / (z + 1.0);
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 / z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}
\end{array}
Initial program 81.9%
associate-*l*81.9%
times-frac94.7%
distribute-lft-in94.7%
fma-def94.8%
*-rgt-identity94.8%
Simplified94.8%
fma-udef94.7%
*-rgt-identity94.7%
distribute-lft-in94.7%
times-frac81.9%
associate-*l*81.9%
associate-/r*84.5%
times-frac97.2%
Applied egg-rr97.2%
Final simplification97.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 7.5e+67) (* x (/ (/ y z) z)) (* y (/ x (* z z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (y <= 7.5e+67) {
tmp = x * ((y / z) / 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 <= 7.5d+67) then
tmp = x * ((y / z) / 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 <= 7.5e+67) {
tmp = x * ((y / z) / z);
} else {
tmp = y * (x / (z * z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if y <= 7.5e+67: tmp = x * ((y / z) / z) else: tmp = y * (x / (z * z)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (y <= 7.5e+67) tmp = Float64(x * Float64(Float64(y / z) / 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 <= 7.5e+67)
tmp = x * ((y / z) / 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, 7.5e+67], N[(x * N[(N[(y / z), $MachinePrecision] / 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 7.5 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\end{array}
\end{array}
if y < 7.5000000000000005e67Initial program 84.4%
associate-*l*84.4%
times-frac95.1%
distribute-lft-in95.2%
fma-def95.2%
*-rgt-identity95.2%
Simplified95.2%
fma-udef95.2%
*-rgt-identity95.2%
distribute-lft-in95.1%
times-frac84.4%
associate-*l*84.4%
associate-/r*85.9%
times-frac97.0%
Applied egg-rr97.0%
associate-/l*97.0%
associate-/r/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 74.7%
unpow274.7%
*-commutative74.7%
associate-*r/76.1%
associate-/r*79.9%
Simplified79.9%
if 7.5000000000000005e67 < y Initial program 73.0%
times-frac91.8%
Simplified91.8%
Taylor expanded in z around 0 65.7%
Final simplification76.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -0.02) (* x (/ (/ y z) z)) (* (/ x z) (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -0.02) {
tmp = x * ((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 (x <= (-0.02d0)) then
tmp = x * ((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 (x <= -0.02) {
tmp = x * ((y / z) / z);
} else {
tmp = (x / z) * (y / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -0.02: tmp = x * ((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 (x <= -0.02) tmp = Float64(x * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(x / z) * Float64(y / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= -0.02)
tmp = x * ((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[LessEqual[x, -0.02], N[(x * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.02:\\
\;\;\;\;x \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if x < -0.0200000000000000004Initial program 76.4%
associate-*l*76.4%
times-frac87.1%
distribute-lft-in87.1%
fma-def87.1%
*-rgt-identity87.1%
Simplified87.1%
fma-udef87.1%
*-rgt-identity87.1%
distribute-lft-in87.1%
times-frac76.4%
associate-*l*76.4%
associate-/r*77.9%
times-frac94.1%
Applied egg-rr94.1%
associate-/l*94.3%
associate-/r/93.5%
Applied egg-rr93.5%
Taylor expanded in z around 0 68.3%
unpow268.3%
*-commutative68.3%
associate-*r/71.8%
associate-/r*77.4%
Simplified77.4%
if -0.0200000000000000004 < x Initial program 83.7%
associate-*l*83.7%
times-frac97.4%
distribute-lft-in97.4%
fma-def97.4%
*-rgt-identity97.4%
Simplified97.4%
Taylor expanded in z around 0 73.0%
unpow273.0%
associate-/l/76.3%
associate-*r/79.2%
associate-*l/79.2%
Simplified79.2%
Final simplification78.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -7.6e-59) (* x (/ (/ y z) z)) (/ y (* z (/ z x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e-59) {
tmp = x * ((y / z) / z);
} else {
tmp = y / (z * (z / x));
}
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 (x <= (-7.6d-59)) then
tmp = x * ((y / z) / z)
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e-59) {
tmp = x * ((y / z) / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -7.6e-59: tmp = x * ((y / z) / z) else: tmp = y / (z * (z / x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -7.6e-59) tmp = Float64(x * Float64(Float64(y / z) / z)); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= -7.6e-59)
tmp = x * ((y / z) / z);
else
tmp = y / (z * (z / x));
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[x, -7.6e-59], N[(x * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if x < -7.59999999999999966e-59Initial program 77.3%
associate-*l*77.3%
times-frac88.9%
distribute-lft-in89.0%
fma-def89.0%
*-rgt-identity89.0%
Simplified89.0%
fma-udef89.0%
*-rgt-identity89.0%
distribute-lft-in88.9%
times-frac77.3%
associate-*l*77.3%
associate-/r*81.0%
times-frac94.9%
Applied egg-rr94.9%
associate-/l*95.0%
associate-/r/94.4%
Applied egg-rr94.4%
Taylor expanded in z around 0 68.0%
unpow268.0%
*-commutative68.0%
associate-*r/71.0%
associate-/r*75.7%
Simplified75.7%
if -7.59999999999999966e-59 < x Initial program 83.8%
associate-*l*83.8%
times-frac97.2%
distribute-lft-in97.2%
fma-def97.2%
*-rgt-identity97.2%
Simplified97.2%
Taylor expanded in z around 0 73.4%
unpow273.4%
associate-/l*74.1%
associate-/l*80.7%
Simplified80.7%
associate-/r/80.7%
Applied egg-rr80.7%
Final simplification79.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -1.4e-58) (* x (/ (/ y z) z)) (/ y (/ z (/ x z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-58) {
tmp = x * ((y / z) / z);
} else {
tmp = y / (z / (x / 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 (x <= (-1.4d-58)) then
tmp = x * ((y / z) / z)
else
tmp = y / (z / (x / z))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.4e-58) {
tmp = x * ((y / z) / z);
} else {
tmp = y / (z / (x / z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -1.4e-58: tmp = x * ((y / z) / z) else: tmp = y / (z / (x / z)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -1.4e-58) tmp = Float64(x * Float64(Float64(y / z) / z)); else tmp = Float64(y / Float64(z / Float64(x / z))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= -1.4e-58)
tmp = x * ((y / z) / z);
else
tmp = y / (z / (x / 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[x, -1.4e-58], N[(x * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-58}:\\
\;\;\;\;x \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{\frac{x}{z}}}\\
\end{array}
\end{array}
if x < -1.4e-58Initial program 77.3%
associate-*l*77.3%
times-frac88.9%
distribute-lft-in89.0%
fma-def89.0%
*-rgt-identity89.0%
Simplified89.0%
fma-udef89.0%
*-rgt-identity89.0%
distribute-lft-in88.9%
times-frac77.3%
associate-*l*77.3%
associate-/r*81.0%
times-frac94.9%
Applied egg-rr94.9%
associate-/l*95.0%
associate-/r/94.4%
Applied egg-rr94.4%
Taylor expanded in z around 0 68.0%
unpow268.0%
*-commutative68.0%
associate-*r/71.0%
associate-/r*75.7%
Simplified75.7%
if -1.4e-58 < x Initial program 83.8%
associate-*l*83.8%
times-frac97.2%
distribute-lft-in97.2%
fma-def97.2%
*-rgt-identity97.2%
Simplified97.2%
Taylor expanded in z around 0 73.4%
unpow273.4%
associate-/l*74.1%
associate-/l*80.7%
Simplified80.7%
Final simplification79.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* x (/ (/ y z) z)))
assert(x < y);
double code(double x, double y, double z) {
return x * ((y / z) / 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 * ((y / z) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return x * ((y / z) / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return x * ((y / z) / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(x * Float64(Float64(y / z) / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = x * ((y / z) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(x * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{\frac{y}{z}}{z}
\end{array}
Initial program 81.9%
associate-*l*81.9%
times-frac94.7%
distribute-lft-in94.7%
fma-def94.8%
*-rgt-identity94.8%
Simplified94.8%
fma-udef94.7%
*-rgt-identity94.7%
distribute-lft-in94.7%
times-frac81.9%
associate-*l*81.9%
associate-/r*84.5%
times-frac97.2%
Applied egg-rr97.2%
associate-/l*97.2%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in z around 0 71.8%
unpow271.8%
*-commutative71.8%
associate-*r/72.3%
associate-/r*74.5%
Simplified74.5%
Final simplification74.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ x z) (- y)))
assert(x < y);
double code(double x, double y, double z) {
return (x / z) * -y;
}
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
end function
assert x < y;
public static double code(double x, double y, double z) {
return (x / z) * -y;
}
[x, y] = sort([x, y]) def code(x, y, z): return (x / z) * -y
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(x / z) * Float64(-y)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (x / z) * -y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \left(-y\right)
\end{array}
Initial program 81.9%
associate-*l*81.9%
times-frac94.7%
distribute-lft-in94.7%
fma-def94.8%
*-rgt-identity94.8%
Simplified94.8%
Taylor expanded in z around 0 68.2%
neg-mul-168.2%
+-commutative68.2%
unsub-neg68.2%
Simplified68.2%
Taylor expanded in z around inf 26.5%
associate-*r/26.5%
*-commutative26.5%
neg-mul-126.5%
distribute-rgt-neg-in26.5%
associate-*l/30.5%
Simplified30.5%
Final simplification30.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 2023199
(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))))