
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y)) (t_1 (fabs (- t_0 (* z (/ x y))))))
(if (<= t_1 4e-143)
(fabs (+ t_0 (/ -1.0 (/ y (* x z)))))
(if (<= t_1 2e+294) t_1 (fabs (/ (- (+ x 4.0) (* x z)) y))))))
double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = fabs((t_0 - (z * (x / y))));
double tmp;
if (t_1 <= 4e-143) {
tmp = fabs((t_0 + (-1.0 / (y / (x * z)))));
} else if (t_1 <= 2e+294) {
tmp = t_1;
} else {
tmp = fabs((((x + 4.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x + 4.0d0) / y
t_1 = abs((t_0 - (z * (x / y))))
if (t_1 <= 4d-143) then
tmp = abs((t_0 + ((-1.0d0) / (y / (x * z)))))
else if (t_1 <= 2d+294) then
tmp = t_1
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = Math.abs((t_0 - (z * (x / y))));
double tmp;
if (t_1 <= 4e-143) {
tmp = Math.abs((t_0 + (-1.0 / (y / (x * z)))));
} else if (t_1 <= 2e+294) {
tmp = t_1;
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + 4.0) / y t_1 = math.fabs((t_0 - (z * (x / y)))) tmp = 0 if t_1 <= 4e-143: tmp = math.fabs((t_0 + (-1.0 / (y / (x * z))))) elif t_1 <= 2e+294: tmp = t_1 else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 4.0) / y) t_1 = abs(Float64(t_0 - Float64(z * Float64(x / y)))) tmp = 0.0 if (t_1 <= 4e-143) tmp = abs(Float64(t_0 + Float64(-1.0 / Float64(y / Float64(x * z))))); elseif (t_1 <= 2e+294) tmp = t_1; else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 4.0) / y; t_1 = abs((t_0 - (z * (x / y)))); tmp = 0.0; if (t_1 <= 4e-143) tmp = abs((t_0 + (-1.0 / (y / (x * z))))); elseif (t_1 <= 2e+294) tmp = t_1; else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 4e-143], N[Abs[N[(t$95$0 + N[(-1.0 / N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e+294], t$95$1, N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := \left|t_0 - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{-143}:\\
\;\;\;\;\left|t_0 + \frac{-1}{\frac{y}{x \cdot z}}\right|\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+294}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 3.9999999999999998e-143Initial program 84.6%
associate-*l/99.9%
clear-num100.0%
Applied egg-rr100.0%
if 3.9999999999999998e-143 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 2.00000000000000013e294Initial program 99.8%
if 2.00000000000000013e294 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 78.9%
associate-*l/87.7%
sub-div100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (- (/ (+ x 4.0) y) (* z (/ x y))))))
(if (or (<= t_0 4e-143) (not (<= t_0 2e+294)))
(fabs (/ (- (+ x 4.0) (* x z)) y))
t_0)))
double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if ((t_0 <= 4e-143) || !(t_0 <= 2e+294)) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = abs((((x + 4.0d0) / y) - (z * (x / y))))
if ((t_0 <= 4d-143) .or. (.not. (t_0 <= 2d+294))) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if ((t_0 <= 4e-143) || !(t_0 <= 2e+294)) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((((x + 4.0) / y) - (z * (x / y)))) tmp = 0 if (t_0 <= 4e-143) or not (t_0 <= 2e+294): tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))) tmp = 0.0 if ((t_0 <= 4e-143) || !(t_0 <= 2e+294)) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((((x + 4.0) / y) - (z * (x / y)))); tmp = 0.0; if ((t_0 <= 4e-143) || ~((t_0 <= 2e+294))) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$0, 4e-143], N[Not[LessEqual[t$95$0, 2e+294]], $MachinePrecision]], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-143} \lor \neg \left(t_0 \leq 2 \cdot 10^{+294}\right):\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 3.9999999999999998e-143 or 2.00000000000000013e294 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 81.0%
associate-*l/92.2%
sub-div99.9%
Applied egg-rr99.9%
if 3.9999999999999998e-143 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 2.00000000000000013e294Initial program 99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y)) (t_1 (fabs (- t_0 (* z (/ x y))))))
(if (<= t_1 4e-143)
(fabs (- (/ (* x z) y) t_0))
(if (<= t_1 2e+294) t_1 (fabs (/ (- (+ x 4.0) (* x z)) y))))))
double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = fabs((t_0 - (z * (x / y))));
double tmp;
if (t_1 <= 4e-143) {
tmp = fabs((((x * z) / y) - t_0));
} else if (t_1 <= 2e+294) {
tmp = t_1;
} else {
tmp = fabs((((x + 4.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x + 4.0d0) / y
t_1 = abs((t_0 - (z * (x / y))))
if (t_1 <= 4d-143) then
tmp = abs((((x * z) / y) - t_0))
else if (t_1 <= 2d+294) then
tmp = t_1
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + 4.0) / y;
double t_1 = Math.abs((t_0 - (z * (x / y))));
double tmp;
if (t_1 <= 4e-143) {
tmp = Math.abs((((x * z) / y) - t_0));
} else if (t_1 <= 2e+294) {
tmp = t_1;
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + 4.0) / y t_1 = math.fabs((t_0 - (z * (x / y)))) tmp = 0 if t_1 <= 4e-143: tmp = math.fabs((((x * z) / y) - t_0)) elif t_1 <= 2e+294: tmp = t_1 else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + 4.0) / y) t_1 = abs(Float64(t_0 - Float64(z * Float64(x / y)))) tmp = 0.0 if (t_1 <= 4e-143) tmp = abs(Float64(Float64(Float64(x * z) / y) - t_0)); elseif (t_1 <= 2e+294) tmp = t_1; else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + 4.0) / y; t_1 = abs((t_0 - (z * (x / y)))); tmp = 0.0; if (t_1 <= 4e-143) tmp = abs((((x * z) / y) - t_0)); elseif (t_1 <= 2e+294) tmp = t_1; else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 4e-143], N[Abs[N[(N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 2e+294], t$95$1, N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y}\\
t_1 := \left|t_0 - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{-143}:\\
\;\;\;\;\left|\frac{x \cdot z}{y} - t_0\right|\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+294}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 3.9999999999999998e-143Initial program 84.6%
associate-*l/99.9%
Applied egg-rr99.9%
if 3.9999999999999998e-143 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 2.00000000000000013e294Initial program 99.8%
if 2.00000000000000013e294 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 78.9%
associate-*l/87.7%
sub-div100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 1e+60) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1e+60) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1e+60) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1e+60], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+60}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\end{array}
\end{array}
if y < 9.9999999999999995e59Initial program 92.5%
associate-*l/94.7%
sub-div98.1%
Applied egg-rr98.1%
if 9.9999999999999995e59 < y Initial program 96.0%
fabs-sub96.0%
associate-*l/86.5%
*-commutative86.5%
associate-*l/99.8%
*-commutative99.8%
fma-neg99.8%
distribute-neg-frac99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification98.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* x (/ z y)))))
(if (<= x -1.7e+104)
t_0
(if (<= x -3.1e-16)
t_1
(if (<= x 1.5e-14)
(fabs (/ 4.0 y))
(if (or (<= x 1.65e+87) (and (not (<= x 2.9e+111)) (<= x 1.75e+183)))
t_1
t_0))))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double t_1 = fabs((x * (z / y)));
double tmp;
if (x <= -1.7e+104) {
tmp = t_0;
} else if (x <= -3.1e-16) {
tmp = t_1;
} else if (x <= 1.5e-14) {
tmp = fabs((4.0 / y));
} else if ((x <= 1.65e+87) || (!(x <= 2.9e+111) && (x <= 1.75e+183))) {
tmp = t_1;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y))
t_1 = abs((x * (z / y)))
if (x <= (-1.7d+104)) then
tmp = t_0
else if (x <= (-3.1d-16)) then
tmp = t_1
else if (x <= 1.5d-14) then
tmp = abs((4.0d0 / y))
else if ((x <= 1.65d+87) .or. (.not. (x <= 2.9d+111)) .and. (x <= 1.75d+183)) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double t_1 = Math.abs((x * (z / y)));
double tmp;
if (x <= -1.7e+104) {
tmp = t_0;
} else if (x <= -3.1e-16) {
tmp = t_1;
} else if (x <= 1.5e-14) {
tmp = Math.abs((4.0 / y));
} else if ((x <= 1.65e+87) || (!(x <= 2.9e+111) && (x <= 1.75e+183))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((x * (z / y))) tmp = 0 if x <= -1.7e+104: tmp = t_0 elif x <= -3.1e-16: tmp = t_1 elif x <= 1.5e-14: tmp = math.fabs((4.0 / y)) elif (x <= 1.65e+87) or (not (x <= 2.9e+111) and (x <= 1.75e+183)): tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -1.7e+104) tmp = t_0; elseif (x <= -3.1e-16) tmp = t_1; elseif (x <= 1.5e-14) tmp = abs(Float64(4.0 / y)); elseif ((x <= 1.65e+87) || (!(x <= 2.9e+111) && (x <= 1.75e+183))) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); t_1 = abs((x * (z / y))); tmp = 0.0; if (x <= -1.7e+104) tmp = t_0; elseif (x <= -3.1e-16) tmp = t_1; elseif (x <= 1.5e-14) tmp = abs((4.0 / y)); elseif ((x <= 1.65e+87) || (~((x <= 2.9e+111)) && (x <= 1.75e+183))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.7e+104], t$95$0, If[LessEqual[x, -3.1e-16], t$95$1, If[LessEqual[x, 1.5e-14], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.65e+87], And[N[Not[LessEqual[x, 2.9e+111]], $MachinePrecision], LessEqual[x, 1.75e+183]]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-14}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+87} \lor \neg \left(x \leq 2.9 \cdot 10^{+111}\right) \land x \leq 1.75 \cdot 10^{+183}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.6999999999999998e104 or 1.6500000000000001e87 < x < 2.9e111 or 1.74999999999999994e183 < x Initial program 88.7%
Simplified89.4%
Taylor expanded in x around inf 89.7%
Taylor expanded in z around 0 73.5%
associate-*r/73.5%
neg-mul-173.5%
Simplified73.5%
if -1.6999999999999998e104 < x < -3.1000000000000001e-16 or 1.4999999999999999e-14 < x < 1.6500000000000001e87 or 2.9e111 < x < 1.74999999999999994e183Initial program 94.8%
Simplified96.5%
Taylor expanded in z around inf 60.8%
associate-*l/64.1%
*-commutative64.1%
Simplified64.1%
if -3.1000000000000001e-16 < x < 1.4999999999999999e-14Initial program 95.5%
Taylor expanded in x around 0 80.5%
Final simplification74.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y)))))
(if (<= x -3.35e+177)
t_0
(if (<= x -1.26e+99)
(fabs (/ x y))
(if (or (<= x -1.75e-16) (not (<= x 3.8e-14))) t_0 (fabs (/ 4.0 y)))))))
double code(double x, double y, double z) {
double t_0 = fabs((z * (x / y)));
double tmp;
if (x <= -3.35e+177) {
tmp = t_0;
} else if (x <= -1.26e+99) {
tmp = fabs((x / y));
} else if ((x <= -1.75e-16) || !(x <= 3.8e-14)) {
tmp = t_0;
} else {
tmp = fabs((4.0 / 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) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y)))
if (x <= (-3.35d+177)) then
tmp = t_0
else if (x <= (-1.26d+99)) then
tmp = abs((x / y))
else if ((x <= (-1.75d-16)) .or. (.not. (x <= 3.8d-14))) then
tmp = t_0
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z * (x / y)));
double tmp;
if (x <= -3.35e+177) {
tmp = t_0;
} else if (x <= -1.26e+99) {
tmp = Math.abs((x / y));
} else if ((x <= -1.75e-16) || !(x <= 3.8e-14)) {
tmp = t_0;
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((z * (x / y))) tmp = 0 if x <= -3.35e+177: tmp = t_0 elif x <= -1.26e+99: tmp = math.fabs((x / y)) elif (x <= -1.75e-16) or not (x <= 3.8e-14): tmp = t_0 else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) t_0 = abs(Float64(z * Float64(x / y))) tmp = 0.0 if (x <= -3.35e+177) tmp = t_0; elseif (x <= -1.26e+99) tmp = abs(Float64(x / y)); elseif ((x <= -1.75e-16) || !(x <= 3.8e-14)) tmp = t_0; else tmp = abs(Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((z * (x / y))); tmp = 0.0; if (x <= -3.35e+177) tmp = t_0; elseif (x <= -1.26e+99) tmp = abs((x / y)); elseif ((x <= -1.75e-16) || ~((x <= 3.8e-14))) tmp = t_0; else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.35e+177], t$95$0, If[LessEqual[x, -1.26e+99], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -1.75e-16], N[Not[LessEqual[x, 3.8e-14]], $MachinePrecision]], t$95$0, N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;x \leq -3.35 \cdot 10^{+177}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.26 \cdot 10^{+99}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-16} \lor \neg \left(x \leq 3.8 \cdot 10^{-14}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -3.3500000000000002e177 or -1.25999999999999996e99 < x < -1.75000000000000009e-16 or 3.8000000000000002e-14 < x Initial program 90.1%
Simplified92.1%
Taylor expanded in z around inf 48.6%
add-sqr-sqrt27.2%
sqrt-unprod47.9%
sqr-neg47.9%
sqrt-unprod21.3%
add-sqr-sqrt48.6%
associate-*r/69.0%
*-commutative69.0%
add-sqr-sqrt31.1%
sqrt-unprod56.3%
sqr-neg56.3%
sqrt-unprod37.7%
add-sqr-sqrt69.0%
Applied egg-rr69.0%
if -3.3500000000000002e177 < x < -1.25999999999999996e99Initial program 99.9%
Simplified94.3%
Taylor expanded in x around inf 94.7%
Taylor expanded in z around 0 79.0%
associate-*r/79.0%
neg-mul-179.0%
Simplified79.0%
if -1.75000000000000009e-16 < x < 3.8000000000000002e-14Initial program 95.5%
Taylor expanded in x around 0 80.5%
Final simplification74.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e+138) (not (<= x 3.8e+135))) (fabs (/ (+ z -1.0) (/ y x))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+138) || !(x <= 3.8e+135)) {
tmp = fabs(((z + -1.0) / (y / x)));
} else {
tmp = fabs((((x + 4.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 ((x <= (-1.9d+138)) .or. (.not. (x <= 3.8d+135))) then
tmp = abs(((z + (-1.0d0)) / (y / x)))
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e+138) || !(x <= 3.8e+135)) {
tmp = Math.abs(((z + -1.0) / (y / x)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e+138) or not (x <= 3.8e+135): tmp = math.fabs(((z + -1.0) / (y / x))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e+138) || !(x <= 3.8e+135)) tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.9e+138) || ~((x <= 3.8e+135))) tmp = abs(((z + -1.0) / (y / x))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e+138], N[Not[LessEqual[x, 3.8e+135]], $MachinePrecision]], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+138} \lor \neg \left(x \leq 3.8 \cdot 10^{+135}\right):\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if x < -1.90000000000000006e138 or 3.8000000000000001e135 < x Initial program 87.8%
Simplified86.1%
Taylor expanded in x around inf 86.2%
associate-/l*99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if -1.90000000000000006e138 < x < 3.8000000000000001e135Initial program 95.4%
associate-*l/99.3%
sub-div99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.7e-19) (not (<= x 80000.0))) (fabs (/ (+ z -1.0) (/ y x))) (fabs (/ (- -4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-19) || !(x <= 80000.0)) {
tmp = fabs(((z + -1.0) / (y / x)));
} else {
tmp = fabs(((-4.0 - x) / 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 ((x <= (-2.7d-19)) .or. (.not. (x <= 80000.0d0))) then
tmp = abs(((z + (-1.0d0)) / (y / x)))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e-19) || !(x <= 80000.0)) {
tmp = Math.abs(((z + -1.0) / (y / x)));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.7e-19) or not (x <= 80000.0): tmp = math.fabs(((z + -1.0) / (y / x))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.7e-19) || !(x <= 80000.0)) tmp = abs(Float64(Float64(z + -1.0) / Float64(y / x))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.7e-19) || ~((x <= 80000.0))) tmp = abs(((z + -1.0) / (y / x))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e-19], N[Not[LessEqual[x, 80000.0]], $MachinePrecision]], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-19} \lor \neg \left(x \leq 80000\right):\\
\;\;\;\;\left|\frac{z + -1}{\frac{y}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -2.7000000000000001e-19 or 8e4 < x Initial program 91.1%
Simplified92.2%
Taylor expanded in x around inf 92.0%
associate-/l*99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
if -2.7000000000000001e-19 < x < 8e4Initial program 95.6%
Simplified99.8%
Taylor expanded in z around 0 80.3%
associate-*r/80.3%
distribute-lft-in80.3%
metadata-eval80.3%
neg-mul-180.3%
sub-neg80.3%
Simplified80.3%
Final simplification90.5%
(FPCore (x y z) :precision binary64 (if (<= z -1e+38) (fabs (/ z (/ y x))) (if (<= z 1.1e+26) (fabs (/ (- -4.0 x) y)) (fabs (* x (/ z y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1e+38) {
tmp = fabs((z / (y / x)));
} else if (z <= 1.1e+26) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((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 <= (-1d+38)) then
tmp = abs((z / (y / x)))
else if (z <= 1.1d+26) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x * (z / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1e+38) {
tmp = Math.abs((z / (y / x)));
} else if (z <= 1.1e+26) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x * (z / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1e+38: tmp = math.fabs((z / (y / x))) elif z <= 1.1e+26: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x * (z / y))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1e+38) tmp = abs(Float64(z / Float64(y / x))); elseif (z <= 1.1e+26) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1e+38) tmp = abs((z / (y / x))); elseif (z <= 1.1e+26) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x * (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1e+38], N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.1e+26], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+38}:\\
\;\;\;\;\left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+26}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if z < -9.99999999999999977e37Initial program 96.0%
Taylor expanded in z around inf 74.7%
associate-*r/74.7%
mul-1-neg74.7%
distribute-rgt-neg-out74.7%
associate-*r/78.1%
distribute-frac-neg78.1%
mul-1-neg78.1%
metadata-eval78.1%
times-frac78.1%
*-lft-identity78.1%
neg-mul-178.1%
Simplified78.1%
associate-*r/74.7%
add-sqr-sqrt47.4%
sqrt-unprod64.4%
sqr-neg64.4%
sqrt-unprod27.1%
add-sqr-sqrt74.7%
associate-/l*78.3%
Applied egg-rr78.3%
if -9.99999999999999977e37 < z < 1.10000000000000004e26Initial program 96.1%
Simplified99.8%
Taylor expanded in z around 0 96.4%
associate-*r/96.4%
distribute-lft-in96.4%
metadata-eval96.4%
neg-mul-196.4%
sub-neg96.4%
Simplified96.4%
if 1.10000000000000004e26 < z Initial program 81.8%
Simplified87.0%
Taylor expanded in z around inf 72.1%
associate-*l/83.1%
*-commutative83.1%
Simplified83.1%
Final simplification90.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.52) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / 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 ((x <= (-1.52d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.52) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.52) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.52) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.52) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.52], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -1.52 or 4 < x Initial program 91.0%
Simplified92.1%
Taylor expanded in x around inf 90.9%
Taylor expanded in z around 0 60.4%
associate-*r/60.4%
neg-mul-160.4%
Simplified60.4%
if -1.52 < x < 4Initial program 95.7%
Taylor expanded in x around 0 77.0%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
def code(x, y, z): return math.fabs((4.0 / y))
function code(x, y, z) return abs(Float64(4.0 / y)) end
function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 93.2%
Taylor expanded in x around 0 39.1%
Final simplification39.1%
herbie shell --seed 2023194
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))