
(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 14 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 3e-103) (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))) (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 <= 3e-103) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} 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 <= 3e-103) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); 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, 3e-103], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $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 3 \cdot 10^{-103}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\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 < 3e-103Initial program 87.4%
Simplified96.8%
if 3e-103 < y Initial program 97.2%
fabs-sub97.2%
associate-*l/98.6%
associate-*r/99.9%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
}
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|
\end{array}
Initial program 90.1%
Simplified97.2%
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 INFINITY) (fabs t_0) (/ (- x) 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 <= ((double) INFINITY)) {
tmp = fabs(t_0);
} else {
tmp = -x / y_m;
}
return tmp;
}
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 <= Double.POSITIVE_INFINITY) {
tmp = Math.abs(t_0);
} else {
tmp = -x / 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 <= math.inf: tmp = math.fabs(t_0) else: tmp = -x / 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 <= Inf) tmp = abs(t_0); else tmp = Float64(Float64(-x) / 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 <= Inf) tmp = abs(t_0); else tmp = -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[(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, Infinity], N[Abs[t$95$0], $MachinePrecision], N[((-x) / y$95$m), $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 \infty:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{y\_m}\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < +inf.0Initial program 97.3%
if +inf.0 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 0.0%
fabs-sub0.0%
associate-*l/26.3%
associate-*r/26.3%
fma-neg57.9%
distribute-neg-frac57.9%
+-commutative57.9%
distribute-neg-in57.9%
unsub-neg57.9%
metadata-eval57.9%
Simplified57.9%
add-sqr-sqrt36.8%
fabs-sqr36.8%
add-sqr-sqrt36.8%
fma-undefine21.1%
associate-*r/21.1%
associate-*l/0.0%
div-inv0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-neg-in0.0%
+-commutative0.0%
cancel-sign-sub-inv0.0%
div-inv0.0%
associate-*l/21.1%
sub-div52.6%
Applied egg-rr52.6%
Taylor expanded in x around inf 52.6%
Taylor expanded in z around 0 52.6%
neg-mul-152.6%
distribute-neg-frac52.6%
Simplified52.6%
Final simplification94.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.55) (/ (- x) y_m) (if (<= x 4e-13) (/ 4.0 y_m) (if (<= x 5e+30) (* z (/ x y_m)) (/ x y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 4e-13) {
tmp = 4.0 / y_m;
} else if (x <= 5e+30) {
tmp = z * (x / y_m);
} else {
tmp = 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 (x <= (-1.55d0)) then
tmp = -x / y_m
else if (x <= 4d-13) then
tmp = 4.0d0 / y_m
else if (x <= 5d+30) then
tmp = z * (x / y_m)
else
tmp = 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 (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 4e-13) {
tmp = 4.0 / y_m;
} else if (x <= 5e+30) {
tmp = z * (x / y_m);
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.55: tmp = -x / y_m elif x <= 4e-13: tmp = 4.0 / y_m elif x <= 5e+30: tmp = z * (x / y_m) else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.55) tmp = Float64(Float64(-x) / y_m); elseif (x <= 4e-13) tmp = Float64(4.0 / y_m); elseif (x <= 5e+30) tmp = Float64(z * Float64(x / y_m)); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.55) tmp = -x / y_m; elseif (x <= 4e-13) tmp = 4.0 / y_m; elseif (x <= 5e+30) tmp = z * (x / y_m); else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.55], N[((-x) / y$95$m), $MachinePrecision], If[LessEqual[x, 4e-13], N[(4.0 / y$95$m), $MachinePrecision], If[LessEqual[x, 5e+30], N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;\frac{-x}{y\_m}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-13}:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+30}:\\
\;\;\;\;z \cdot \frac{x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.55000000000000004Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in x around inf 56.6%
Taylor expanded in z around 0 38.3%
neg-mul-138.3%
distribute-neg-frac38.3%
Simplified38.3%
if -1.55000000000000004 < x < 4.0000000000000001e-13Initial program 94.8%
fabs-sub94.8%
associate-*l/99.9%
associate-*r/91.5%
fma-neg91.5%
distribute-neg-frac91.5%
+-commutative91.5%
distribute-neg-in91.5%
unsub-neg91.5%
metadata-eval91.5%
Simplified91.5%
fma-undefine91.5%
associate-*r/99.9%
associate-*l/94.8%
div-inv94.8%
sub-neg94.8%
metadata-eval94.8%
distribute-neg-in94.8%
+-commutative94.8%
cancel-sign-sub-inv94.8%
div-inv94.8%
fabs-sub94.8%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt44.6%
associate-*l/46.8%
sub-div46.8%
Applied egg-rr46.8%
Taylor expanded in x around 0 33.7%
if 4.0000000000000001e-13 < x < 4.9999999999999998e30Initial program 99.3%
fabs-sub99.3%
associate-*l/99.7%
associate-*r/99.3%
fma-neg99.5%
distribute-neg-frac99.5%
+-commutative99.5%
distribute-neg-in99.5%
unsub-neg99.5%
metadata-eval99.5%
Simplified99.5%
add-sqr-sqrt44.1%
fabs-sqr44.1%
add-sqr-sqrt45.2%
fma-undefine45.0%
associate-*r/45.3%
associate-*l/45.0%
div-inv45.0%
sub-neg45.0%
metadata-eval45.0%
distribute-neg-in45.0%
+-commutative45.0%
cancel-sign-sub-inv45.0%
div-inv45.0%
associate-*l/45.3%
sub-div45.3%
Applied egg-rr45.3%
Taylor expanded in x around inf 45.3%
Taylor expanded in z around inf 45.4%
*-commutative45.4%
associate-*r/45.1%
Simplified45.1%
if 4.9999999999999998e30 < x Initial program 86.5%
fabs-sub86.5%
associate-*l/79.5%
associate-*r/90.4%
fma-neg96.1%
distribute-neg-frac96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
metadata-eval96.1%
Simplified96.1%
fma-undefine90.4%
associate-*r/79.5%
associate-*l/86.5%
div-inv86.4%
sub-neg86.4%
metadata-eval86.4%
distribute-neg-in86.4%
+-commutative86.4%
cancel-sign-sub-inv86.4%
div-inv86.5%
fabs-sub86.5%
add-sqr-sqrt36.4%
fabs-sqr36.4%
add-sqr-sqrt36.8%
sub-neg36.8%
distribute-rgt-neg-in36.8%
Applied egg-rr36.8%
Taylor expanded in x around -inf 44.5%
mul-1-neg44.5%
div-sub44.5%
associate-/l*40.8%
sub-neg40.8%
metadata-eval40.8%
distribute-rgt-in40.8%
neg-mul-140.8%
sub-neg40.8%
*-lft-identity40.8%
sub-neg40.8%
distribute-rgt-in40.8%
*-rgt-identity40.8%
remove-double-neg40.8%
*-commutative40.8%
mul-1-neg40.8%
associate-*r*40.8%
neg-mul-140.8%
distribute-rgt-neg-in40.8%
mul-1-neg40.8%
distribute-lft-in40.8%
+-commutative40.8%
distribute-lft-neg-in40.8%
Simplified44.5%
Taylor expanded in z around 0 24.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -1.55)
(/ (- x) y_m)
(if (<= x 2.9e-19)
(/ 4.0 y_m)
(if (<= x 1.9e+31) (* x (/ z y_m)) (/ x y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 2.9e-19) {
tmp = 4.0 / y_m;
} else if (x <= 1.9e+31) {
tmp = x * (z / y_m);
} else {
tmp = 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 (x <= (-1.55d0)) then
tmp = -x / y_m
else if (x <= 2.9d-19) then
tmp = 4.0d0 / y_m
else if (x <= 1.9d+31) then
tmp = x * (z / y_m)
else
tmp = 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 (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 2.9e-19) {
tmp = 4.0 / y_m;
} else if (x <= 1.9e+31) {
tmp = x * (z / y_m);
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.55: tmp = -x / y_m elif x <= 2.9e-19: tmp = 4.0 / y_m elif x <= 1.9e+31: tmp = x * (z / y_m) else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.55) tmp = Float64(Float64(-x) / y_m); elseif (x <= 2.9e-19) tmp = Float64(4.0 / y_m); elseif (x <= 1.9e+31) tmp = Float64(x * Float64(z / y_m)); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.55) tmp = -x / y_m; elseif (x <= 2.9e-19) tmp = 4.0 / y_m; elseif (x <= 1.9e+31) tmp = x * (z / y_m); else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.55], N[((-x) / y$95$m), $MachinePrecision], If[LessEqual[x, 2.9e-19], N[(4.0 / y$95$m), $MachinePrecision], If[LessEqual[x, 1.9e+31], N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;\frac{-x}{y\_m}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-19}:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \frac{z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.55000000000000004Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in x around inf 56.6%
Taylor expanded in z around 0 38.3%
neg-mul-138.3%
distribute-neg-frac38.3%
Simplified38.3%
if -1.55000000000000004 < x < 2.9e-19Initial program 94.8%
fabs-sub94.8%
associate-*l/99.9%
associate-*r/91.5%
fma-neg91.5%
distribute-neg-frac91.5%
+-commutative91.5%
distribute-neg-in91.5%
unsub-neg91.5%
metadata-eval91.5%
Simplified91.5%
fma-undefine91.5%
associate-*r/99.9%
associate-*l/94.8%
div-inv94.8%
sub-neg94.8%
metadata-eval94.8%
distribute-neg-in94.8%
+-commutative94.8%
cancel-sign-sub-inv94.8%
div-inv94.8%
fabs-sub94.8%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt44.6%
associate-*l/46.8%
sub-div46.8%
Applied egg-rr46.8%
Taylor expanded in x around 0 33.7%
if 2.9e-19 < x < 1.9000000000000001e31Initial program 99.3%
fabs-sub99.3%
associate-*l/99.7%
associate-*r/99.3%
fma-neg99.5%
distribute-neg-frac99.5%
+-commutative99.5%
distribute-neg-in99.5%
unsub-neg99.5%
metadata-eval99.5%
Simplified99.5%
add-sqr-sqrt44.1%
fabs-sqr44.1%
add-sqr-sqrt45.2%
fma-undefine45.0%
associate-*r/45.3%
associate-*l/45.0%
div-inv45.0%
sub-neg45.0%
metadata-eval45.0%
distribute-neg-in45.0%
+-commutative45.0%
cancel-sign-sub-inv45.0%
div-inv45.0%
associate-*l/45.3%
sub-div45.3%
Applied egg-rr45.3%
Taylor expanded in x around inf 45.3%
Taylor expanded in z around inf 45.4%
associate-*r/45.1%
Simplified45.1%
if 1.9000000000000001e31 < x Initial program 86.5%
fabs-sub86.5%
associate-*l/79.5%
associate-*r/90.4%
fma-neg96.1%
distribute-neg-frac96.1%
+-commutative96.1%
distribute-neg-in96.1%
unsub-neg96.1%
metadata-eval96.1%
Simplified96.1%
fma-undefine90.4%
associate-*r/79.5%
associate-*l/86.5%
div-inv86.4%
sub-neg86.4%
metadata-eval86.4%
distribute-neg-in86.4%
+-commutative86.4%
cancel-sign-sub-inv86.4%
div-inv86.5%
fabs-sub86.5%
add-sqr-sqrt36.4%
fabs-sqr36.4%
add-sqr-sqrt36.8%
sub-neg36.8%
distribute-rgt-neg-in36.8%
Applied egg-rr36.8%
Taylor expanded in x around -inf 44.5%
mul-1-neg44.5%
div-sub44.5%
associate-/l*40.8%
sub-neg40.8%
metadata-eval40.8%
distribute-rgt-in40.8%
neg-mul-140.8%
sub-neg40.8%
*-lft-identity40.8%
sub-neg40.8%
distribute-rgt-in40.8%
*-rgt-identity40.8%
remove-double-neg40.8%
*-commutative40.8%
mul-1-neg40.8%
associate-*r*40.8%
neg-mul-140.8%
distribute-rgt-neg-in40.8%
mul-1-neg40.8%
distribute-lft-in40.8%
+-commutative40.8%
distribute-lft-neg-in40.8%
Simplified44.5%
Taylor expanded in z around 0 24.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.5) (/ (- -4.0 x) y_m) (if (<= x 3.2e-7) (/ (- 4.0 (* x z)) y_m) (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.5) {
tmp = (-4.0 - x) / y_m;
} else if (x <= 3.2e-7) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = 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 <= (-4.5d0)) then
tmp = ((-4.0d0) - x) / y_m
else if (x <= 3.2d-7) then
tmp = (4.0d0 - (x * z)) / y_m
else
tmp = 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 <= -4.5) {
tmp = (-4.0 - x) / y_m;
} else if (x <= 3.2e-7) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = x * ((1.0 - z) / y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.5: tmp = (-4.0 - x) / y_m elif x <= 3.2e-7: tmp = (4.0 - (x * z)) / y_m else: tmp = x * ((1.0 - z) / y_m) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.5) tmp = Float64(Float64(-4.0 - x) / y_m); elseif (x <= 3.2e-7) tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m); else tmp = 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 <= -4.5) tmp = (-4.0 - x) / y_m; elseif (x <= 3.2e-7) tmp = (4.0 - (x * z)) / y_m; else tmp = 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, -4.5], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 3.2e-7], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-7}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -4.5Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in z around 0 38.3%
associate-*r/38.3%
distribute-lft-in38.3%
metadata-eval38.3%
neg-mul-138.3%
sub-neg38.3%
Simplified38.3%
if -4.5 < x < 3.2000000000000001e-7Initial program 94.9%
fabs-sub94.9%
associate-*l/99.9%
associate-*r/91.6%
fma-neg91.6%
distribute-neg-frac91.6%
+-commutative91.6%
distribute-neg-in91.6%
unsub-neg91.6%
metadata-eval91.6%
Simplified91.6%
fma-undefine91.6%
associate-*r/99.9%
associate-*l/94.9%
div-inv94.9%
sub-neg94.9%
metadata-eval94.9%
distribute-neg-in94.9%
+-commutative94.9%
cancel-sign-sub-inv94.9%
div-inv94.9%
fabs-sub94.9%
add-sqr-sqrt44.0%
fabs-sqr44.0%
add-sqr-sqrt45.2%
associate-*l/47.3%
sub-div47.3%
Applied egg-rr47.3%
Taylor expanded in x around 0 47.1%
if 3.2000000000000001e-7 < x Initial program 87.8%
fabs-sub87.8%
associate-*l/81.6%
associate-*r/91.3%
fma-neg96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
fma-undefine91.3%
associate-*r/81.6%
associate-*l/87.8%
div-inv87.7%
sub-neg87.7%
metadata-eval87.7%
distribute-neg-in87.7%
+-commutative87.7%
cancel-sign-sub-inv87.7%
div-inv87.8%
fabs-sub87.8%
add-sqr-sqrt37.8%
fabs-sqr37.8%
add-sqr-sqrt38.2%
sub-neg38.2%
distribute-rgt-neg-in38.2%
Applied egg-rr38.2%
Taylor expanded in x around -inf 45.1%
mul-1-neg45.1%
div-sub45.1%
associate-/l*41.8%
sub-neg41.8%
metadata-eval41.8%
distribute-rgt-in41.8%
neg-mul-141.8%
sub-neg41.8%
*-lft-identity41.8%
sub-neg41.8%
distribute-rgt-in41.8%
*-rgt-identity41.8%
remove-double-neg41.8%
*-commutative41.8%
mul-1-neg41.8%
associate-*r*41.8%
neg-mul-141.8%
distribute-rgt-neg-in41.8%
mul-1-neg41.8%
distribute-lft-in41.8%
+-commutative41.8%
distribute-lft-neg-in41.8%
Simplified45.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (- -4.0 x) y_m) (if (<= x 3.8e-10) (/ (+ x 4.0) y_m) (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else if (x <= 3.8e-10) {
tmp = (x + 4.0) / y_m;
} else {
tmp = 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 <= (-4.0d0)) then
tmp = ((-4.0d0) - x) / y_m
else if (x <= 3.8d-10) then
tmp = (x + 4.0d0) / y_m
else
tmp = 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 <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else if (x <= 3.8e-10) {
tmp = (x + 4.0) / y_m;
} else {
tmp = x * ((1.0 - z) / y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = (-4.0 - x) / y_m elif x <= 3.8e-10: tmp = (x + 4.0) / y_m else: tmp = x * ((1.0 - z) / y_m) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(Float64(-4.0 - x) / y_m); elseif (x <= 3.8e-10) tmp = Float64(Float64(x + 4.0) / y_m); else tmp = 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 <= -4.0) tmp = (-4.0 - x) / y_m; elseif (x <= 3.8e-10) tmp = (x + 4.0) / y_m; else tmp = 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, -4.0], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 3.8e-10], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-10}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in z around 0 38.3%
associate-*r/38.3%
distribute-lft-in38.3%
metadata-eval38.3%
neg-mul-138.3%
sub-neg38.3%
Simplified38.3%
if -4 < x < 3.7999999999999998e-10Initial program 94.9%
fabs-sub94.9%
associate-*l/99.9%
associate-*r/91.6%
fma-neg91.6%
distribute-neg-frac91.6%
+-commutative91.6%
distribute-neg-in91.6%
unsub-neg91.6%
metadata-eval91.6%
Simplified91.6%
fma-undefine91.6%
associate-*r/99.9%
associate-*l/94.9%
div-inv94.9%
sub-neg94.9%
metadata-eval94.9%
distribute-neg-in94.9%
+-commutative94.9%
cancel-sign-sub-inv94.9%
div-inv94.9%
fabs-sub94.9%
add-sqr-sqrt44.3%
fabs-sqr44.3%
add-sqr-sqrt45.5%
associate-*l/47.6%
sub-div47.6%
Applied egg-rr47.6%
Taylor expanded in z around 0 34.0%
if 3.7999999999999998e-10 < x Initial program 88.0%
fabs-sub88.0%
associate-*l/81.9%
associate-*r/91.4%
fma-neg96.5%
distribute-neg-frac96.5%
+-commutative96.5%
distribute-neg-in96.5%
unsub-neg96.5%
metadata-eval96.5%
Simplified96.5%
fma-undefine91.4%
associate-*r/81.9%
associate-*l/88.0%
div-inv87.9%
sub-neg87.9%
metadata-eval87.9%
distribute-neg-in87.9%
+-commutative87.9%
cancel-sign-sub-inv87.9%
div-inv88.0%
fabs-sub88.0%
add-sqr-sqrt37.2%
fabs-sqr37.2%
add-sqr-sqrt37.6%
sub-neg37.6%
distribute-rgt-neg-in37.6%
Applied egg-rr37.6%
Taylor expanded in x around -inf 44.4%
mul-1-neg44.4%
div-sub44.4%
associate-/l*41.1%
sub-neg41.1%
metadata-eval41.1%
distribute-rgt-in41.1%
neg-mul-141.1%
sub-neg41.1%
*-lft-identity41.1%
sub-neg41.1%
distribute-rgt-in41.1%
*-rgt-identity41.1%
remove-double-neg41.1%
*-commutative41.1%
mul-1-neg41.1%
associate-*r*41.1%
neg-mul-141.1%
distribute-rgt-neg-in41.1%
mul-1-neg41.1%
distribute-lft-in41.1%
+-commutative41.1%
distribute-lft-neg-in41.1%
Simplified44.4%
Final simplification37.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -5.4) (/ (- -4.0 x) y_m) (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.4) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = ((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) :: tmp
if (x <= (-5.4d0)) then
tmp = ((-4.0d0) - x) / y_m
else
tmp = ((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 tmp;
if (x <= -5.4) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = ((x + 4.0) - (x * z)) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -5.4: tmp = (-4.0 - x) / y_m else: tmp = ((x + 4.0) - (x * z)) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -5.4) tmp = Float64(Float64(-4.0 - x) / y_m); else tmp = 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) tmp = 0.0; if (x <= -5.4) tmp = (-4.0 - x) / y_m; else tmp = ((x + 4.0) - (x * z)) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -5.4], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\end{array}
\end{array}
if x < -5.4000000000000004Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in z around 0 38.3%
associate-*r/38.3%
distribute-lft-in38.3%
metadata-eval38.3%
neg-mul-138.3%
sub-neg38.3%
Simplified38.3%
if -5.4000000000000004 < x Initial program 92.7%
fabs-sub92.7%
associate-*l/94.1%
associate-*r/91.5%
fma-neg93.2%
distribute-neg-frac93.2%
+-commutative93.2%
distribute-neg-in93.2%
unsub-neg93.2%
metadata-eval93.2%
Simplified93.2%
fma-undefine91.5%
associate-*r/94.1%
associate-*l/92.7%
div-inv92.6%
sub-neg92.6%
metadata-eval92.6%
distribute-neg-in92.6%
+-commutative92.6%
cancel-sign-sub-inv92.6%
div-inv92.7%
fabs-sub92.7%
add-sqr-sqrt42.0%
fabs-sqr42.0%
add-sqr-sqrt42.9%
associate-*l/43.3%
sub-div45.5%
Applied egg-rr45.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.55) (/ (- x) y_m) (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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 (x <= (-1.55d0)) then
tmp = -x / y_m
else if (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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 (x <= -1.55) {
tmp = -x / y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.55: tmp = -x / y_m elif x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.55) tmp = Float64(Float64(-x) / y_m); elseif (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.55) tmp = -x / y_m; elseif (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.55], N[((-x) / y$95$m), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;\frac{-x}{y\_m}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.55000000000000004Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in x around inf 56.6%
Taylor expanded in z around 0 38.3%
neg-mul-138.3%
distribute-neg-frac38.3%
Simplified38.3%
if -1.55000000000000004 < x < 4Initial program 95.0%
fabs-sub95.0%
associate-*l/99.9%
associate-*r/91.8%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
fma-undefine91.8%
associate-*r/99.9%
associate-*l/95.0%
div-inv95.0%
sub-neg95.0%
metadata-eval95.0%
distribute-neg-in95.0%
+-commutative95.0%
cancel-sign-sub-inv95.0%
div-inv95.0%
fabs-sub95.0%
add-sqr-sqrt43.3%
fabs-sqr43.3%
add-sqr-sqrt44.5%
associate-*l/46.5%
sub-div46.5%
Applied egg-rr46.5%
Taylor expanded in x around 0 33.2%
if 4 < x Initial program 87.4%
fabs-sub87.4%
associate-*l/80.9%
associate-*r/91.0%
fma-neg96.4%
distribute-neg-frac96.4%
+-commutative96.4%
distribute-neg-in96.4%
unsub-neg96.4%
metadata-eval96.4%
Simplified96.4%
fma-undefine91.0%
associate-*r/80.9%
associate-*l/87.4%
div-inv87.3%
sub-neg87.3%
metadata-eval87.3%
distribute-neg-in87.3%
+-commutative87.3%
cancel-sign-sub-inv87.3%
div-inv87.4%
fabs-sub87.4%
add-sqr-sqrt39.1%
fabs-sqr39.1%
add-sqr-sqrt39.5%
sub-neg39.5%
distribute-rgt-neg-in39.5%
Applied egg-rr39.5%
Taylor expanded in x around -inf 46.6%
mul-1-neg46.6%
div-sub46.6%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.2%
neg-mul-143.2%
sub-neg43.2%
*-lft-identity43.2%
sub-neg43.2%
distribute-rgt-in43.2%
*-rgt-identity43.2%
remove-double-neg43.2%
*-commutative43.2%
mul-1-neg43.2%
associate-*r*43.2%
neg-mul-143.2%
distribute-rgt-neg-in43.2%
mul-1-neg43.2%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified46.6%
Taylor expanded in z around 0 22.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (- -4.0 x) y_m) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = (x + 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 <= (-4.0d0)) then
tmp = ((-4.0d0) - x) / y_m
else
tmp = (x + 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 <= -4.0) {
tmp = (-4.0 - x) / y_m;
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = (-4.0 - x) / y_m else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(Float64(-4.0 - x) / y_m); else tmp = Float64(Float64(x + 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 <= -4.0) tmp = (-4.0 - x) / y_m; else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -4.0], N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{-4 - x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in z around 0 38.3%
associate-*r/38.3%
distribute-lft-in38.3%
metadata-eval38.3%
neg-mul-138.3%
sub-neg38.3%
Simplified38.3%
if -4 < x Initial program 92.7%
fabs-sub92.7%
associate-*l/94.1%
associate-*r/91.5%
fma-neg93.2%
distribute-neg-frac93.2%
+-commutative93.2%
distribute-neg-in93.2%
unsub-neg93.2%
metadata-eval93.2%
Simplified93.2%
fma-undefine91.5%
associate-*r/94.1%
associate-*l/92.7%
div-inv92.6%
sub-neg92.6%
metadata-eval92.6%
distribute-neg-in92.6%
+-commutative92.6%
cancel-sign-sub-inv92.6%
div-inv92.7%
fabs-sub92.7%
add-sqr-sqrt42.0%
fabs-sqr42.0%
add-sqr-sqrt42.9%
associate-*l/43.3%
sub-div45.5%
Applied egg-rr45.5%
Taylor expanded in z around 0 30.1%
Final simplification32.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ (- x) y_m) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = -x / y_m;
} else {
tmp = (x + 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 <= (-4.0d0)) then
tmp = -x / y_m
else
tmp = (x + 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 <= -4.0) {
tmp = -x / y_m;
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = -x / y_m else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(Float64(-x) / y_m); else tmp = Float64(Float64(x + 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 <= -4.0) tmp = -x / y_m; else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -4.0], N[((-x) / y$95$m), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{-x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 83.5%
fabs-sub83.5%
associate-*l/86.4%
associate-*r/87.6%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
add-sqr-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt52.3%
fma-undefine50.9%
associate-*r/49.7%
associate-*l/48.2%
div-inv48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-neg-in48.0%
+-commutative48.0%
cancel-sign-sub-inv48.0%
div-inv48.2%
associate-*l/49.7%
sub-div56.6%
Applied egg-rr56.6%
Taylor expanded in x around inf 56.6%
Taylor expanded in z around 0 38.3%
neg-mul-138.3%
distribute-neg-frac38.3%
Simplified38.3%
if -4 < x Initial program 92.7%
fabs-sub92.7%
associate-*l/94.1%
associate-*r/91.5%
fma-neg93.2%
distribute-neg-frac93.2%
+-commutative93.2%
distribute-neg-in93.2%
unsub-neg93.2%
metadata-eval93.2%
Simplified93.2%
fma-undefine91.5%
associate-*r/94.1%
associate-*l/92.7%
div-inv92.6%
sub-neg92.6%
metadata-eval92.6%
distribute-neg-in92.6%
+-commutative92.6%
cancel-sign-sub-inv92.6%
div-inv92.7%
fabs-sub92.7%
add-sqr-sqrt42.0%
fabs-sqr42.0%
add-sqr-sqrt42.9%
associate-*l/43.3%
sub-div45.5%
Applied egg-rr45.5%
Taylor expanded in z around 0 30.1%
Final simplification32.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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 (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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 (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < 4Initial program 90.8%
fabs-sub90.8%
associate-*l/95.0%
associate-*r/90.2%
fma-neg91.7%
distribute-neg-frac91.7%
+-commutative91.7%
distribute-neg-in91.7%
unsub-neg91.7%
metadata-eval91.7%
Simplified91.7%
fma-undefine90.2%
associate-*r/95.0%
associate-*l/90.8%
div-inv90.7%
sub-neg90.7%
metadata-eval90.7%
distribute-neg-in90.7%
+-commutative90.7%
cancel-sign-sub-inv90.7%
div-inv90.8%
fabs-sub90.8%
add-sqr-sqrt40.4%
fabs-sqr40.4%
add-sqr-sqrt41.4%
associate-*l/43.2%
sub-div45.2%
Applied egg-rr45.2%
Taylor expanded in x around 0 22.3%
if 4 < x Initial program 87.4%
fabs-sub87.4%
associate-*l/80.9%
associate-*r/91.0%
fma-neg96.4%
distribute-neg-frac96.4%
+-commutative96.4%
distribute-neg-in96.4%
unsub-neg96.4%
metadata-eval96.4%
Simplified96.4%
fma-undefine91.0%
associate-*r/80.9%
associate-*l/87.4%
div-inv87.3%
sub-neg87.3%
metadata-eval87.3%
distribute-neg-in87.3%
+-commutative87.3%
cancel-sign-sub-inv87.3%
div-inv87.4%
fabs-sub87.4%
add-sqr-sqrt39.1%
fabs-sqr39.1%
add-sqr-sqrt39.5%
sub-neg39.5%
distribute-rgt-neg-in39.5%
Applied egg-rr39.5%
Taylor expanded in x around -inf 46.6%
mul-1-neg46.6%
div-sub46.6%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.2%
neg-mul-143.2%
sub-neg43.2%
*-lft-identity43.2%
sub-neg43.2%
distribute-rgt-in43.2%
*-rgt-identity43.2%
remove-double-neg43.2%
*-commutative43.2%
mul-1-neg43.2%
associate-*r*43.2%
neg-mul-143.2%
distribute-rgt-neg-in43.2%
mul-1-neg43.2%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified46.6%
Taylor expanded in z around 0 22.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ 4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return 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 = 4.0d0 / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return 4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return 4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = 4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{4}{y\_m}
\end{array}
Initial program 90.1%
fabs-sub90.1%
associate-*l/91.9%
associate-*r/90.4%
fma-neg92.8%
distribute-neg-frac92.8%
+-commutative92.8%
distribute-neg-in92.8%
unsub-neg92.8%
metadata-eval92.8%
Simplified92.8%
fma-undefine90.4%
associate-*r/91.9%
associate-*l/90.1%
div-inv90.0%
sub-neg90.0%
metadata-eval90.0%
distribute-neg-in90.0%
+-commutative90.0%
cancel-sign-sub-inv90.0%
div-inv90.1%
fabs-sub90.1%
add-sqr-sqrt40.1%
fabs-sqr40.1%
add-sqr-sqrt41.0%
associate-*l/41.6%
sub-div44.8%
Applied egg-rr44.8%
Taylor expanded in x around 0 18.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ -4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return -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 = (-4.0d0) / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return -4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return -4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(-4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = -4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(-4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{-4}{y\_m}
\end{array}
Initial program 90.1%
fabs-sub90.1%
associate-*l/91.9%
associate-*r/90.4%
fma-neg92.8%
distribute-neg-frac92.8%
+-commutative92.8%
distribute-neg-in92.8%
unsub-neg92.8%
metadata-eval92.8%
Simplified92.8%
add-sqr-sqrt51.4%
fabs-sqr51.4%
add-sqr-sqrt52.2%
fma-undefine51.0%
associate-*r/51.4%
associate-*l/50.3%
div-inv50.2%
sub-neg50.2%
metadata-eval50.2%
distribute-neg-in50.2%
+-commutative50.2%
cancel-sign-sub-inv50.2%
div-inv50.3%
associate-*l/51.4%
sub-div53.8%
Applied egg-rr53.8%
Taylor expanded in x around 0 22.4%
herbie shell --seed 2024143
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))