
(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 13 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}
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sqrt y))))
(if (<= (* y (+ 1.0 (* z z))) 4e+302)
(/ (/ 1.0 x) (fma (* y z) z y))
(* (/ 1.0 t_0) (/ 1.0 (* x t_0))))))assert(x < y);
double code(double x, double y, double z) {
double t_0 = z * sqrt(y);
double tmp;
if ((y * (1.0 + (z * z))) <= 4e+302) {
tmp = (1.0 / x) / fma((y * z), z, y);
} else {
tmp = (1.0 / t_0) * (1.0 / (x * t_0));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z) t_0 = Float64(z * sqrt(y)) tmp = 0.0 if (Float64(y * Float64(1.0 + Float64(z * z))) <= 4e+302) tmp = Float64(Float64(1.0 / x) / fma(Float64(y * z), z, y)); else tmp = Float64(Float64(1.0 / t_0) * Float64(1.0 / Float64(x * t_0))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+302], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(1.0 / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := z \cdot \sqrt{y}\\
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 4 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0} \cdot \frac{1}{x \cdot t_0}\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.0000000000000003e302Initial program 93.3%
distribute-lft-in93.3%
*-rgt-identity93.3%
+-commutative93.3%
associate-*r*95.9%
fma-def95.9%
Applied egg-rr95.9%
if 4.0000000000000003e302 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 74.8%
associate-/r*74.8%
*-commutative74.8%
sqr-neg74.8%
+-commutative74.8%
distribute-lft1-in74.8%
*-commutative74.8%
fma-def74.8%
sqr-neg74.8%
Simplified74.8%
associate-/r*74.8%
fma-udef74.8%
*-rgt-identity74.8%
distribute-lft-in74.8%
fma-udef74.8%
associate-/r*79.0%
associate-/r*79.0%
*-un-lft-identity79.0%
add-sqr-sqrt79.0%
times-frac79.0%
fma-udef79.0%
+-commutative79.0%
hypot-1-def79.0%
associate-/r*79.0%
fma-udef79.0%
+-commutative79.0%
hypot-1-def92.9%
Applied egg-rr92.9%
Taylor expanded in z around inf 74.8%
unpow274.8%
associate-*r*92.9%
Simplified92.9%
associate-*r*74.8%
associate-/r*74.8%
*-un-lft-identity74.8%
add-sqr-sqrt74.8%
times-frac74.8%
*-commutative74.8%
sqrt-prod74.8%
sqrt-prod36.5%
add-sqr-sqrt74.8%
*-commutative74.8%
sqrt-prod76.9%
sqrt-prod49.9%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
associate-/l/99.7%
Simplified99.7%
Final simplification96.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* y (+ 1.0 (* z z))) 4e+302) (/ (/ 1.0 x) (fma (* y z) z y)) (* (/ 1.0 z) (/ (/ 1.0 x) (* y z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((y * (1.0 + (z * z))) <= 4e+302) {
tmp = (1.0 / x) / fma((y * z), z, y);
} else {
tmp = (1.0 / z) * ((1.0 / x) / (y * z));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(y * Float64(1.0 + Float64(z * z))) <= 4e+302) tmp = Float64(Float64(1.0 / x) / fma(Float64(y * z), z, y)); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / x) / Float64(y * z))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+302], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 4 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{1}{x}}{\mathsf{fma}\left(y \cdot z, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{\frac{1}{x}}{y \cdot z}\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.0000000000000003e302Initial program 93.3%
distribute-lft-in93.3%
*-rgt-identity93.3%
+-commutative93.3%
associate-*r*95.9%
fma-def95.9%
Applied egg-rr95.9%
if 4.0000000000000003e302 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 74.8%
associate-/r*74.8%
*-commutative74.8%
sqr-neg74.8%
+-commutative74.8%
distribute-lft1-in74.8%
*-commutative74.8%
fma-def74.8%
sqr-neg74.8%
Simplified74.8%
associate-/r*74.8%
fma-udef74.8%
*-rgt-identity74.8%
distribute-lft-in74.8%
fma-udef74.8%
associate-/r*79.0%
associate-/r*79.0%
*-un-lft-identity79.0%
add-sqr-sqrt79.0%
times-frac79.0%
fma-udef79.0%
+-commutative79.0%
hypot-1-def79.0%
associate-/r*79.0%
fma-udef79.0%
+-commutative79.0%
hypot-1-def92.9%
Applied egg-rr92.9%
Taylor expanded in z around inf 74.8%
unpow274.8%
associate-*r*92.9%
Simplified92.9%
associate-*r*74.8%
associate-/r*74.8%
*-un-lft-identity74.8%
associate-*r*92.8%
*-commutative92.8%
times-frac97.1%
Applied egg-rr97.1%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (- 1.0 (* z z)) (* y x)) (* (/ 1.0 (* y z)) (/ (/ 1.0 x) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / (y * z)) * ((1.0 / 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 ((z * z) <= 1d-5) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = (1.0d0 / (y * z)) * ((1.0d0 / x) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / (y * z)) * ((1.0 / x) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 - (z * z)) / (y * x) else: tmp = (1.0 / (y * z)) * ((1.0 / x) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(Float64(1.0 / Float64(y * z)) * Float64(Float64(1.0 / x) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 - (z * z)) / (y * x);
else
tmp = (1.0 / (y * z)) * ((1.0 / 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[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot z} \cdot \frac{\frac{1}{x}}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 90.0%
associate-/r*89.9%
+-commutative89.9%
mul-1-neg89.9%
unsub-neg89.9%
associate-/l/90.0%
unpow290.0%
*-commutative90.0%
div-sub99.5%
Simplified99.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
associate-/r*81.2%
fma-udef81.2%
*-rgt-identity81.2%
distribute-lft-in81.2%
fma-udef81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def80.6%
associate-/r*80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def91.7%
Applied egg-rr91.7%
Taylor expanded in z around inf 80.3%
unpow280.3%
associate-*r*90.5%
Simplified90.5%
associate-*r*80.3%
associate-/r*81.2%
*-un-lft-identity81.2%
associate-*r*91.4%
times-frac95.2%
Applied egg-rr95.2%
Final simplification97.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+51) (/ 1.0 (* x (+ y (* y (* z z))))) (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+51) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} else {
tmp = (1.0 / (z * x)) / (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 * z) <= 2d+51) then
tmp = 1.0d0 / (x * (y + (y * (z * z))))
else
tmp = (1.0d0 / (z * x)) / (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 * z) <= 2e+51) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} else {
tmp = (1.0 / (z * x)) / (y * z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 2e+51: tmp = 1.0 / (x * (y + (y * (z * z)))) else: tmp = (1.0 / (z * x)) / (y * z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+51) tmp = Float64(1.0 / Float64(x * Float64(y + Float64(y * Float64(z * z))))); else tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 2e+51)
tmp = 1.0 / (x * (y + (y * (z * z))));
else
tmp = (1.0 / (z * x)) / (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[N[(z * z), $MachinePrecision], 2e+51], N[(1.0 / N[(x * N[(y + N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+51}:\\
\;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\
\end{array}
\end{array}
if (*.f64 z z) < 2e51Initial program 98.9%
associate-/r*99.0%
*-commutative99.0%
sqr-neg99.0%
+-commutative99.0%
distribute-lft1-in99.0%
*-commutative99.0%
fma-def99.0%
sqr-neg99.0%
Simplified99.0%
fma-udef99.0%
Applied egg-rr99.0%
if 2e51 < (*.f64 z z) Initial program 80.3%
associate-/r*79.3%
*-commutative79.3%
sqr-neg79.3%
+-commutative79.3%
distribute-lft1-in79.3%
*-commutative79.3%
fma-def79.3%
sqr-neg79.3%
Simplified79.3%
associate-/r*80.3%
fma-udef80.3%
*-rgt-identity80.3%
distribute-lft-in80.3%
fma-udef80.3%
associate-/r*78.9%
associate-/r*78.9%
*-un-lft-identity78.9%
add-sqr-sqrt78.9%
times-frac78.8%
fma-udef78.8%
+-commutative78.8%
hypot-1-def78.8%
associate-/r*78.8%
fma-udef78.8%
+-commutative78.8%
hypot-1-def91.0%
Applied egg-rr91.0%
Taylor expanded in z around inf 79.3%
unpow279.3%
associate-*r*90.4%
Simplified90.4%
associate-*r*79.3%
associate-/r*80.3%
associate-/r*78.9%
associate-/r*78.9%
*-un-lft-identity78.9%
times-frac91.1%
Applied egg-rr91.1%
associate-/r*91.0%
associate-/r*92.3%
associate-*r/95.7%
frac-times95.7%
metadata-eval95.7%
Applied egg-rr95.7%
Final simplification97.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+81) (/ (/ 1.0 (* y x)) (+ 1.0 (* z z))) (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+81) {
tmp = (1.0 / (y * x)) / (1.0 + (z * z));
} else {
tmp = (1.0 / (z * x)) / (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 * z) <= 2d+81) then
tmp = (1.0d0 / (y * x)) / (1.0d0 + (z * z))
else
tmp = (1.0d0 / (z * x)) / (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 * z) <= 2e+81) {
tmp = (1.0 / (y * x)) / (1.0 + (z * z));
} else {
tmp = (1.0 / (z * x)) / (y * z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 2e+81: tmp = (1.0 / (y * x)) / (1.0 + (z * z)) else: tmp = (1.0 / (z * x)) / (y * z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+81) tmp = Float64(Float64(1.0 / Float64(y * x)) / Float64(1.0 + Float64(z * z))); else tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 2e+81)
tmp = (1.0 / (y * x)) / (1.0 + (z * z));
else
tmp = (1.0 / (z * x)) / (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[N[(z * z), $MachinePrecision], 2e+81], N[(N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+81}:\\
\;\;\;\;\frac{\frac{1}{y \cdot x}}{1 + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999984e81Initial program 98.3%
associate-/r*98.4%
*-commutative98.4%
sqr-neg98.4%
+-commutative98.4%
distribute-lft1-in98.4%
*-commutative98.4%
fma-def98.4%
sqr-neg98.4%
Simplified98.4%
associate-/r*98.3%
fma-udef98.3%
*-rgt-identity98.3%
distribute-lft-in98.3%
fma-udef98.3%
associate-/r*99.0%
associate-/r*99.1%
*-un-lft-identity99.1%
add-sqr-sqrt99.0%
times-frac99.0%
fma-udef99.0%
+-commutative99.0%
hypot-1-def99.0%
associate-/r*99.0%
fma-udef99.0%
+-commutative99.0%
hypot-1-def98.9%
Applied egg-rr98.9%
frac-times99.0%
*-un-lft-identity99.0%
associate-/l/99.0%
*-commutative99.0%
hypot-udef99.1%
hypot-udef99.0%
add-sqr-sqrt99.1%
metadata-eval99.1%
Applied egg-rr99.1%
if 1.99999999999999984e81 < (*.f64 z z) Initial program 80.3%
associate-/r*79.2%
*-commutative79.2%
sqr-neg79.2%
+-commutative79.2%
distribute-lft1-in79.2%
*-commutative79.2%
fma-def79.2%
sqr-neg79.2%
Simplified79.2%
associate-/r*80.3%
fma-udef80.3%
*-rgt-identity80.3%
distribute-lft-in80.3%
fma-udef80.3%
associate-/r*78.8%
associate-/r*78.8%
*-un-lft-identity78.8%
add-sqr-sqrt78.8%
times-frac78.7%
fma-udef78.7%
+-commutative78.7%
hypot-1-def78.7%
associate-/r*78.7%
fma-udef78.7%
+-commutative78.7%
hypot-1-def91.4%
Applied egg-rr91.4%
Taylor expanded in z around inf 79.2%
unpow279.2%
associate-*r*90.8%
Simplified90.8%
associate-*r*79.2%
associate-/r*80.3%
associate-/r*78.8%
associate-/r*78.8%
*-un-lft-identity78.8%
times-frac91.5%
Applied egg-rr91.5%
associate-/r*91.4%
associate-/r*93.6%
associate-*r/96.3%
frac-times96.4%
metadata-eval96.4%
Applied egg-rr96.4%
Final simplification97.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1.0) (/ 1.0 (* y x)) (/ 1.0 (* x (* y (* z z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1.0) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (x * (y * (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 ((z * z) <= 1.0d0) then
tmp = 1.0d0 / (y * x)
else
tmp = 1.0d0 / (x * (y * (z * z)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1.0) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (x * (y * (z * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1.0: tmp = 1.0 / (y * x) else: tmp = 1.0 / (x * (y * (z * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1.0) tmp = Float64(1.0 / Float64(y * x)); else tmp = Float64(1.0 / Float64(x * Float64(y * Float64(z * z)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1.0)
tmp = 1.0 / (y * x);
else
tmp = 1.0 / (x * (y * (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[N[(z * z), $MachinePrecision], 1.0], N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 1:\\
\;\;\;\;\frac{1}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(y \cdot \left(z \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
*-commutative99.0%
Simplified99.0%
if 1 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
Taylor expanded in z around inf 80.3%
unpow280.3%
Simplified80.3%
Final simplification89.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ 1.0 (* y x)) (/ 1.0 (* x (* z (* y z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (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 * z) <= 1d-5) then
tmp = 1.0d0 / (y * x)
else
tmp = 1.0d0 / (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 * z) <= 1e-5) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (x * (z * (y * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = 1.0 / (y * x) else: tmp = 1.0 / (x * (z * (y * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(1.0 / Float64(y * x)); else tmp = Float64(1.0 / Float64(x * Float64(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 ((z * z) <= 1e-5)
tmp = 1.0 / (y * x);
else
tmp = 1.0 / (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[N[(z * z), $MachinePrecision], 1e-5], N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
*-commutative99.0%
Simplified99.0%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
associate-/r*81.2%
fma-udef81.2%
*-rgt-identity81.2%
distribute-lft-in81.2%
fma-udef81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def80.6%
associate-/r*80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def91.7%
Applied egg-rr91.7%
Taylor expanded in z around inf 80.3%
unpow280.3%
associate-*r*90.5%
Simplified90.5%
Final simplification94.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ 1.0 (* y x)) (/ 1.0 (* y (* z (* z x))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (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 ((z * z) <= 1d-5) then
tmp = 1.0d0 / (y * x)
else
tmp = 1.0d0 / (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 ((z * z) <= 1e-5) {
tmp = 1.0 / (y * x);
} else {
tmp = 1.0 / (y * (z * (z * x)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = 1.0 / (y * x) else: tmp = 1.0 / (y * (z * (z * x))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(1.0 / Float64(y * x)); else tmp = Float64(1.0 / 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 ((z * z) <= 1e-5)
tmp = 1.0 / (y * x);
else
tmp = 1.0 / (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[N[(z * z), $MachinePrecision], 1e-5], N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 99.0%
*-commutative99.0%
Simplified99.0%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
Taylor expanded in z around inf 80.3%
*-commutative80.3%
unpow280.3%
associate-*l*80.3%
associate-*l*86.1%
Simplified86.1%
Final simplification92.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (- 1.0 (* z z)) (* y x)) (/ (/ 1.0 x) (* z (* y z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / 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 * z) <= 1d-5) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = (1.0d0 / 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 * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / x) / (z * (y * z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 - (z * z)) / (y * x) else: tmp = (1.0 / x) / (z * (y * z)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(Float64(1.0 / x) / Float64(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 ((z * z) <= 1e-5)
tmp = (1.0 - (z * z)) / (y * x);
else
tmp = (1.0 / 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[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{z \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 90.0%
associate-/r*89.9%
+-commutative89.9%
mul-1-neg89.9%
unsub-neg89.9%
associate-/l/90.0%
unpow290.0%
*-commutative90.0%
div-sub99.5%
Simplified99.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
associate-/r*81.2%
fma-udef81.2%
*-rgt-identity81.2%
distribute-lft-in81.2%
fma-udef81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def80.6%
associate-/r*80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def91.7%
Applied egg-rr91.7%
Taylor expanded in z around inf 80.3%
associate-/r*81.2%
unpow281.2%
Simplified81.2%
Taylor expanded in y around 0 81.2%
unpow281.2%
associate-*r*91.4%
Simplified91.4%
Final simplification95.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (- 1.0 (* z z)) (* y x)) (/ (/ 1.0 z) (* z (* y x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / z) / (z * (y * 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 ((z * z) <= 1d-5) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = (1.0d0 / z) / (z * (y * x))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / z) / (z * (y * x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 - (z * z)) / (y * x) else: tmp = (1.0 / z) / (z * (y * x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(Float64(1.0 / z) / Float64(z * Float64(y * x))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 - (z * z)) / (y * x);
else
tmp = (1.0 / z) / (z * (y * 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[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{z \cdot \left(y \cdot x\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 90.0%
associate-/r*89.9%
+-commutative89.9%
mul-1-neg89.9%
unsub-neg89.9%
associate-/l/90.0%
unpow290.0%
*-commutative90.0%
div-sub99.5%
Simplified99.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
associate-/r*81.2%
fma-udef81.2%
*-rgt-identity81.2%
distribute-lft-in81.2%
fma-udef81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def80.6%
associate-/r*80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def91.7%
Applied egg-rr91.7%
Taylor expanded in z around inf 80.3%
unpow280.3%
associate-*r*90.5%
Simplified90.5%
associate-*r*80.3%
associate-/r*81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
times-frac91.8%
Applied egg-rr91.8%
associate-/l/91.8%
un-div-inv91.8%
Applied egg-rr91.8%
Final simplification95.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (- 1.0 (* z z)) (* y x)) (/ (/ 1.0 (* z x)) (* y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / (z * x)) / (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 * z) <= 1d-5) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = (1.0d0 / (z * x)) / (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 * z) <= 1e-5) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = (1.0 / (z * x)) / (y * z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 - (z * z)) / (y * x) else: tmp = (1.0 / (z * x)) / (y * z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(Float64(1.0 / Float64(z * x)) / Float64(y * z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 - (z * z)) / (y * x);
else
tmp = (1.0 / (z * x)) / (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[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot x}}{y \cdot z}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.6%
associate-/r*99.7%
*-commutative99.7%
sqr-neg99.7%
+-commutative99.7%
distribute-lft1-in99.7%
*-commutative99.7%
fma-def99.7%
sqr-neg99.7%
Simplified99.7%
Taylor expanded in z around 0 90.0%
associate-/r*89.9%
+-commutative89.9%
mul-1-neg89.9%
unsub-neg89.9%
associate-/l/90.0%
unpow290.0%
*-commutative90.0%
div-sub99.5%
Simplified99.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*80.3%
*-commutative80.3%
sqr-neg80.3%
+-commutative80.3%
distribute-lft1-in80.3%
*-commutative80.3%
fma-def80.3%
sqr-neg80.3%
Simplified80.3%
associate-/r*81.2%
fma-udef81.2%
*-rgt-identity81.2%
distribute-lft-in81.2%
fma-udef81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
add-sqr-sqrt80.6%
times-frac80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def80.6%
associate-/r*80.6%
fma-udef80.6%
+-commutative80.6%
hypot-1-def91.7%
Applied egg-rr91.7%
Taylor expanded in z around inf 80.3%
unpow280.3%
associate-*r*90.5%
Simplified90.5%
associate-*r*80.3%
associate-/r*81.2%
associate-/r*80.6%
associate-/r*80.6%
*-un-lft-identity80.6%
times-frac91.8%
Applied egg-rr91.8%
associate-/r*91.7%
associate-/r*92.2%
associate-*r/95.3%
frac-times95.3%
metadata-eval95.3%
Applied egg-rr95.3%
Final simplification97.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z 0.88) (/ (- 1.0 (* z z)) (* y x)) (/ 1.0 (* y (* z (* z x))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 0.88) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = 1.0 / (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 (z <= 0.88d0) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = 1.0d0 / (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 (z <= 0.88) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = 1.0 / (y * (z * (z * x)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 0.88: tmp = (1.0 - (z * z)) / (y * x) else: tmp = 1.0 / (y * (z * (z * x))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= 0.88) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(1.0 / 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 (z <= 0.88)
tmp = (1.0 - (z * z)) / (y * x);
else
tmp = 1.0 / (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[z, 0.88], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.88:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if z < 0.880000000000000004Initial program 93.4%
associate-/r*93.1%
*-commutative93.1%
sqr-neg93.1%
+-commutative93.1%
distribute-lft1-in93.1%
*-commutative93.1%
fma-def93.1%
sqr-neg93.1%
Simplified93.1%
Taylor expanded in z around 0 62.5%
associate-/r*62.4%
+-commutative62.4%
mul-1-neg62.4%
unsub-neg62.4%
associate-/l/62.5%
unpow262.5%
*-commutative62.5%
div-sub68.9%
Simplified68.9%
if 0.880000000000000004 < z Initial program 82.0%
associate-/r*81.3%
*-commutative81.3%
sqr-neg81.3%
+-commutative81.3%
distribute-lft1-in81.3%
*-commutative81.3%
fma-def81.3%
sqr-neg81.3%
Simplified81.3%
Taylor expanded in z around inf 81.3%
*-commutative81.3%
unpow281.3%
associate-*l*80.0%
associate-*l*86.6%
Simplified86.6%
Final simplification73.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ 1.0 (* y x)))
assert(x < y);
double code(double x, double y, double z) {
return 1.0 / (y * x);
}
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 = 1.0d0 / (y * x)
end function
assert x < y;
public static double code(double x, double y, double z) {
return 1.0 / (y * x);
}
[x, y] = sort([x, y]) def code(x, y, z): return 1.0 / (y * x)
x, y = sort([x, y]) function code(x, y, z) return Float64(1.0 / Float64(y * x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = 1.0 / (y * x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y \cdot x}
\end{array}
Initial program 90.3%
associate-/r*89.8%
*-commutative89.8%
sqr-neg89.8%
+-commutative89.8%
distribute-lft1-in89.9%
*-commutative89.9%
fma-def89.9%
sqr-neg89.9%
Simplified89.9%
Taylor expanded in z around 0 56.2%
*-commutative56.2%
Simplified56.2%
Final simplification56.2%
(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 2023280
(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)))))