
(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 2e-37) (fabs (/ (- (+ 4.0 x) (* 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-37) {
tmp = fabs((((4.0 + x) - (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-37) tmp = abs(Float64(Float64(Float64(4.0 + x) - 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-37], N[Abs[N[(N[(N[(4.0 + x), $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^{-37}:\\
\;\;\;\;\left|\frac{\left(4 + x\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 < 2.00000000000000013e-37Initial program 86.2%
Taylor expanded in y around 0 97.4%
if 2.00000000000000013e-37 < y Initial program 99.8%
Simplified99.9%
Final simplification98.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))))
(if (<= x -8e-16)
t_0
(if (<= x 3.4e-120)
(fabs (/ 4.0 y_m))
(if (or (<= x 9e+110) (and (not (<= x 3.2e+229)) (<= x 1.1e+284)))
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 <= -8e-16) {
tmp = t_0;
} else if (x <= 3.4e-120) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 9e+110) || (!(x <= 3.2e+229) && (x <= 1.1e+284))) {
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 <= (-8d-16)) then
tmp = t_0
else if (x <= 3.4d-120) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 9d+110) .or. (.not. (x <= 3.2d+229)) .and. (x <= 1.1d+284)) 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 <= -8e-16) {
tmp = t_0;
} else if (x <= 3.4e-120) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 9e+110) || (!(x <= 3.2e+229) && (x <= 1.1e+284))) {
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 <= -8e-16: tmp = t_0 elif x <= 3.4e-120: tmp = math.fabs((4.0 / y_m)) elif (x <= 9e+110) or (not (x <= 3.2e+229) and (x <= 1.1e+284)): 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 <= -8e-16) tmp = t_0; elseif (x <= 3.4e-120) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 9e+110) || (!(x <= 3.2e+229) && (x <= 1.1e+284))) 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 <= -8e-16) tmp = t_0; elseif (x <= 3.4e-120) tmp = abs((4.0 / y_m)); elseif ((x <= 9e+110) || (~((x <= 3.2e+229)) && (x <= 1.1e+284))) 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, -8e-16], t$95$0, If[LessEqual[x, 3.4e-120], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 9e+110], And[N[Not[LessEqual[x, 3.2e+229]], $MachinePrecision], LessEqual[x, 1.1e+284]]], 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 -8 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-120}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+110} \lor \neg \left(x \leq 3.2 \cdot 10^{+229}\right) \land x \leq 1.1 \cdot 10^{+284}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\end{array}
\end{array}
if x < -7.9999999999999998e-16 or 3.4000000000000001e-120 < x < 9.0000000000000005e110 or 3.1999999999999998e229 < x < 1.09999999999999997e284Initial program 86.8%
Taylor expanded in z around inf 52.9%
mul-1-neg52.9%
associate-*l/64.4%
distribute-rgt-neg-out64.4%
Simplified64.4%
expm1-log1p-u33.0%
expm1-udef27.8%
*-commutative27.8%
add-sqr-sqrt14.5%
sqrt-unprod26.9%
sqr-neg26.9%
sqrt-unprod16.8%
add-sqr-sqrt31.2%
*-commutative31.2%
associate-*l/26.5%
associate-/l*28.6%
Applied egg-rr28.6%
expm1-def34.7%
expm1-log1p60.1%
associate-/r/64.4%
Simplified64.4%
if -7.9999999999999998e-16 < x < 3.4000000000000001e-120Initial program 97.6%
Taylor expanded in x around 0 85.5%
if 9.0000000000000005e110 < x < 3.1999999999999998e229 or 1.09999999999999997e284 < x Initial program 78.0%
Taylor expanded in z around 0 83.7%
associate-*r/83.7%
metadata-eval83.7%
Simplified83.7%
Taylor expanded in x around inf 83.7%
Final simplification75.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))))
(if (<= x -9.8e-14)
t_0
(if (<= x 3.4e-120)
(fabs (/ 4.0 y_m))
(if (<= x 1.5e+104)
(fabs (/ x (/ y_m z)))
(if (or (<= x 5.2e+227) (not (<= x 1.16e+284)))
(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 <= -9.8e-14) {
tmp = t_0;
} else if (x <= 3.4e-120) {
tmp = fabs((4.0 / y_m));
} else if (x <= 1.5e+104) {
tmp = fabs((x / (y_m / z)));
} else if ((x <= 5.2e+227) || !(x <= 1.16e+284)) {
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 <= (-9.8d-14)) then
tmp = t_0
else if (x <= 3.4d-120) then
tmp = abs((4.0d0 / y_m))
else if (x <= 1.5d+104) then
tmp = abs((x / (y_m / z)))
else if ((x <= 5.2d+227) .or. (.not. (x <= 1.16d+284))) 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 <= -9.8e-14) {
tmp = t_0;
} else if (x <= 3.4e-120) {
tmp = Math.abs((4.0 / y_m));
} else if (x <= 1.5e+104) {
tmp = Math.abs((x / (y_m / z)));
} else if ((x <= 5.2e+227) || !(x <= 1.16e+284)) {
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 <= -9.8e-14: tmp = t_0 elif x <= 3.4e-120: tmp = math.fabs((4.0 / y_m)) elif x <= 1.5e+104: tmp = math.fabs((x / (y_m / z))) elif (x <= 5.2e+227) or not (x <= 1.16e+284): 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 <= -9.8e-14) tmp = t_0; elseif (x <= 3.4e-120) tmp = abs(Float64(4.0 / y_m)); elseif (x <= 1.5e+104) tmp = abs(Float64(x / Float64(y_m / z))); elseif ((x <= 5.2e+227) || !(x <= 1.16e+284)) 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 <= -9.8e-14) tmp = t_0; elseif (x <= 3.4e-120) tmp = abs((4.0 / y_m)); elseif (x <= 1.5e+104) tmp = abs((x / (y_m / z))); elseif ((x <= 5.2e+227) || ~((x <= 1.16e+284))) 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, -9.8e-14], t$95$0, If[LessEqual[x, 3.4e-120], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.5e+104], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 5.2e+227], N[Not[LessEqual[x, 1.16e+284]], $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 -9.8 \cdot 10^{-14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-120}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+104}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+227} \lor \neg \left(x \leq 1.16 \cdot 10^{+284}\right):\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -9.79999999999999989e-14 or 5.19999999999999964e227 < x < 1.1599999999999999e284Initial program 83.0%
Taylor expanded in z around inf 52.1%
mul-1-neg52.1%
associate-*l/69.3%
distribute-rgt-neg-out69.3%
Simplified69.3%
expm1-log1p-u31.9%
expm1-udef29.0%
*-commutative29.0%
add-sqr-sqrt15.6%
sqrt-unprod29.3%
sqr-neg29.3%
sqrt-unprod18.3%
add-sqr-sqrt36.7%
*-commutative36.7%
associate-*l/29.8%
associate-/l*33.0%
Applied egg-rr33.0%
expm1-def35.8%
expm1-log1p61.8%
associate-/r/69.3%
Simplified69.3%
if -9.79999999999999989e-14 < x < 3.4000000000000001e-120Initial program 97.6%
Taylor expanded in x around 0 85.5%
if 3.4000000000000001e-120 < x < 1.49999999999999984e104Initial program 94.5%
Taylor expanded in z around inf 54.6%
mul-1-neg54.6%
associate-*l/54.5%
distribute-rgt-neg-out54.5%
Simplified54.5%
add-sqr-sqrt26.9%
sqrt-unprod39.3%
sqr-neg39.3%
sqrt-unprod27.6%
add-sqr-sqrt54.5%
associate-*l/54.6%
associate-/l*56.6%
Applied egg-rr56.6%
if 1.49999999999999984e104 < x < 5.19999999999999964e227 or 1.1599999999999999e284 < x Initial program 78.0%
Taylor expanded in z around 0 83.7%
associate-*r/83.7%
metadata-eval83.7%
Simplified83.7%
Taylor expanded in x around inf 83.7%
Final simplification76.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -4.6e+26) (not (<= x 9.5e+51))) (fabs (* x (+ (/ z y_m) (/ -1.0 y_m)))) (fabs (/ (- (+ 4.0 x) (* x z)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -4.6e+26) || !(x <= 9.5e+51)) {
tmp = fabs((x * ((z / y_m) + (-1.0 / y_m))));
} else {
tmp = fabs((((4.0 + x) - (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 <= (-4.6d+26)) .or. (.not. (x <= 9.5d+51))) then
tmp = abs((x * ((z / y_m) + ((-1.0d0) / y_m))))
else
tmp = abs((((4.0d0 + x) - (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 <= -4.6e+26) || !(x <= 9.5e+51)) {
tmp = Math.abs((x * ((z / y_m) + (-1.0 / y_m))));
} else {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -4.6e+26) or not (x <= 9.5e+51): tmp = math.fabs((x * ((z / y_m) + (-1.0 / y_m)))) else: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -4.6e+26) || !(x <= 9.5e+51)) tmp = abs(Float64(x * Float64(Float64(z / y_m) + Float64(-1.0 / y_m)))); else tmp = abs(Float64(Float64(Float64(4.0 + x) - 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 <= -4.6e+26) || ~((x <= 9.5e+51))) tmp = abs((x * ((z / y_m) + (-1.0 / y_m)))); else tmp = abs((((4.0 + x) - (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, -4.6e+26], N[Not[LessEqual[x, 9.5e+51]], $MachinePrecision]], N[Abs[N[(x * N[(N[(z / y$95$m), $MachinePrecision] + N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - 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 -4.6 \cdot 10^{+26} \lor \neg \left(x \leq 9.5 \cdot 10^{+51}\right):\\
\;\;\;\;\left|x \cdot \left(\frac{z}{y_m} + \frac{-1}{y_m}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\end{array}
\end{array}
if x < -4.6000000000000001e26 or 9.4999999999999999e51 < x Initial program 79.7%
Simplified93.8%
Taylor expanded in x around inf 99.8%
if -4.6000000000000001e26 < x < 9.4999999999999999e51Initial program 97.5%
Taylor expanded in y around 0 99.9%
Final simplification99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 1.5e-43) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (- (* z (/ x 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 <= 1.5e-43) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs(((z * (x / y_m)) - ((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 <= 1.5d-43) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs(((z * (x / y_m)) - ((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 <= 1.5e-43) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs(((z * (x / y_m)) - ((4.0 + x) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 1.5e-43: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs(((z * (x / 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 <= 1.5e-43) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(z * Float64(x / y_m)) - 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 <= 1.5e-43) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs(((z * (x / y_m)) - ((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, 1.5e-43], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z * N[(x / y$95$m), $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 1.5 \cdot 10^{-43}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m} - \frac{4 + x}{y_m}\right|\\
\end{array}
\end{array}
if y < 1.50000000000000002e-43Initial program 86.1%
Taylor expanded in y around 0 97.4%
if 1.50000000000000002e-43 < y Initial program 99.8%
Final simplification98.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 6.8e-37) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (- (/ (+ 4.0 x) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 6.8e-37) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs((((4.0 + x) / y_m) - (x / (y_m / z))));
}
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 <= 6.8d-37) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs((((4.0d0 + x) / y_m) - (x / (y_m / z))))
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 <= 6.8e-37) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs((((4.0 + x) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 6.8e-37: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs((((4.0 + x) / y_m) - (x / (y_m / z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 6.8e-37) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(Float64(4.0 + x) / y_m) - Float64(x / Float64(y_m / z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (y_m <= 6.8e-37) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs((((4.0 + x) / y_m) - (x / (y_m / z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 6.8e-37], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 6.8 \cdot 10^{-37}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 + x}{y_m} - \frac{x}{\frac{y_m}{z}}\right|\\
\end{array}
\end{array}
if y < 6.80000000000000037e-37Initial program 86.2%
Taylor expanded in y around 0 97.4%
if 6.80000000000000037e-37 < y Initial program 99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification98.0%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -5.8e+59)
(fabs (* z (/ x y_m)))
(if (<= z 3.4e+127)
(fabs (+ (/ x y_m) (/ 4.0 y_m)))
(fabs (/ x (/ y_m z))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -5.8e+59) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 3.4e+127) {
tmp = fabs(((x / y_m) + (4.0 / y_m)));
} else {
tmp = fabs((x / (y_m / z)));
}
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 <= (-5.8d+59)) then
tmp = abs((z * (x / y_m)))
else if (z <= 3.4d+127) then
tmp = abs(((x / y_m) + (4.0d0 / y_m)))
else
tmp = abs((x / (y_m / z)))
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 <= -5.8e+59) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 3.4e+127) {
tmp = Math.abs(((x / y_m) + (4.0 / y_m)));
} else {
tmp = Math.abs((x / (y_m / z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -5.8e+59: tmp = math.fabs((z * (x / y_m))) elif z <= 3.4e+127: tmp = math.fabs(((x / y_m) + (4.0 / y_m))) else: tmp = math.fabs((x / (y_m / z))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -5.8e+59) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 3.4e+127) tmp = abs(Float64(Float64(x / y_m) + Float64(4.0 / y_m))); else tmp = abs(Float64(x / Float64(y_m / z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -5.8e+59) tmp = abs((z * (x / y_m))); elseif (z <= 3.4e+127) tmp = abs(((x / y_m) + (4.0 / y_m))); else tmp = abs((x / (y_m / z))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -5.8e+59], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.4e+127], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] + N[(4.0 / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+59}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+127}:\\
\;\;\;\;\left|\frac{x}{y_m} + \frac{4}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\
\end{array}
\end{array}
if z < -5.79999999999999981e59Initial program 97.3%
Taylor expanded in z around inf 67.4%
mul-1-neg67.4%
associate-*l/73.9%
distribute-rgt-neg-out73.9%
Simplified73.9%
expm1-log1p-u41.1%
expm1-udef34.5%
*-commutative34.5%
add-sqr-sqrt34.5%
sqrt-unprod27.1%
sqr-neg27.1%
sqrt-unprod0.0%
add-sqr-sqrt32.2%
*-commutative32.2%
associate-*l/30.7%
associate-/l*29.1%
Applied egg-rr29.1%
expm1-def37.6%
expm1-log1p72.1%
associate-/r/73.9%
Simplified73.9%
if -5.79999999999999981e59 < z < 3.39999999999999977e127Initial program 89.0%
Taylor expanded in z around 0 94.5%
associate-*r/94.5%
metadata-eval94.5%
Simplified94.5%
if 3.39999999999999977e127 < z Initial program 80.6%
Taylor expanded in z around inf 76.0%
mul-1-neg76.0%
associate-*l/86.2%
distribute-rgt-neg-out86.2%
Simplified86.2%
add-sqr-sqrt0.0%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod86.2%
add-sqr-sqrt86.2%
associate-*l/76.0%
associate-/l*87.6%
Applied egg-rr87.6%
Final simplification89.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -7.6e+59) (fabs (* z (/ x y_m))) (if (<= z 3.6e+127) (fabs (/ (- -4.0 x) y_m)) (fabs (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -7.6e+59) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 3.6e+127) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x / (y_m / z)));
}
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 <= (-7.6d+59)) then
tmp = abs((z * (x / y_m)))
else if (z <= 3.6d+127) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x / (y_m / z)))
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 <= -7.6e+59) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 3.6e+127) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x / (y_m / z)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -7.6e+59: tmp = math.fabs((z * (x / y_m))) elif z <= 3.6e+127: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x / (y_m / z))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -7.6e+59) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 3.6e+127) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x / Float64(y_m / z))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -7.6e+59) tmp = abs((z * (x / y_m))); elseif (z <= 3.6e+127) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x / (y_m / z))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -7.6e+59], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 3.6e+127], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+59}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+127}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\
\end{array}
\end{array}
if z < -7.6000000000000002e59Initial program 97.3%
Taylor expanded in z around inf 67.4%
mul-1-neg67.4%
associate-*l/73.9%
distribute-rgt-neg-out73.9%
Simplified73.9%
expm1-log1p-u41.1%
expm1-udef34.5%
*-commutative34.5%
add-sqr-sqrt34.5%
sqrt-unprod27.1%
sqr-neg27.1%
sqrt-unprod0.0%
add-sqr-sqrt32.2%
*-commutative32.2%
associate-*l/30.7%
associate-/l*29.1%
Applied egg-rr29.1%
expm1-def37.6%
expm1-log1p72.1%
associate-/r/73.9%
Simplified73.9%
if -7.6000000000000002e59 < z < 3.59999999999999979e127Initial program 89.0%
Simplified97.1%
Taylor expanded in z around 0 94.5%
associate-*r/94.5%
distribute-lft-in94.5%
metadata-eval94.5%
neg-mul-194.5%
sub-neg94.5%
Simplified94.5%
if 3.59999999999999979e127 < z Initial program 80.6%
Taylor expanded in z around inf 76.0%
mul-1-neg76.0%
associate-*l/86.2%
distribute-rgt-neg-out86.2%
Simplified86.2%
add-sqr-sqrt0.0%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod86.2%
add-sqr-sqrt86.2%
associate-*l/76.0%
associate-/l*87.6%
Applied egg-rr87.6%
Final simplification89.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -11.0) (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 <= -11.0) || !(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 <= (-11.0d0)) .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 <= -11.0) || !(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 <= -11.0) 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 <= -11.0) || !(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 <= -11.0) || ~((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, -11.0], 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 -11 \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 < -11 or 4 < x Initial program 81.8%
Taylor expanded in z around 0 70.3%
associate-*r/70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in x around inf 68.5%
if -11 < x < 4Initial program 97.3%
Taylor expanded in x around 0 73.3%
Final simplification70.9%
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 89.6%
Taylor expanded in x around 0 39.6%
Final simplification39.6%
herbie shell --seed 2023333
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))