
(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 9 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}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e+31) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (fma x (/ z y_m) (/ (- -4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e+31) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs(fma(x, (z / y_m), ((-4.0 - x) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e+31) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(fma(x, Float64(z / y_m), Float64(Float64(-4.0 - x) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 2e+31], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{+31}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y\_m}, \frac{-4 - x}{y\_m}\right)\right|\\
\end{array}
\end{array}
if y < 1.9999999999999999e31Initial program 89.5%
associate-*l/93.6%
sub-div98.0%
Applied egg-rr98.0%
if 1.9999999999999999e31 < y Initial program 96.9%
fabs-sub96.9%
associate-*l/91.1%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))) (if (<= t_0 -2e+61) (fabs t_0) (fabs (/ (- (+ x 4.0) (* x z)) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= -2e+61) {
tmp = fabs(t_0);
} else {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + 4.0d0) / y_m) - (z * (x / y_m))
if (t_0 <= (-2d+61)) then
tmp = abs(t_0)
else
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= -2e+61) {
tmp = Math.abs(t_0);
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)) tmp = 0 if t_0 <= -2e+61: tmp = math.fabs(t_0) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m))) tmp = 0.0 if (t_0 <= -2e+61) tmp = abs(t_0); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = ((x + 4.0) / y_m) - (z * (x / y_m)); tmp = 0.0; if (t_0 <= -2e+61) tmp = abs(t_0); else tmp = abs((((x + 4.0) - (x * z)) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+61], N[Abs[t$95$0], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+61}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -1.9999999999999999e61Initial program 99.9%
if -1.9999999999999999e61 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 87.8%
associate-*l/94.1%
sub-div98.9%
Applied egg-rr98.9%
Final simplification99.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))))
(if (<= x -3.7e-29)
t_0
(if (<= x 1.3e-110)
(fabs (/ 4.0 y_m))
(if (<= x 9.4e+52) t_0 (fabs (/ x y_m)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double tmp;
if (x <= -3.7e-29) {
tmp = t_0;
} else if (x <= 1.3e-110) {
tmp = fabs((4.0 / y_m));
} else if (x <= 9.4e+52) {
tmp = t_0;
} else {
tmp = fabs((x / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
if (x <= (-3.7d-29)) then
tmp = t_0
else if (x <= 1.3d-110) then
tmp = abs((4.0d0 / y_m))
else if (x <= 9.4d+52) then
tmp = t_0
else
tmp = abs((x / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -3.7e-29) {
tmp = t_0;
} else if (x <= 1.3e-110) {
tmp = Math.abs((4.0 / y_m));
} else if (x <= 9.4e+52) {
tmp = t_0;
} else {
tmp = Math.abs((x / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -3.7e-29: tmp = t_0 elif x <= 1.3e-110: tmp = math.fabs((4.0 / y_m)) elif x <= 9.4e+52: tmp = t_0 else: tmp = math.fabs((x / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -3.7e-29) tmp = t_0; elseif (x <= 1.3e-110) tmp = abs(Float64(4.0 / y_m)); elseif (x <= 9.4e+52) tmp = t_0; else tmp = abs(Float64(x / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -3.7e-29) tmp = t_0; elseif (x <= 1.3e-110) tmp = abs((4.0 / y_m)); elseif (x <= 9.4e+52) tmp = t_0; else tmp = abs((x / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.7e-29], t$95$0, If[LessEqual[x, 1.3e-110], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 9.4e+52], t$95$0, N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -3.7 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-110}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 9.4 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -3.6999999999999997e-29 or 1.29999999999999995e-110 < x < 9.3999999999999999e52Initial program 89.3%
Simplified95.8%
Taylor expanded in z around inf 60.9%
mul-1-neg60.9%
distribute-frac-neg260.9%
associate-/l*61.1%
Simplified61.1%
clear-num61.1%
un-div-inv61.3%
add-sqr-sqrt34.9%
sqrt-unprod56.3%
sqr-neg56.3%
sqrt-unprod26.2%
add-sqr-sqrt61.3%
Applied egg-rr61.3%
associate-/r/72.8%
*-commutative72.8%
Simplified72.8%
if -3.6999999999999997e-29 < x < 1.29999999999999995e-110Initial program 95.8%
Simplified99.9%
Taylor expanded in x around 0 85.1%
if 9.3999999999999999e52 < x Initial program 84.2%
Simplified90.6%
Taylor expanded in x around inf 90.7%
mul-1-neg90.7%
*-commutative90.7%
associate-/l*99.9%
distribute-lft-neg-in99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 72.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -7.6e-31) (not (<= x 1.32e-110))) (fabs (* (/ x y_m) (- 1.0 z))) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -7.6e-31) || !(x <= 1.32e-110)) {
tmp = fabs(((x / y_m) * (1.0 - z)));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-7.6d-31)) .or. (.not. (x <= 1.32d-110))) then
tmp = abs(((x / y_m) * (1.0d0 - z)))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -7.6e-31) || !(x <= 1.32e-110)) {
tmp = Math.abs(((x / y_m) * (1.0 - z)));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -7.6e-31) or not (x <= 1.32e-110): tmp = math.fabs(((x / y_m) * (1.0 - z))) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -7.6e-31) || !(x <= 1.32e-110)) tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -7.6e-31) || ~((x <= 1.32e-110))) tmp = abs(((x / y_m) * (1.0 - z))); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -7.6e-31], N[Not[LessEqual[x, 1.32e-110]], $MachinePrecision]], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-31} \lor \neg \left(x \leq 1.32 \cdot 10^{-110}\right):\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -7.5999999999999999e-31 or 1.32e-110 < x Initial program 87.5%
Simplified94.0%
Taylor expanded in x around inf 89.5%
mul-1-neg89.5%
*-commutative89.5%
associate-/l*95.3%
distribute-lft-neg-in95.3%
neg-sub095.3%
associate-+l-95.3%
neg-sub095.3%
+-commutative95.3%
unsub-neg95.3%
Simplified95.3%
if -7.5999999999999999e-31 < x < 1.32e-110Initial program 95.8%
Simplified99.9%
Taylor expanded in x around 0 85.1%
Final simplification90.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.55e-25) (not (<= x 1.32e-110))) (fabs (* x (/ (- 1.0 z) y_m))) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1.55e-25) || !(x <= 1.32e-110)) {
tmp = fabs((x * ((1.0 - z) / y_m)));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.55d-25)) .or. (.not. (x <= 1.32d-110))) then
tmp = abs((x * ((1.0d0 - z) / y_m)))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1.55e-25) || !(x <= 1.32e-110)) {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -1.55e-25) or not (x <= 1.32e-110): tmp = math.fabs((x * ((1.0 - z) / y_m))) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -1.55e-25) || !(x <= 1.32e-110)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -1.55e-25) || ~((x <= 1.32e-110))) tmp = abs((x * ((1.0 - z) / y_m))); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -1.55e-25], N[Not[LessEqual[x, 1.32e-110]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-25} \lor \neg \left(x \leq 1.32 \cdot 10^{-110}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -1.54999999999999997e-25 or 1.32e-110 < x Initial program 87.5%
Simplified94.0%
Taylor expanded in x around inf 89.5%
*-commutative89.5%
associate-/l*92.8%
associate-*r*92.8%
*-commutative92.8%
associate-*r/92.8%
mul-1-neg92.8%
neg-sub092.8%
associate-+l-92.8%
neg-sub092.8%
+-commutative92.8%
unsub-neg92.8%
Simplified92.8%
if -1.54999999999999997e-25 < x < 1.32e-110Initial program 95.8%
Simplified99.9%
Taylor expanded in x around 0 85.1%
Final simplification89.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -3.5e+82) (fabs (/ z (/ y_m x))) (if (<= z 8.5e+89) (fabs (/ (- -4.0 x) y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -3.5e+82) {
tmp = fabs((z / (y_m / x)));
} else if (z <= 8.5e+89) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((z * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.5d+82)) then
tmp = abs((z / (y_m / x)))
else if (z <= 8.5d+89) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((z * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -3.5e+82) {
tmp = Math.abs((z / (y_m / x)));
} else if (z <= 8.5e+89) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -3.5e+82: tmp = math.fabs((z / (y_m / x))) elif z <= 8.5e+89: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -3.5e+82) tmp = abs(Float64(z / Float64(y_m / x))); elseif (z <= 8.5e+89) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -3.5e+82) tmp = abs((z / (y_m / x))); elseif (z <= 8.5e+89) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((z * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -3.5e+82], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 8.5e+89], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+82}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+89}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -3.5e82Initial program 93.6%
Simplified92.8%
Taylor expanded in z around inf 70.1%
associate-*r/70.1%
neg-mul-170.1%
distribute-rgt-neg-in70.1%
Simplified70.1%
distribute-rgt-neg-out70.1%
distribute-frac-neg70.1%
distribute-frac-neg270.1%
associate-*r/64.2%
*-commutative64.2%
add-sqr-sqrt40.1%
sqrt-unprod54.4%
sqr-neg54.4%
sqrt-unprod24.0%
add-sqr-sqrt64.2%
Applied egg-rr64.2%
associate-/r/73.4%
Applied egg-rr73.4%
if -3.5e82 < z < 8.50000000000000045e89Initial program 91.4%
Simplified99.9%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt92.6%
fabs-neg92.6%
distribute-neg-frac92.6%
distribute-neg-in92.6%
metadata-eval92.6%
+-commutative92.6%
sub-neg92.6%
rem-square-sqrt45.3%
fabs-sqr45.3%
rem-square-sqrt92.6%
Simplified92.6%
if 8.50000000000000045e89 < z Initial program 88.4%
Simplified89.0%
Taylor expanded in z around inf 74.4%
mul-1-neg74.4%
distribute-frac-neg274.4%
associate-/l*77.1%
Simplified77.1%
clear-num77.1%
un-div-inv78.6%
add-sqr-sqrt42.7%
sqrt-unprod58.3%
sqr-neg58.3%
sqrt-unprod35.8%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
associate-/r/81.2%
*-commutative81.2%
Simplified81.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 1e+18) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 1e+18) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1d+18) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((x * ((1.0d0 - z) / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= 1e+18) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 1e+18: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs((x * ((1.0 - z) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 1e+18) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 1e+18) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((x * ((1.0 - z) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 1e+18], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+18}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\end{array}
\end{array}
if x < 1e18Initial program 92.7%
associate-*l/96.5%
sub-div98.5%
Applied egg-rr98.5%
if 1e18 < x Initial program 85.3%
Simplified89.5%
Taylor expanded in x around inf 89.6%
*-commutative89.6%
associate-/l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
mul-1-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
+-commutative99.9%
unsub-neg99.9%
Simplified99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = fabs((x / y_m));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-10.5d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y_m))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y_m));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -10.5) or not (x <= 4.0): tmp = math.fabs((x / y_m)) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -10.5) || !(x <= 4.0)) tmp = abs(Float64(x / y_m)); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -10.5) || ~((x <= 4.0))) tmp = abs((x / y_m)); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -10.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -10.5 or 4 < x Initial program 84.5%
Simplified92.6%
Taylor expanded in x around inf 92.3%
mul-1-neg92.3%
*-commutative92.3%
associate-/l*99.5%
distribute-lft-neg-in99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 62.6%
if -10.5 < x < 4Initial program 96.6%
Simplified99.9%
Taylor expanded in x around 0 71.8%
Final simplification67.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ 4.0 y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((4.0 / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((4.0d0 / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((4.0 / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((4.0 / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(4.0 / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((4.0 / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4}{y\_m}\right|
\end{array}
Initial program 91.1%
Simplified96.5%
Taylor expanded in x around 0 41.2%
herbie shell --seed 2024086
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))