
(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 10 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 4.2e-47) (fabs (/ (+ 4.0 (* x (- 1.0 z))) y_m)) (fabs (- (/ x (/ y_m z)) (/ (+ 4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 4.2e-47) {
tmp = fabs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = fabs(((x / (y_m / z)) - ((4.0 + 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 (y_m <= 4.2d-47) then
tmp = abs(((4.0d0 + (x * (1.0d0 - z))) / y_m))
else
tmp = abs(((x / (y_m / z)) - ((4.0d0 + 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 (y_m <= 4.2e-47) {
tmp = Math.abs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = Math.abs(((x / (y_m / z)) - ((4.0 + x) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 4.2e-47: tmp = math.fabs(((4.0 + (x * (1.0 - z))) / y_m)) else: tmp = math.fabs(((x / (y_m / z)) - ((4.0 + x) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 4.2e-47) tmp = abs(Float64(Float64(4.0 + Float64(x * Float64(1.0 - z))) / y_m)); else tmp = abs(Float64(Float64(x / Float64(y_m / z)) - Float64(Float64(4.0 + x) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 4.2e-47) tmp = abs(((4.0 + (x * (1.0 - z))) / y_m)); else tmp = abs(((x / (y_m / z)) - ((4.0 + x) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 4.2e-47], N[Abs[N[(N[(4.0 + N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / N[(y$95$m / z), $MachinePrecision]), $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 4.2 \cdot 10^{-47}:\\
\;\;\;\;\left|\frac{4 + x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y\_m}{z}} - \frac{4 + x}{y\_m}\right|\\
\end{array}
\end{array}
if y < 4.2000000000000001e-47Initial program 92.3%
Simplified98.8%
Taylor expanded in y around 0 98.9%
associate-*r/98.9%
associate--r+98.9%
sub-neg98.9%
metadata-eval98.9%
associate-+r-98.9%
fma-undefine98.9%
neg-mul-198.9%
Simplified98.9%
if 4.2000000000000001e-47 < y Initial program 95.1%
associate-*l/93.9%
associate-*r/99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.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 -2.15e-47)
t_0
(if (<= x 4.0)
(fabs (/ 4.0 y_m))
(if (or (<= x 6.2e+128) (not (<= x 9.5e+174))) (fabs (/ x y_m)) t_0)))))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 <= -2.15e-47) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 6.2e+128) || !(x <= 9.5e+174)) {
tmp = fabs((x / y_m));
} else {
tmp = t_0;
}
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 <= (-2.15d-47)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 6.2d+128) .or. (.not. (x <= 9.5d+174))) then
tmp = abs((x / y_m))
else
tmp = t_0
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 <= -2.15e-47) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 6.2e+128) || !(x <= 9.5e+174)) {
tmp = Math.abs((x / y_m));
} else {
tmp = t_0;
}
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 <= -2.15e-47: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y_m)) elif (x <= 6.2e+128) or not (x <= 9.5e+174): tmp = math.fabs((x / y_m)) else: tmp = t_0 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 <= -2.15e-47) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 6.2e+128) || !(x <= 9.5e+174)) tmp = abs(Float64(x / y_m)); else tmp = t_0; 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 <= -2.15e-47) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y_m)); elseif ((x <= 6.2e+128) || ~((x <= 9.5e+174))) tmp = abs((x / y_m)); else tmp = t_0; 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, -2.15e-47], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 6.2e+128], N[Not[LessEqual[x, 9.5e+174]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\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 -2.15 \cdot 10^{-47}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+128} \lor \neg \left(x \leq 9.5 \cdot 10^{+174}\right):\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1499999999999999e-47 or 6.20000000000000008e128 < x < 9.4999999999999992e174Initial program 94.1%
Simplified94.4%
Taylor expanded in z around inf 57.7%
mul-1-neg57.7%
distribute-frac-neg257.7%
associate-/l*63.0%
Simplified63.0%
clear-num63.0%
un-div-inv63.1%
add-sqr-sqrt33.6%
sqrt-unprod59.9%
sqr-neg59.9%
sqrt-unprod29.4%
add-sqr-sqrt63.1%
Applied egg-rr63.1%
associate-/r/70.6%
*-commutative70.6%
Simplified70.6%
if -2.1499999999999999e-47 < x < 4Initial program 94.4%
Simplified99.9%
Taylor expanded in x around 0 74.3%
if 4 < x < 6.20000000000000008e128 or 9.4999999999999992e174 < x Initial program 89.4%
Simplified96.5%
Taylor expanded in x around inf 92.5%
mul-1-neg92.5%
*-commutative92.5%
associate-/l*95.8%
distribute-lft-neg-in95.8%
neg-sub095.8%
associate-+l-95.8%
neg-sub095.8%
+-commutative95.8%
unsub-neg95.8%
Simplified95.8%
Taylor expanded in z around 0 73.5%
Final simplification72.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.5) (not (<= x 4.2))) (fabs (* (- 1.0 z) (/ x y_m))) (fabs (/ (- 4.0 (* x z)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.2)) {
tmp = fabs(((1.0 - z) * (x / y_m)));
} else {
tmp = fabs(((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) :: tmp
if ((x <= (-1.5d0)) .or. (.not. (x <= 4.2d0))) then
tmp = abs(((1.0d0 - z) * (x / y_m)))
else
tmp = abs(((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 tmp;
if ((x <= -1.5) || !(x <= 4.2)) {
tmp = Math.abs(((1.0 - z) * (x / y_m)));
} else {
tmp = Math.abs(((4.0 - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -1.5) or not (x <= 4.2): tmp = math.fabs(((1.0 - z) * (x / y_m))) else: tmp = math.fabs(((4.0 - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -1.5) || !(x <= 4.2)) tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y_m))); else tmp = abs(Float64(Float64(4.0 - Float64(x * z)) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -1.5) || ~((x <= 4.2))) tmp = abs(((1.0 - z) * (x / y_m))); else tmp = abs(((4.0 - (x * z)) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -1.5], N[Not[LessEqual[x, 4.2]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4.2\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 - x \cdot z}{y\_m}\right|\\
\end{array}
\end{array}
if x < -1.5 or 4.20000000000000018 < x Initial program 91.9%
Simplified95.0%
Taylor expanded in x around inf 93.0%
mul-1-neg93.0%
*-commutative93.0%
associate-/l*97.8%
distribute-lft-neg-in97.8%
neg-sub097.8%
associate-+l-97.8%
neg-sub097.8%
+-commutative97.8%
unsub-neg97.8%
Simplified97.8%
if -1.5 < x < 4.20000000000000018Initial program 94.7%
Simplified99.9%
Taylor expanded in y around 0 99.9%
associate-*r/99.9%
associate--r+99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+r-99.9%
fma-undefine99.9%
neg-mul-199.9%
Simplified99.9%
Taylor expanded in z around inf 99.0%
associate-*r*99.0%
neg-mul-199.0%
Simplified99.0%
Final simplification98.3%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -350000.0)
(fabs (/ (* x (- 1.0 z)) y_m))
(if (<= z 2.5e+19)
(fabs (/ (- -4.0 x) y_m))
(fabs (/ (+ 1.0 z) (/ y_m x))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -350000.0) {
tmp = fabs(((x * (1.0 - z)) / y_m));
} else if (z <= 2.5e+19) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs(((1.0 + z) / (y_m / x)));
}
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 <= (-350000.0d0)) then
tmp = abs(((x * (1.0d0 - z)) / y_m))
else if (z <= 2.5d+19) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs(((1.0d0 + z) / (y_m / x)))
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 <= -350000.0) {
tmp = Math.abs(((x * (1.0 - z)) / y_m));
} else if (z <= 2.5e+19) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs(((1.0 + z) / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -350000.0: tmp = math.fabs(((x * (1.0 - z)) / y_m)) elif z <= 2.5e+19: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs(((1.0 + z) / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -350000.0) tmp = abs(Float64(Float64(x * Float64(1.0 - z)) / y_m)); elseif (z <= 2.5e+19) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(Float64(1.0 + z) / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -350000.0) tmp = abs(((x * (1.0 - z)) / y_m)); elseif (z <= 2.5e+19) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs(((1.0 + z) / (y_m / x))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -350000.0], N[Abs[N[(N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.5e+19], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 + z), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -350000:\\
\;\;\;\;\left|\frac{x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+19}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1 + z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if z < -3.5e5Initial program 92.5%
Simplified98.4%
Taylor expanded in y around 0 98.4%
associate-*r/98.4%
associate--r+98.4%
sub-neg98.4%
metadata-eval98.4%
associate-+r-98.4%
fma-undefine98.4%
neg-mul-198.4%
Simplified98.4%
Taylor expanded in x around inf 75.4%
if -3.5e5 < z < 2.5e19Initial program 95.5%
Simplified99.8%
Taylor expanded in z around 0 98.3%
+-commutative98.3%
rem-square-sqrt49.2%
fabs-sqr49.2%
rem-square-sqrt98.3%
fabs-neg98.3%
distribute-neg-frac98.3%
distribute-neg-in98.3%
metadata-eval98.3%
+-commutative98.3%
sub-neg98.3%
rem-square-sqrt48.5%
fabs-sqr48.5%
rem-square-sqrt98.3%
Simplified98.3%
if 2.5e19 < z Initial program 88.8%
Simplified90.5%
Taylor expanded in x around inf 73.2%
mul-1-neg73.2%
*-commutative73.2%
associate-/l*80.9%
distribute-lft-neg-in80.9%
neg-sub080.9%
associate-+l-80.9%
neg-sub080.9%
+-commutative80.9%
unsub-neg80.9%
Simplified80.9%
clear-num80.9%
un-div-inv80.9%
sub-neg80.9%
add-sqr-sqrt0.0%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod80.6%
add-sqr-sqrt80.9%
Applied egg-rr80.9%
Final simplification88.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e+24) (fabs (/ (+ 4.0 (* x (- 1.0 z))) y_m)) (fabs (* x (/ (- (+ z -1.0) (/ 4.0 x)) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e+24) {
tmp = fabs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = fabs((x * (((z + -1.0) - (4.0 / 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 (y_m <= 2d+24) then
tmp = abs(((4.0d0 + (x * (1.0d0 - z))) / y_m))
else
tmp = abs((x * (((z + (-1.0d0)) - (4.0d0 / 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 (y_m <= 2e+24) {
tmp = Math.abs(((4.0 + (x * (1.0 - z))) / y_m));
} else {
tmp = Math.abs((x * (((z + -1.0) - (4.0 / x)) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 2e+24: tmp = math.fabs(((4.0 + (x * (1.0 - z))) / y_m)) else: tmp = math.fabs((x * (((z + -1.0) - (4.0 / x)) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e+24) tmp = abs(Float64(Float64(4.0 + Float64(x * Float64(1.0 - z))) / y_m)); else tmp = abs(Float64(x * Float64(Float64(Float64(z + -1.0) - Float64(4.0 / x)) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 2e+24) tmp = abs(((4.0 + (x * (1.0 - z))) / y_m)); else tmp = abs((x * (((z + -1.0) - (4.0 / x)) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 2e+24], N[Abs[N[(N[(4.0 + N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(N[(z + -1.0), $MachinePrecision] - N[(4.0 / x), $MachinePrecision]), $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^{+24}:\\
\;\;\;\;\left|\frac{4 + x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{\left(z + -1\right) - \frac{4}{x}}{y\_m}\right|\\
\end{array}
\end{array}
if y < 2e24Initial program 93.0%
Simplified98.9%
Taylor expanded in y around 0 99.0%
associate-*r/99.0%
associate--r+99.0%
sub-neg99.0%
metadata-eval99.0%
associate-+r-99.0%
fma-undefine99.0%
neg-mul-199.0%
Simplified99.0%
if 2e24 < y Initial program 93.9%
fabs-sub93.9%
associate-*l/92.3%
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%
Taylor expanded in x around inf 99.7%
associate--r+99.7%
div-sub99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
metadata-eval99.7%
remove-double-neg99.7%
neg-mul-199.7%
distribute-lft-in99.7%
neg-mul-199.7%
associate-*r/99.7%
Simplified99.7%
associate-/r*99.7%
sub-div99.7%
Applied egg-rr99.7%
Final simplification99.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -380000.0) (fabs (/ (* x z) y_m)) (if (<= z 2.5e+19) (fabs (/ (- -4.0 x) y_m)) (fabs (/ z (/ y_m x))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -380000.0) {
tmp = fabs(((x * z) / y_m));
} else if (z <= 2.5e+19) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((z / (y_m / x)));
}
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 <= (-380000.0d0)) then
tmp = abs(((x * z) / y_m))
else if (z <= 2.5d+19) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((z / (y_m / x)))
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 <= -380000.0) {
tmp = Math.abs(((x * z) / y_m));
} else if (z <= 2.5e+19) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((z / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -380000.0: tmp = math.fabs(((x * z) / y_m)) elif z <= 2.5e+19: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((z / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -380000.0) tmp = abs(Float64(Float64(x * z) / y_m)); elseif (z <= 2.5e+19) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(z / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -380000.0) tmp = abs(((x * z) / y_m)); elseif (z <= 2.5e+19) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((z / (y_m / x))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -380000.0], N[Abs[N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.5e+19], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -380000:\\
\;\;\;\;\left|\frac{x \cdot z}{y\_m}\right|\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+19}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if z < -3.8e5Initial program 92.5%
Simplified98.4%
Taylor expanded in z around inf 74.6%
mul-1-neg74.6%
distribute-frac-neg274.6%
associate-/l*73.7%
Simplified73.7%
associate-*r/74.6%
add-sqr-sqrt34.6%
sqrt-unprod57.8%
sqr-neg57.8%
sqrt-unprod39.9%
add-sqr-sqrt74.6%
Applied egg-rr74.6%
if -3.8e5 < z < 2.5e19Initial program 95.5%
Simplified99.8%
Taylor expanded in z around 0 98.3%
+-commutative98.3%
rem-square-sqrt49.2%
fabs-sqr49.2%
rem-square-sqrt98.3%
fabs-neg98.3%
distribute-neg-frac98.3%
distribute-neg-in98.3%
metadata-eval98.3%
+-commutative98.3%
sub-neg98.3%
rem-square-sqrt48.5%
fabs-sqr48.5%
rem-square-sqrt98.3%
Simplified98.3%
if 2.5e19 < z Initial program 88.8%
Simplified90.5%
Taylor expanded in z around inf 73.2%
mul-1-neg73.2%
distribute-frac-neg273.2%
associate-/l*76.3%
Simplified76.3%
clear-num76.3%
un-div-inv77.1%
add-sqr-sqrt32.4%
sqrt-unprod54.4%
sqr-neg54.4%
sqrt-unprod44.5%
add-sqr-sqrt77.1%
Applied egg-rr77.1%
associate-/r/80.9%
*-commutative80.9%
Simplified80.9%
clear-num80.9%
un-div-inv80.9%
Applied egg-rr80.9%
Final simplification88.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -320000.0) (fabs (/ (* x (- 1.0 z)) y_m)) (if (<= z 1.15e+20) (fabs (/ (- -4.0 x) y_m)) (fabs (/ z (/ y_m x))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -320000.0) {
tmp = fabs(((x * (1.0 - z)) / y_m));
} else if (z <= 1.15e+20) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((z / (y_m / x)));
}
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 <= (-320000.0d0)) then
tmp = abs(((x * (1.0d0 - z)) / y_m))
else if (z <= 1.15d+20) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((z / (y_m / x)))
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 <= -320000.0) {
tmp = Math.abs(((x * (1.0 - z)) / y_m));
} else if (z <= 1.15e+20) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((z / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -320000.0: tmp = math.fabs(((x * (1.0 - z)) / y_m)) elif z <= 1.15e+20: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((z / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -320000.0) tmp = abs(Float64(Float64(x * Float64(1.0 - z)) / y_m)); elseif (z <= 1.15e+20) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(z / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -320000.0) tmp = abs(((x * (1.0 - z)) / y_m)); elseif (z <= 1.15e+20) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((z / (y_m / x))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -320000.0], N[Abs[N[(N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 1.15e+20], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -320000:\\
\;\;\;\;\left|\frac{x \cdot \left(1 - z\right)}{y\_m}\right|\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+20}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if z < -3.2e5Initial program 92.5%
Simplified98.4%
Taylor expanded in y around 0 98.4%
associate-*r/98.4%
associate--r+98.4%
sub-neg98.4%
metadata-eval98.4%
associate-+r-98.4%
fma-undefine98.4%
neg-mul-198.4%
Simplified98.4%
Taylor expanded in x around inf 75.4%
if -3.2e5 < z < 1.15e20Initial program 95.5%
Simplified99.8%
Taylor expanded in z around 0 98.3%
+-commutative98.3%
rem-square-sqrt49.2%
fabs-sqr49.2%
rem-square-sqrt98.3%
fabs-neg98.3%
distribute-neg-frac98.3%
distribute-neg-in98.3%
metadata-eval98.3%
+-commutative98.3%
sub-neg98.3%
rem-square-sqrt48.5%
fabs-sqr48.5%
rem-square-sqrt98.3%
Simplified98.3%
if 1.15e20 < z Initial program 88.8%
Simplified90.5%
Taylor expanded in z around inf 73.2%
mul-1-neg73.2%
distribute-frac-neg273.2%
associate-/l*76.3%
Simplified76.3%
clear-num76.3%
un-div-inv77.1%
add-sqr-sqrt32.4%
sqrt-unprod54.4%
sqr-neg54.4%
sqrt-unprod44.5%
add-sqr-sqrt77.1%
Applied egg-rr77.1%
associate-/r/80.9%
*-commutative80.9%
Simplified80.9%
clear-num80.9%
un-div-inv80.9%
Applied egg-rr80.9%
Final simplification88.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.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 <= -1.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 <= (-1.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 <= -1.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 <= -1.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 <= -1.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 <= -1.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, -1.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 -1.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 < -1.5 or 4 < x Initial program 91.9%
Simplified95.0%
Taylor expanded in x around inf 93.0%
mul-1-neg93.0%
*-commutative93.0%
associate-/l*97.8%
distribute-lft-neg-in97.8%
neg-sub097.8%
associate-+l-97.8%
neg-sub097.8%
+-commutative97.8%
unsub-neg97.8%
Simplified97.8%
Taylor expanded in z around 0 65.7%
if -1.5 < x < 4Initial program 94.7%
Simplified99.9%
Taylor expanded in x around 0 72.1%
Final simplification68.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (+ 4.0 (* x (- 1.0 z))) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs(((4.0 + (x * (1.0 - z))) / 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 + (x * (1.0d0 - z))) / 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 + (x * (1.0 - z))) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs(((4.0 + (x * (1.0 - z))) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(4.0 + Float64(x * Float64(1.0 - z))) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs(((4.0 + (x * (1.0 - z))) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(4.0 + N[(x * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4 + x \cdot \left(1 - z\right)}{y\_m}\right|
\end{array}
Initial program 93.2%
Simplified97.3%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
associate--r+97.4%
sub-neg97.4%
metadata-eval97.4%
associate-+r-97.4%
fma-undefine97.4%
neg-mul-197.4%
Simplified97.4%
Final simplification97.4%
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 93.2%
Simplified97.3%
Taylor expanded in x around 0 36.4%
Final simplification36.4%
herbie shell --seed 2024075
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))