
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 2e+55) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 2e+55) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((((x + 4.0) / 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 <= 2d+55) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((((x + 4.0d0) / 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 <= 2e+55) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 2e+55: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs((((x + 4.0) / y_m) - (x / (y_m / z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 2e+55) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / 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 <= 2e+55) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((((x + 4.0) / 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, 2e+55], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $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 2 \cdot 10^{+55}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 2.00000000000000002e55Initial program 92.0%
associate-*l/94.2%
sub-div98.1%
Applied egg-rr98.1%
if 2.00000000000000002e55 < y Initial program 91.1%
associate-*l/92.5%
associate-*r/99.7%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification98.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))))
(if (<= x -8.6e+143)
t_0
(if (<= x -0.095)
(fabs (/ x y_m))
(if (or (<= x -1.65e-128) (not (<= x 2.4e-87)))
t_0
(fabs (/ 4.0 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 <= -8.6e+143) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = fabs((x / y_m));
} else if ((x <= -1.65e-128) || !(x <= 2.4e-87)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
if (x <= (-8.6d+143)) then
tmp = t_0
else if (x <= (-0.095d0)) then
tmp = abs((x / y_m))
else if ((x <= (-1.65d-128)) .or. (.not. (x <= 2.4d-87))) then
tmp = t_0
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 t_0 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -8.6e+143) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = Math.abs((x / y_m));
} else if ((x <= -1.65e-128) || !(x <= 2.4e-87)) {
tmp = t_0;
} else {
tmp = Math.abs((4.0 / 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 <= -8.6e+143: tmp = t_0 elif x <= -0.095: tmp = math.fabs((x / y_m)) elif (x <= -1.65e-128) or not (x <= 2.4e-87): tmp = t_0 else: tmp = math.fabs((4.0 / 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 <= -8.6e+143) tmp = t_0; elseif (x <= -0.095) tmp = abs(Float64(x / y_m)); elseif ((x <= -1.65e-128) || !(x <= 2.4e-87)) tmp = t_0; else tmp = abs(Float64(4.0 / 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 <= -8.6e+143) tmp = t_0; elseif (x <= -0.095) tmp = abs((x / y_m)); elseif ((x <= -1.65e-128) || ~((x <= 2.4e-87))) tmp = t_0; else tmp = abs((4.0 / 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, -8.6e+143], t$95$0, If[LessEqual[x, -0.095], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, -1.65e-128], N[Not[LessEqual[x, 2.4e-87]], $MachinePrecision]], t$95$0, N[Abs[N[(4.0 / 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.6 \cdot 10^{+143}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -0.095:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-128} \lor \neg \left(x \leq 2.4 \cdot 10^{-87}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -8.60000000000000003e143 or -0.095000000000000001 < x < -1.65e-128 or 2.4e-87 < x Initial program 91.9%
Simplified95.4%
Taylor expanded in z around inf 57.3%
mul-1-neg57.3%
distribute-frac-neg257.3%
associate-/l*58.8%
Simplified58.8%
clear-num58.8%
un-div-inv58.8%
add-sqr-sqrt30.6%
sqrt-unprod47.9%
sqr-neg47.9%
sqrt-unprod28.2%
add-sqr-sqrt58.8%
Applied egg-rr58.8%
associate-/r/67.1%
*-commutative67.1%
Simplified67.1%
if -8.60000000000000003e143 < x < -0.095000000000000001Initial program 84.1%
Simplified95.0%
Taylor expanded in x around inf 86.6%
mul-1-neg86.6%
*-commutative86.6%
associate-/l*91.3%
distribute-lft-neg-in91.3%
neg-sub091.3%
associate-+l-91.3%
neg-sub091.3%
+-commutative91.3%
unsub-neg91.3%
Simplified91.3%
Taylor expanded in z around 0 64.0%
if -1.65e-128 < x < 2.4e-87Initial program 95.1%
Simplified99.9%
Taylor expanded in x around 0 82.2%
Final simplification71.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ z (/ y_m x)))))
(if (<= x -6.2e+147)
t_0
(if (<= x -0.095)
(fabs (/ x y_m))
(if (<= x -1.25e-129)
(fabs (* z (/ x y_m)))
(if (<= x 2.5e-87) (fabs (/ 4.0 y_m)) t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z / (y_m / x)));
double tmp;
if (x <= -6.2e+147) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = fabs((x / y_m));
} else if (x <= -1.25e-129) {
tmp = fabs((z * (x / y_m)));
} else if (x <= 2.5e-87) {
tmp = fabs((4.0 / 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 / (y_m / x)))
if (x <= (-6.2d+147)) then
tmp = t_0
else if (x <= (-0.095d0)) then
tmp = abs((x / y_m))
else if (x <= (-1.25d-129)) then
tmp = abs((z * (x / y_m)))
else if (x <= 2.5d-87) then
tmp = abs((4.0d0 / 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 / (y_m / x)));
double tmp;
if (x <= -6.2e+147) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = Math.abs((x / y_m));
} else if (x <= -1.25e-129) {
tmp = Math.abs((z * (x / y_m)));
} else if (x <= 2.5e-87) {
tmp = Math.abs((4.0 / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z / (y_m / x))) tmp = 0 if x <= -6.2e+147: tmp = t_0 elif x <= -0.095: tmp = math.fabs((x / y_m)) elif x <= -1.25e-129: tmp = math.fabs((z * (x / y_m))) elif x <= 2.5e-87: tmp = math.fabs((4.0 / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z / Float64(y_m / x))) tmp = 0.0 if (x <= -6.2e+147) tmp = t_0; elseif (x <= -0.095) tmp = abs(Float64(x / y_m)); elseif (x <= -1.25e-129) tmp = abs(Float64(z * Float64(x / y_m))); elseif (x <= 2.5e-87) tmp = abs(Float64(4.0 / 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 / (y_m / x))); tmp = 0.0; if (x <= -6.2e+147) tmp = t_0; elseif (x <= -0.095) tmp = abs((x / y_m)); elseif (x <= -1.25e-129) tmp = abs((z * (x / y_m))); elseif (x <= 2.5e-87) tmp = abs((4.0 / 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[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -6.2e+147], t$95$0, If[LessEqual[x, -0.095], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -1.25e-129], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.5e-87], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -0.095:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{-129}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-87}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.2000000000000001e147 or 2.50000000000000021e-87 < x Initial program 90.8%
Simplified94.6%
Taylor expanded in z around inf 55.6%
associate-*r/55.6%
neg-mul-155.6%
distribute-rgt-neg-in55.6%
Simplified55.6%
clear-num55.6%
associate-/r/55.6%
add-sqr-sqrt27.5%
sqrt-unprod48.4%
sqr-neg48.4%
sqrt-unprod28.0%
add-sqr-sqrt55.6%
Applied egg-rr55.6%
Taylor expanded in y around 0 55.6%
associate-*l/67.6%
*-lft-identity67.6%
associate-*l/67.6%
associate-/r/67.6%
associate-*l/67.6%
*-lft-identity67.6%
Simplified67.6%
if -6.2000000000000001e147 < x < -0.095000000000000001Initial program 84.1%
Simplified95.0%
Taylor expanded in x around inf 86.6%
mul-1-neg86.6%
*-commutative86.6%
associate-/l*91.3%
distribute-lft-neg-in91.3%
neg-sub091.3%
associate-+l-91.3%
neg-sub091.3%
+-commutative91.3%
unsub-neg91.3%
Simplified91.3%
Taylor expanded in z around 0 64.0%
if -0.095000000000000001 < x < -1.25000000000000007e-129Initial program 97.8%
Simplified99.6%
Taylor expanded in z around inf 66.3%
mul-1-neg66.3%
distribute-frac-neg266.3%
associate-/l*57.2%
Simplified57.2%
clear-num57.1%
un-div-inv57.1%
add-sqr-sqrt16.0%
sqrt-unprod38.3%
sqr-neg38.3%
sqrt-unprod41.1%
add-sqr-sqrt57.1%
Applied egg-rr57.1%
associate-/r/64.2%
*-commutative64.2%
Simplified64.2%
if -1.25000000000000007e-129 < x < 2.50000000000000021e-87Initial program 95.1%
Simplified99.9%
Taylor expanded in x around 0 82.2%
Final simplification71.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ z (/ y_m x)))))
(if (<= x -1.35e+144)
t_0
(if (<= x -0.095)
(fabs (/ x y_m))
(if (<= x -1.65e-128)
(fabs (/ (* x z) y_m))
(if (<= x 2.5e-87) (fabs (/ 4.0 y_m)) t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z / (y_m / x)));
double tmp;
if (x <= -1.35e+144) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = fabs((x / y_m));
} else if (x <= -1.65e-128) {
tmp = fabs(((x * z) / y_m));
} else if (x <= 2.5e-87) {
tmp = fabs((4.0 / 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 / (y_m / x)))
if (x <= (-1.35d+144)) then
tmp = t_0
else if (x <= (-0.095d0)) then
tmp = abs((x / y_m))
else if (x <= (-1.65d-128)) then
tmp = abs(((x * z) / y_m))
else if (x <= 2.5d-87) then
tmp = abs((4.0d0 / 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 / (y_m / x)));
double tmp;
if (x <= -1.35e+144) {
tmp = t_0;
} else if (x <= -0.095) {
tmp = Math.abs((x / y_m));
} else if (x <= -1.65e-128) {
tmp = Math.abs(((x * z) / y_m));
} else if (x <= 2.5e-87) {
tmp = Math.abs((4.0 / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z / (y_m / x))) tmp = 0 if x <= -1.35e+144: tmp = t_0 elif x <= -0.095: tmp = math.fabs((x / y_m)) elif x <= -1.65e-128: tmp = math.fabs(((x * z) / y_m)) elif x <= 2.5e-87: tmp = math.fabs((4.0 / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z / Float64(y_m / x))) tmp = 0.0 if (x <= -1.35e+144) tmp = t_0; elseif (x <= -0.095) tmp = abs(Float64(x / y_m)); elseif (x <= -1.65e-128) tmp = abs(Float64(Float64(x * z) / y_m)); elseif (x <= 2.5e-87) tmp = abs(Float64(4.0 / 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 / (y_m / x))); tmp = 0.0; if (x <= -1.35e+144) tmp = t_0; elseif (x <= -0.095) tmp = abs((x / y_m)); elseif (x <= -1.65e-128) tmp = abs(((x * z) / y_m)); elseif (x <= 2.5e-87) tmp = abs((4.0 / 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[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.35e+144], t$95$0, If[LessEqual[x, -0.095], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, -1.65e-128], N[Abs[N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.5e-87], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+144}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -0.095:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-128}:\\
\;\;\;\;\left|\frac{x \cdot z}{y\_m}\right|\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-87}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.35000000000000008e144 or 2.50000000000000021e-87 < x Initial program 90.8%
Simplified94.6%
Taylor expanded in z around inf 55.6%
associate-*r/55.6%
neg-mul-155.6%
distribute-rgt-neg-in55.6%
Simplified55.6%
clear-num55.6%
associate-/r/55.6%
add-sqr-sqrt27.5%
sqrt-unprod48.4%
sqr-neg48.4%
sqrt-unprod28.0%
add-sqr-sqrt55.6%
Applied egg-rr55.6%
Taylor expanded in y around 0 55.6%
associate-*l/67.6%
*-lft-identity67.6%
associate-*l/67.6%
associate-/r/67.6%
associate-*l/67.6%
*-lft-identity67.6%
Simplified67.6%
if -1.35000000000000008e144 < x < -0.095000000000000001Initial program 84.1%
Simplified95.0%
Taylor expanded in x around inf 86.6%
mul-1-neg86.6%
*-commutative86.6%
associate-/l*91.3%
distribute-lft-neg-in91.3%
neg-sub091.3%
associate-+l-91.3%
neg-sub091.3%
+-commutative91.3%
unsub-neg91.3%
Simplified91.3%
Taylor expanded in z around 0 64.0%
if -0.095000000000000001 < x < -1.65e-128Initial program 97.8%
Simplified99.6%
Taylor expanded in z around inf 66.3%
mul-1-neg66.3%
distribute-frac-neg266.3%
associate-/l*57.2%
Simplified57.2%
associate-*r/66.3%
add-sqr-sqrt20.5%
sqrt-unprod38.5%
sqr-neg38.5%
sqrt-unprod45.4%
add-sqr-sqrt66.3%
Applied egg-rr66.3%
if -1.65e-128 < x < 2.50000000000000021e-87Initial program 95.1%
Simplified99.9%
Taylor expanded in x around 0 82.2%
Final simplification72.0%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -1.4e+63)
(fabs (/ z (/ y_m x)))
(if (<= z 9.2e+60)
(fabs (/ (- -4.0 x) y_m))
(fabs (* (- 1.0 z) (/ x y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.4e+63) {
tmp = fabs((z / (y_m / x)));
} else if (z <= 9.2e+60) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs(((1.0 - z) * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.4d+63)) then
tmp = abs((z / (y_m / x)))
else if (z <= 9.2d+60) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs(((1.0d0 - z) * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -1.4e+63) {
tmp = Math.abs((z / (y_m / x)));
} else if (z <= 9.2e+60) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs(((1.0 - z) * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -1.4e+63: tmp = math.fabs((z / (y_m / x))) elif z <= 9.2e+60: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs(((1.0 - z) * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -1.4e+63) tmp = abs(Float64(z / Float64(y_m / x))); elseif (z <= 9.2e+60) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -1.4e+63) tmp = abs((z / (y_m / x))); elseif (z <= 9.2e+60) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs(((1.0 - z) * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -1.4e+63], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 9.2e+60], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+63}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+60}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.39999999999999993e63Initial program 93.6%
Simplified92.9%
Taylor expanded in z around inf 81.5%
associate-*r/81.5%
neg-mul-181.5%
distribute-rgt-neg-in81.5%
Simplified81.5%
clear-num81.3%
associate-/r/81.4%
add-sqr-sqrt81.1%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod0.0%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Taylor expanded in y around 0 81.5%
associate-*l/82.9%
*-lft-identity82.9%
associate-*l/82.8%
associate-/r/82.9%
associate-*l/83.0%
*-lft-identity83.0%
Simplified83.0%
if -1.39999999999999993e63 < z < 9.20000000000000068e60Initial program 94.7%
Simplified99.8%
Taylor expanded in z around 0 94.4%
+-commutative94.4%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt94.4%
fabs-neg94.4%
distribute-neg-frac94.4%
distribute-neg-in94.4%
metadata-eval94.4%
+-commutative94.4%
sub-neg94.4%
rem-square-sqrt42.8%
fabs-sqr42.8%
rem-square-sqrt94.4%
Simplified94.4%
if 9.20000000000000068e60 < z Initial program 81.3%
Simplified92.2%
Taylor expanded in x around inf 81.7%
mul-1-neg81.7%
*-commutative81.7%
associate-/l*85.3%
distribute-lft-neg-in85.3%
neg-sub085.3%
associate-+l-85.3%
neg-sub085.3%
+-commutative85.3%
unsub-neg85.3%
Simplified85.3%
Final simplification90.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -4.9e+67) (fabs (/ z (/ y_m x))) (if (<= z 7e+59) (fabs (/ (- -4.0 x) y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -4.9e+67) {
tmp = fabs((z / (y_m / x)));
} else if (z <= 7e+59) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((z * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-4.9d+67)) then
tmp = abs((z / (y_m / x)))
else if (z <= 7d+59) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((z * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -4.9e+67) {
tmp = Math.abs((z / (y_m / x)));
} else if (z <= 7e+59) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((z * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -4.9e+67: tmp = math.fabs((z / (y_m / x))) elif z <= 7e+59: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((z * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -4.9e+67) tmp = abs(Float64(z / Float64(y_m / x))); elseif (z <= 7e+59) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(z * Float64(x / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -4.9e+67) tmp = abs((z / (y_m / x))); elseif (z <= 7e+59) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((z * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -4.9e+67], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 7e+59], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.9 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+59}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -4.8999999999999999e67Initial program 93.6%
Simplified92.9%
Taylor expanded in z around inf 81.5%
associate-*r/81.5%
neg-mul-181.5%
distribute-rgt-neg-in81.5%
Simplified81.5%
clear-num81.3%
associate-/r/81.4%
add-sqr-sqrt81.1%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod0.0%
add-sqr-sqrt81.4%
Applied egg-rr81.4%
Taylor expanded in y around 0 81.5%
associate-*l/82.9%
*-lft-identity82.9%
associate-*l/82.8%
associate-/r/82.9%
associate-*l/83.0%
*-lft-identity83.0%
Simplified83.0%
if -4.8999999999999999e67 < z < 7e59Initial program 94.7%
Simplified99.8%
Taylor expanded in z around 0 94.4%
+-commutative94.4%
rem-square-sqrt51.1%
fabs-sqr51.1%
rem-square-sqrt94.4%
fabs-neg94.4%
distribute-neg-frac94.4%
distribute-neg-in94.4%
metadata-eval94.4%
+-commutative94.4%
sub-neg94.4%
rem-square-sqrt42.8%
fabs-sqr42.8%
rem-square-sqrt94.4%
Simplified94.4%
if 7e59 < z Initial program 81.3%
Simplified92.2%
Taylor expanded in z around inf 81.7%
mul-1-neg81.7%
distribute-frac-neg281.7%
associate-/l*81.8%
Simplified81.8%
clear-num81.8%
un-div-inv81.8%
add-sqr-sqrt48.0%
sqrt-unprod56.2%
sqr-neg56.2%
sqrt-unprod33.7%
add-sqr-sqrt81.8%
Applied egg-rr81.8%
associate-/r/85.3%
*-commutative85.3%
Simplified85.3%
Final simplification90.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.55) (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.55) || !(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.55d0)) .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.55) || !(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.55) 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.55) || !(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.55) || ~((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.55], 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.55 \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.55000000000000004 or 4 < x Initial program 87.7%
Simplified93.7%
Taylor expanded in x around inf 91.6%
mul-1-neg91.6%
*-commutative91.6%
associate-/l*97.6%
distribute-lft-neg-in97.6%
neg-sub097.6%
associate-+l-97.6%
neg-sub097.6%
+-commutative97.6%
unsub-neg97.6%
Simplified97.6%
Taylor expanded in z around 0 61.8%
if -1.55000000000000004 < x < 4Initial program 95.7%
Simplified99.8%
Taylor expanded in x around 0 66.3%
Final simplification64.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((((x + 4.0) - (x * 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((((x + 4.0d0) - (x * z)) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((((x + 4.0) - (x * z)) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((((x + 4.0) - (x * z)) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|
\end{array}
Initial program 91.8%
associate-*l/93.9%
sub-div97.0%
Applied egg-rr97.0%
Final simplification97.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ 4.0 y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((4.0 / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((4.0d0 / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((4.0 / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((4.0 / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(4.0 / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((4.0 / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4}{y\_m}\right|
\end{array}
Initial program 91.8%
Simplified96.9%
Taylor expanded in x around 0 37.1%
Final simplification37.1%
herbie shell --seed 2024096
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))