
(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-59) (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-59) {
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-59) 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-59], 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^{-59}:\\
\;\;\;\;\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.0000000000000001e-59Initial program 90.1%
Taylor expanded in y around 0 98.3%
if 2.0000000000000001e-59 < y Initial program 96.2%
Simplified99.9%
Final simplification98.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= (fabs (- (/ (+ 4.0 x) y_m) (* z (/ x y_m)))) 0.1) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (* (/ x y_m) (+ (/ 4.0 x) (- 1.0 z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (fabs((((4.0 + x) / y_m) - (z * (x / y_m)))) <= 0.1) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs(((x / y_m) * ((4.0 / x) + (1.0 - 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 (abs((((4.0d0 + x) / y_m) - (z * (x / y_m)))) <= 0.1d0) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs(((x / y_m) * ((4.0d0 / x) + (1.0d0 - 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 (Math.abs((((4.0 + x) / y_m) - (z * (x / y_m)))) <= 0.1) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs(((x / y_m) * ((4.0 / x) + (1.0 - z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if math.fabs((((4.0 + x) / y_m) - (z * (x / y_m)))) <= 0.1: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs(((x / y_m) * ((4.0 / x) + (1.0 - z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (abs(Float64(Float64(Float64(4.0 + x) / y_m) - Float64(z * Float64(x / y_m)))) <= 0.1) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(Float64(x / y_m) * Float64(Float64(4.0 / x) + Float64(1.0 - z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (abs((((4.0 + x) / y_m) - (z * (x / y_m)))) <= 0.1) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs(((x / y_m) * ((4.0 / x) + (1.0 - z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.1], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(N[(4.0 / x), $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\left|\frac{4 + x}{y_m} - z \cdot \frac{x}{y_m}\right| \leq 0.1:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y_m} \cdot \left(\frac{4}{x} + \left(1 - z\right)\right)\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 0.10000000000000001Initial program 90.3%
Taylor expanded in y around 0 99.9%
if 0.10000000000000001 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 92.6%
*-commutative92.6%
clear-num92.6%
un-div-inv93.1%
Applied egg-rr93.1%
div-inv92.6%
clear-num92.6%
cancel-sign-sub-inv92.6%
+-commutative92.6%
clear-num92.6%
un-div-inv93.1%
add-sqr-sqrt46.7%
sqrt-unprod77.5%
sqr-neg77.5%
sqrt-unprod52.4%
add-sqr-sqrt90.6%
frac-2neg90.6%
frac-add79.0%
Applied egg-rr79.4%
Taylor expanded in y around -inf 95.7%
associate-/l*79.3%
associate-/r/99.7%
associate-+r+99.7%
+-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Final simplification99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.92e-44) (not (<= x 4.8e-32))) (fabs (* x (/ (- 1.0 z) y_m))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1.92e-44) || !(x <= 4.8e-32)) {
tmp = fabs((x * ((1.0 - z) / y_m)));
} else {
tmp = fabs(((-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 ((x <= (-1.92d-44)) .or. (.not. (x <= 4.8d-32))) then
tmp = abs((x * ((1.0d0 - z) / y_m)))
else
tmp = abs((((-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 ((x <= -1.92e-44) || !(x <= 4.8e-32)) {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
} else {
tmp = Math.abs(((-4.0 - x) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -1.92e-44) or not (x <= 4.8e-32): tmp = math.fabs((x * ((1.0 - z) / y_m))) else: tmp = math.fabs(((-4.0 - x) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -1.92e-44) || !(x <= 4.8e-32)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); else tmp = abs(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 ((x <= -1.92e-44) || ~((x <= 4.8e-32))) tmp = abs((x * ((1.0 - z) / y_m))); else tmp = abs(((-4.0 - x) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -1.92e-44], N[Not[LessEqual[x, 4.8e-32]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.92 \cdot 10^{-44} \lor \neg \left(x \leq 4.8 \cdot 10^{-32}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\end{array}
\end{array}
if x < -1.91999999999999992e-44 or 4.8000000000000003e-32 < x Initial program 90.4%
Taylor expanded in y around 0 94.5%
Taylor expanded in x around inf 92.3%
associate-/l*97.6%
Simplified97.6%
clear-num97.4%
associate-/r/97.4%
clear-num97.6%
Applied egg-rr97.6%
if -1.91999999999999992e-44 < x < 4.8000000000000003e-32Initial program 93.7%
Simplified89.7%
Taylor expanded in z around 0 77.9%
associate-*r/77.9%
distribute-lft-in77.9%
metadata-eval77.9%
neg-mul-177.9%
sub-neg77.9%
Simplified77.9%
Final simplification88.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -5.5e-47)
(fabs (/ x (/ y_m (- 1.0 z))))
(if (<= x 1.2e-31)
(fabs (/ (- -4.0 x) y_m))
(fabs (* x (/ (- 1.0 z) y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.5e-47) {
tmp = fabs((x / (y_m / (1.0 - z))));
} else if (x <= 1.2e-31) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-5.5d-47)) then
tmp = abs((x / (y_m / (1.0d0 - z))))
else if (x <= 1.2d-31) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x * ((1.0d0 - z) / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.5e-47) {
tmp = Math.abs((x / (y_m / (1.0 - z))));
} else if (x <= 1.2e-31) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -5.5e-47: tmp = math.fabs((x / (y_m / (1.0 - z)))) elif x <= 1.2e-31: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x * ((1.0 - z) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -5.5e-47) tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); elseif (x <= 1.2e-31) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -5.5e-47) tmp = abs((x / (y_m / (1.0 - z)))); elseif (x <= 1.2e-31) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x * ((1.0 - z) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -5.5e-47], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.2e-31], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-47}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-31}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y_m}\right|\\
\end{array}
\end{array}
if x < -5.5000000000000002e-47Initial program 90.6%
Taylor expanded in y around 0 98.7%
Taylor expanded in x around inf 96.6%
associate-/l*97.8%
Simplified97.8%
if -5.5000000000000002e-47 < x < 1.2e-31Initial program 93.7%
Simplified89.7%
Taylor expanded in z around 0 77.9%
associate-*r/77.9%
distribute-lft-in77.9%
metadata-eval77.9%
neg-mul-177.9%
sub-neg77.9%
Simplified77.9%
if 1.2e-31 < x Initial program 90.2%
Taylor expanded in y around 0 90.8%
Taylor expanded in x around inf 88.5%
associate-/l*97.4%
Simplified97.4%
clear-num97.3%
associate-/r/97.3%
clear-num97.5%
Applied egg-rr97.5%
Final simplification88.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 15500000000000.0) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 15500000000000.0) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 15500000000000.0d0) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs((x * ((1.0d0 - z) / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= 15500000000000.0) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 15500000000000.0: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs((x * ((1.0 - z) / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 15500000000000.0) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 15500000000000.0) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs((x * ((1.0 - z) / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 15500000000000.0], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 15500000000000:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y_m}\right|\\
\end{array}
\end{array}
if x < 1.55e13Initial program 92.8%
Taylor expanded in y around 0 99.5%
if 1.55e13 < x Initial program 89.4%
Taylor expanded in y around 0 90.1%
Taylor expanded in x around inf 90.1%
associate-/l*99.8%
Simplified99.8%
clear-num99.7%
associate-/r/99.7%
clear-num99.8%
Applied egg-rr99.8%
Final simplification99.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.5) (fabs (/ x y_m)) (if (<= x 1.6e-35) (fabs (/ 4.0 y_m)) (fabs (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.5) {
tmp = fabs((x / y_m));
} else if (x <= 1.6e-35) {
tmp = fabs((4.0 / 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 (x <= (-1.5d0)) then
tmp = abs((x / y_m))
else if (x <= 1.6d-35) then
tmp = abs((4.0d0 / 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 (x <= -1.5) {
tmp = Math.abs((x / y_m));
} else if (x <= 1.6e-35) {
tmp = Math.abs((4.0 / 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 x <= -1.5: tmp = math.fabs((x / y_m)) elif x <= 1.6e-35: tmp = math.fabs((4.0 / 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 (x <= -1.5) tmp = abs(Float64(x / y_m)); elseif (x <= 1.6e-35) tmp = abs(Float64(4.0 / 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 (x <= -1.5) tmp = abs((x / y_m)); elseif (x <= 1.6e-35) tmp = abs((4.0 / 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[x, -1.5], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.6e-35], N[Abs[N[(4.0 / 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}\;x \leq -1.5:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-35}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\end{array}
\end{array}
if x < -1.5Initial program 90.2%
Taylor expanded in z around 0 65.9%
associate-*r/65.9%
metadata-eval65.9%
Simplified65.9%
Taylor expanded in x around inf 65.9%
if -1.5 < x < 1.5999999999999999e-35Initial program 93.7%
Taylor expanded in x around 0 77.3%
if 1.5999999999999999e-35 < x Initial program 90.5%
Taylor expanded in z around inf 50.7%
mul-1-neg50.7%
associate-*l/68.3%
distribute-rgt-neg-out68.3%
Simplified68.3%
add-sqr-sqrt32.5%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod35.7%
add-sqr-sqrt68.3%
associate-*l/50.7%
frac-2neg50.7%
distribute-rgt-neg-in50.7%
add-sqr-sqrt22.4%
sqrt-unprod42.7%
sqr-neg42.7%
sqrt-unprod28.2%
add-sqr-sqrt50.7%
Applied egg-rr50.7%
associate-/l*58.7%
associate-/r/68.3%
add-sqr-sqrt32.9%
sqrt-unprod55.5%
sqr-neg55.5%
sqrt-unprod35.3%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
Final simplification71.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -9e+17) (fabs (* z (/ x y_m))) (if (<= z 2.3e+40) (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 <= -9e+17) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 2.3e+40) {
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 <= (-9d+17)) then
tmp = abs((z * (x / y_m)))
else if (z <= 2.3d+40) 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 <= -9e+17) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 2.3e+40) {
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 <= -9e+17: tmp = math.fabs((z * (x / y_m))) elif z <= 2.3e+40: 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 <= -9e+17) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 2.3e+40) 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 <= -9e+17) tmp = abs((z * (x / y_m))); elseif (z <= 2.3e+40) 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, -9e+17], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 2.3e+40], 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 -9 \cdot 10^{+17}:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+40}:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{z}}\right|\\
\end{array}
\end{array}
if z < -9e17Initial program 93.7%
Taylor expanded in z around inf 74.5%
mul-1-neg74.5%
associate-*l/76.4%
distribute-rgt-neg-out76.4%
Simplified76.4%
add-sqr-sqrt76.2%
sqrt-unprod52.1%
sqr-neg52.1%
sqrt-unprod0.0%
add-sqr-sqrt76.4%
associate-*l/74.5%
frac-2neg74.5%
distribute-rgt-neg-in74.5%
add-sqr-sqrt74.2%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod0.0%
add-sqr-sqrt74.5%
Applied egg-rr74.5%
associate-/l*72.7%
associate-/r/76.4%
add-sqr-sqrt31.4%
sqrt-unprod60.9%
sqr-neg60.9%
sqrt-unprod44.7%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
if -9e17 < z < 2.29999999999999994e40Initial program 95.0%
Simplified99.3%
Taylor expanded in z around 0 98.1%
associate-*r/98.1%
distribute-lft-in98.1%
metadata-eval98.1%
neg-mul-198.1%
sub-neg98.1%
Simplified98.1%
if 2.29999999999999994e40 < z Initial program 82.0%
Taylor expanded in z around inf 76.9%
mul-1-neg76.9%
associate-*l/76.1%
distribute-rgt-neg-out76.1%
Simplified76.1%
associate-*l/76.9%
associate-/l*77.2%
add-sqr-sqrt0.0%
sqrt-unprod48.8%
sqr-neg48.8%
sqrt-unprod76.9%
add-sqr-sqrt77.2%
Applied egg-rr77.2%
Final simplification88.5%
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 89.8%
Taylor expanded in z around 0 62.3%
associate-*r/62.3%
metadata-eval62.3%
Simplified62.3%
Taylor expanded in x around inf 62.3%
if -1.55000000000000004 < x < 4Initial program 94.1%
Taylor expanded in x around 0 74.3%
Final simplification68.3%
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.9%
Taylor expanded in x around 0 39.5%
Final simplification39.5%
herbie shell --seed 2023322
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))