
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (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 = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (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 = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= (* z z) 4e+119) (/ (/ 1.0 x) (* y (+ (* z z) 1.0))) (* (/ 1.0 z) (/ (/ 1.0 x) (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+119) {
tmp = (1.0 / x) / (y * ((z * z) + 1.0));
} else {
tmp = (1.0 / z) * ((1.0 / x) / (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 * z) <= 4d+119) then
tmp = (1.0d0 / x) / (y * ((z * z) + 1.0d0))
else
tmp = (1.0d0 / z) * ((1.0d0 / x) / (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+119) {
tmp = (1.0 / x) / (y * ((z * z) + 1.0));
} else {
tmp = (1.0 / z) * ((1.0 / x) / (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4e+119: tmp = (1.0 / x) / (y * ((z * z) + 1.0)) else: tmp = (1.0 / z) * ((1.0 / x) / (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+119) tmp = Float64(Float64(1.0 / x) / Float64(y * Float64(Float64(z * z) + 1.0))); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x) / Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e+119) tmp = (1.0 / x) / (y * ((z * z) + 1.0)); else tmp = (1.0 / z) * ((1.0 / x) / (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+119], N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(N[(z * z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+119}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(z \cdot z + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{x}}{z \cdot y}\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999978e119Initial program 99.6%
if 3.99999999999999978e119 < (*.f64 z z) Initial program 73.9%
associate-/r*73.3%
*-commutative73.3%
sqr-neg73.3%
+-commutative73.3%
distribute-lft1-in73.3%
*-commutative73.3%
fma-def73.3%
sqr-neg73.3%
Simplified73.3%
Taylor expanded in z around inf 69.3%
unpow269.3%
associate-*r*73.3%
*-commutative73.3%
associate-/r*73.9%
associate-*r*86.3%
*-commutative86.3%
associate-*r*86.3%
Simplified86.3%
*-un-lft-identity86.3%
times-frac99.1%
Applied egg-rr99.1%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 5e-13) (/ (/ 1.0 y) x) (* (/ 1.0 z) (/ (/ 1.0 x) (* z y)))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-13) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) * ((1.0 / x) / (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 * z) <= 5d-13) then
tmp = (1.0d0 / y) / x
else
tmp = (1.0d0 / z) * ((1.0d0 / x) / (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-13) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) * ((1.0 / x) / (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 5e-13: tmp = (1.0 / y) / x else: tmp = (1.0 / z) * ((1.0 / x) / (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e-13) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x) / Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 5e-13) tmp = (1.0 / y) / x; else tmp = (1.0 / z) * ((1.0 / x) / (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-13], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{x}}{z \cdot y}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e-13Initial program 99.6%
associate-/r*98.7%
*-commutative98.7%
sqr-neg98.7%
+-commutative98.7%
distribute-lft1-in98.7%
*-commutative98.7%
fma-def98.7%
sqr-neg98.7%
Simplified98.7%
Taylor expanded in z around 0 98.5%
associate-/r*99.3%
div-inv99.2%
Applied egg-rr99.2%
un-div-inv99.3%
Applied egg-rr99.3%
if 4.9999999999999999e-13 < (*.f64 z z) Initial program 79.5%
associate-/r*79.1%
*-commutative79.1%
sqr-neg79.1%
+-commutative79.1%
distribute-lft1-in79.1%
*-commutative79.1%
fma-def79.1%
sqr-neg79.1%
Simplified79.1%
Taylor expanded in z around inf 74.5%
unpow274.5%
associate-*r*79.1%
*-commutative79.1%
associate-/r*79.5%
associate-*r*89.2%
*-commutative89.2%
associate-*r*89.2%
Simplified89.2%
*-un-lft-identity89.2%
times-frac98.5%
Applied egg-rr98.5%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ 1.0 (* x (* z (* z y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (x * (z * (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) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (x * (z * (z * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (x * (z * (z * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = 1.0 / (x * (z * (z * y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(x * Float64(z * Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / y) / x; else tmp = 1.0 / (x * (z * (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)}\\
\end{array}
\end{array}
if z < 1Initial program 92.3%
associate-/r*91.7%
*-commutative91.7%
sqr-neg91.7%
+-commutative91.7%
distribute-lft1-in91.7%
*-commutative91.7%
fma-def91.7%
sqr-neg91.7%
Simplified91.7%
Taylor expanded in z around 0 69.9%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
if 1 < z Initial program 81.0%
associate-/r*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-def79.8%
sqr-neg79.8%
Simplified79.8%
Taylor expanded in z around inf 78.1%
unpow278.1%
associate-*r*79.8%
*-commutative79.8%
associate-*r*90.8%
Simplified90.8%
Final simplification74.6%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ 1.0 (* y (* z (* z x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (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 (z <= 1.0d0) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (y * (z * (z * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (y * (z * (z * x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = 1.0 / (y * (z * (z * x))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(y * Float64(z * Float64(z * x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / y) / x; else tmp = 1.0 / (y * (z * (z * x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if z < 1Initial program 92.3%
associate-/r*91.7%
*-commutative91.7%
sqr-neg91.7%
+-commutative91.7%
distribute-lft1-in91.7%
*-commutative91.7%
fma-def91.7%
sqr-neg91.7%
Simplified91.7%
Taylor expanded in z around 0 69.9%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
if 1 < z Initial program 81.0%
associate-/r*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-def79.8%
sqr-neg79.8%
Simplified79.8%
Taylor expanded in z around inf 78.1%
unpow278.1%
associate-*l*89.1%
Simplified89.1%
Final simplification74.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ 1.0 (* z (* y (* z x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (z * (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 <= 1.0d0) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (z * (y * (z * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (z * (y * (z * x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = 1.0 / (z * (y * (z * x))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(z * Float64(y * Float64(z * x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / y) / x; else tmp = 1.0 / (z * (y * (z * x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(z * N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if z < 1Initial program 92.3%
associate-/r*91.7%
*-commutative91.7%
sqr-neg91.7%
+-commutative91.7%
distribute-lft1-in91.7%
*-commutative91.7%
fma-def91.7%
sqr-neg91.7%
Simplified91.7%
Taylor expanded in z around 0 69.9%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
if 1 < z Initial program 81.0%
associate-/r*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-def79.8%
sqr-neg79.8%
Simplified79.8%
Taylor expanded in z around inf 78.1%
unpow278.1%
associate-*r*79.8%
*-commutative79.8%
associate-/r*81.0%
associate-*r*91.8%
*-commutative91.8%
associate-*r*91.8%
Simplified91.8%
expm1-log1p-u83.8%
expm1-udef52.0%
associate-/l/52.0%
Applied egg-rr52.0%
expm1-def82.8%
expm1-log1p90.8%
associate-*l*96.1%
associate-*r*92.6%
Simplified92.6%
Final simplification74.9%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ (/ 1.0 z) (* y (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) / (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 <= 1.0d0) then
tmp = (1.0d0 / y) / x
else
tmp = (1.0d0 / z) / (y * (z * x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) / (y * (z * x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = (1.0 / z) / (y * (z * x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(Float64(1.0 / z) / Float64(y * Float64(z * x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / y) / x; else tmp = (1.0 / z) / (y * (z * x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y \cdot \left(z \cdot x\right)}\\
\end{array}
\end{array}
if z < 1Initial program 92.3%
associate-/r*91.7%
*-commutative91.7%
sqr-neg91.7%
+-commutative91.7%
distribute-lft1-in91.7%
*-commutative91.7%
fma-def91.7%
sqr-neg91.7%
Simplified91.7%
Taylor expanded in z around 0 69.9%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
if 1 < z Initial program 81.0%
associate-/r*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-def79.8%
sqr-neg79.8%
Simplified79.8%
associate-/r*81.0%
fma-udef81.0%
*-rgt-identity81.0%
distribute-lft-in81.0%
+-commutative81.0%
associate-/r*78.7%
associate-/r*78.7%
*-un-lft-identity78.7%
+-commutative78.7%
fma-udef78.7%
add-sqr-sqrt78.8%
times-frac78.5%
fma-udef78.5%
+-commutative78.5%
hypot-1-def78.5%
fma-udef78.5%
+-commutative78.5%
hypot-1-def86.6%
Applied egg-rr86.6%
associate-/l/86.6%
un-div-inv86.7%
Applied egg-rr86.7%
Taylor expanded in z around inf 94.3%
Taylor expanded in z around inf 94.3%
Final simplification75.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ 1.0 (* y (* z x)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (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 <= 1.0d0) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (y * (z * x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (y * (z * x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = 1.0 / (y * (z * x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(y * Float64(z * x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.0) tmp = (1.0 / y) / x; else tmp = 1.0 / (y * (z * x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot x\right)}\\
\end{array}
\end{array}
if z < 1Initial program 92.3%
associate-/r*91.7%
*-commutative91.7%
sqr-neg91.7%
+-commutative91.7%
distribute-lft1-in91.7%
*-commutative91.7%
fma-def91.7%
sqr-neg91.7%
Simplified91.7%
Taylor expanded in z around 0 69.9%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
if 1 < z Initial program 81.0%
associate-/r*79.8%
*-commutative79.8%
sqr-neg79.8%
+-commutative79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-def79.8%
sqr-neg79.8%
Simplified79.8%
associate-/r*81.0%
fma-udef81.0%
*-rgt-identity81.0%
distribute-lft-in81.0%
+-commutative81.0%
associate-/r*78.7%
associate-/r*78.7%
*-un-lft-identity78.7%
+-commutative78.7%
fma-udef78.7%
add-sqr-sqrt78.8%
times-frac78.5%
fma-udef78.5%
+-commutative78.5%
hypot-1-def78.5%
fma-udef78.5%
+-commutative78.5%
hypot-1-def86.6%
Applied egg-rr86.6%
associate-/l/86.6%
un-div-inv86.7%
Applied egg-rr86.7%
Taylor expanded in z around inf 94.3%
Taylor expanded in z around 0 42.7%
Final simplification64.8%
(FPCore (x y z) :precision binary64 (/ 1.0 (* x y)))
double code(double x, double y, double z) {
return 1.0 / (x * y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 / (x * y)
end function
public static double code(double x, double y, double z) {
return 1.0 / (x * y);
}
def code(x, y, z): return 1.0 / (x * y)
function code(x, y, z) return Float64(1.0 / Float64(x * y)) end
function tmp = code(x, y, z) tmp = 1.0 / (x * y); end
code[x_, y_, z_] := N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot y}
\end{array}
Initial program 90.0%
associate-/r*89.3%
*-commutative89.3%
sqr-neg89.3%
+-commutative89.3%
distribute-lft1-in89.3%
*-commutative89.3%
fma-def89.3%
sqr-neg89.3%
Simplified89.3%
Taylor expanded in z around 0 59.7%
Final simplification59.7%
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) y))
double code(double x, double y, double z) {
return (1.0 / x) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / y
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / y;
}
def code(x, y, z): return (1.0 / x) / y
function code(x, y, z) return Float64(Float64(1.0 / x) / y) end
function tmp = code(x, y, z) tmp = (1.0 / x) / y; end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y}
\end{array}
Initial program 90.0%
associate-/r*89.3%
*-commutative89.3%
sqr-neg89.3%
+-commutative89.3%
distribute-lft1-in89.3%
*-commutative89.3%
fma-def89.3%
sqr-neg89.3%
Simplified89.3%
Taylor expanded in z around 0 59.7%
associate-/r*59.9%
div-inv59.9%
Applied egg-rr59.9%
associate-*l/60.0%
*-un-lft-identity60.0%
Applied egg-rr60.0%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (/ (/ 1.0 y) x))
double code(double x, double y, double z) {
return (1.0 / y) / x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / y) / x
end function
public static double code(double x, double y, double z) {
return (1.0 / y) / x;
}
def code(x, y, z): return (1.0 / y) / x
function code(x, y, z) return Float64(Float64(1.0 / y) / x) end
function tmp = code(x, y, z) tmp = (1.0 / y) / x; end
code[x_, y_, z_] := N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{y}}{x}
\end{array}
Initial program 90.0%
associate-/r*89.3%
*-commutative89.3%
sqr-neg89.3%
+-commutative89.3%
distribute-lft1-in89.3%
*-commutative89.3%
fma-def89.3%
sqr-neg89.3%
Simplified89.3%
Taylor expanded in z around 0 59.7%
associate-/r*59.9%
div-inv59.9%
Applied egg-rr59.9%
un-div-inv59.9%
Applied egg-rr59.9%
Final simplification59.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
(if (< t_1 (- INFINITY))
t_2
(if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * z) t_1 = y * t_0 t_2 = (1.0 / y) / (t_0 * x) tmp = 0 if t_1 < -math.inf: tmp = t_2 elif t_1 < 8.680743250567252e+305: tmp = (1.0 / x) / (t_0 * y) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * z)) t_1 = Float64(y * t_0) t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x)) tmp = 0.0 if (t_1 < Float64(-Inf)) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * z); t_1 = y * t_0; t_2 = (1.0 / y) / (t_0 * x); tmp = 0.0; if (t_1 < -Inf) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = (1.0 / x) / (t_0 * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t_0\\
t_2 := \frac{\frac{1}{y}}{t_0 \cdot x}\\
\mathbf{if}\;t_1 < -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023274
(FPCore (x y z)
:name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))
(/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))