
(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 8.8e-116) (fabs (pow (/ y_m (- (+ 4.0 x) (* z x))) -1.0)) (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 <= 8.8e-116) {
tmp = fabs(pow((y_m / ((4.0 + x) - (z * x))), -1.0));
} 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 <= 8.8e-116) tmp = abs((Float64(y_m / Float64(Float64(4.0 + x) - Float64(z * x))) ^ -1.0)); else tmp = abs(fma(Float64(-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, 8.8e-116], N[Abs[N[Power[N[(y$95$m / N[(N[(4.0 + x), $MachinePrecision] - N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $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 8.8 \cdot 10^{-116}:\\
\;\;\;\;\left|{\left(\frac{y\_m}{\left(4 + x\right) - z \cdot x}\right)}^{-1}\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 < 8.8000000000000004e-116Initial program 88.4%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
sub-divN/A
clear-numN/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6497.2
Applied rewrites97.2%
if 8.8000000000000004e-116 < y Initial program 95.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification98.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (- (* (/ x y_m) z) (/ (+ x 4.0) y_m))))) (if (<= t_0 5e+303) t_0 (fabs (/ (- 1.0 z) (/ y_m x))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((((x / y_m) * z) - ((x + 4.0) / y_m)));
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = fabs(((1.0 - z) / (y_m / x)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((((x / y_m) * z) - ((x + 4.0d0) / y_m)))
if (t_0 <= 5d+303) then
tmp = t_0
else
tmp = abs(((1.0d0 - z) / (y_m / x)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((((x / y_m) * z) - ((x + 4.0) / y_m)));
double tmp;
if (t_0 <= 5e+303) {
tmp = t_0;
} else {
tmp = Math.abs(((1.0 - z) / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((((x / y_m) * z) - ((x + 4.0) / y_m))) tmp = 0 if t_0 <= 5e+303: tmp = t_0 else: tmp = math.fabs(((1.0 - z) / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(Float64(Float64(x / y_m) * z) - Float64(Float64(x + 4.0) / y_m))) tmp = 0.0 if (t_0 <= 5e+303) tmp = t_0; else tmp = abs(Float64(Float64(1.0 - z) / Float64(y_m / x))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((((x / y_m) * z) - ((x + 4.0) / y_m))); tmp = 0.0; if (t_0 <= 5e+303) tmp = t_0; else tmp = abs(((1.0 - z) / (y_m / x))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x / y$95$m), $MachinePrecision] * z), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 5e+303], t$95$0, N[Abs[N[(N[(1.0 - z), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m} \cdot z - \frac{x + 4}{y\_m}\right|\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1 - z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 4.9999999999999997e303Initial program 98.8%
if 4.9999999999999997e303 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 71.4%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification99.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.5) (not (<= x 4.1))) (fabs (* (- 1.0 z) (/ x y_m))) (fabs (/ (- 4.0 (* z x)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.1)) {
tmp = fabs(((1.0 - z) * (x / y_m)));
} else {
tmp = fabs(((4.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 ((x <= (-1.5d0)) .or. (.not. (x <= 4.1d0))) then
tmp = abs(((1.0d0 - z) * (x / y_m)))
else
tmp = abs(((4.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 ((x <= -1.5) || !(x <= 4.1)) {
tmp = Math.abs(((1.0 - z) * (x / y_m)));
} else {
tmp = Math.abs(((4.0 - (z * x)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -1.5) or not (x <= 4.1): tmp = math.fabs(((1.0 - z) * (x / y_m))) else: tmp = math.fabs(((4.0 - (z * x)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -1.5) || !(x <= 4.1)) tmp = abs(Float64(Float64(1.0 - z) * Float64(x / y_m))); else tmp = abs(Float64(Float64(4.0 - Float64(z * 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) || ~((x <= 4.1))) tmp = abs(((1.0 - z) * (x / y_m))); else tmp = abs(((4.0 - (z * 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.5], N[Not[LessEqual[x, 4.1]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(4.0 - N[(z * x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4.1\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4 - z \cdot x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -1.5 or 4.0999999999999996 < x Initial program 83.9%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
if -1.5 < x < 4.0999999999999996Initial program 98.3%
Taylor expanded in x around 0
Applied rewrites96.4%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6498.0
Applied rewrites98.0%
Final simplification98.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1e-15) (not (<= x 0.003))) (fabs (* (- 1.0 z) (/ x 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 <= -1e-15) || !(x <= 0.003)) {
tmp = fabs(((1.0 - z) * (x / 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 <= (-1d-15)) .or. (.not. (x <= 0.003d0))) then
tmp = abs(((1.0d0 - z) * (x / 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 <= -1e-15) || !(x <= 0.003)) {
tmp = Math.abs(((1.0 - z) * (x / 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 <= -1e-15) or not (x <= 0.003): tmp = math.fabs(((1.0 - z) * (x / 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 <= -1e-15) || !(x <= 0.003)) tmp = abs(Float64(Float64(1.0 - z) * Float64(x / 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 <= -1e-15) || ~((x <= 0.003))) tmp = abs(((1.0 - z) * (x / 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, -1e-15], N[Not[LessEqual[x, 0.003]], $MachinePrecision]], N[Abs[N[(N[(1.0 - z), $MachinePrecision] * N[(x / 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 \cdot 10^{-15} \lor \neg \left(x \leq 0.003\right):\\
\;\;\;\;\left|\left(1 - z\right) \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -1.0000000000000001e-15 or 0.0030000000000000001 < x Initial program 84.4%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
if -1.0000000000000001e-15 < x < 0.0030000000000000001Initial program 98.3%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in z around 0
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6481.2
Applied rewrites81.2%
Final simplification90.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -165000000000.0) (not (<= z 1.45e+33))) (fabs (* (- z) (/ x y_m))) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((z <= -165000000000.0) || !(z <= 1.45e+33)) {
tmp = fabs((-z * (x / 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 ((z <= (-165000000000.0d0)) .or. (.not. (z <= 1.45d+33))) then
tmp = abs((-z * (x / 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 ((z <= -165000000000.0) || !(z <= 1.45e+33)) {
tmp = Math.abs((-z * (x / 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 (z <= -165000000000.0) or not (z <= 1.45e+33): tmp = math.fabs((-z * (x / 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 ((z <= -165000000000.0) || !(z <= 1.45e+33)) tmp = abs(Float64(Float64(-z) * Float64(x / 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 ((z <= -165000000000.0) || ~((z <= 1.45e+33))) tmp = abs((-z * (x / 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[z, -165000000000.0], N[Not[LessEqual[z, 1.45e+33]], $MachinePrecision]], N[Abs[N[((-z) * N[(x / 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}\;z \leq -165000000000 \lor \neg \left(z \leq 1.45 \cdot 10^{+33}\right):\\
\;\;\;\;\left|\left(-z\right) \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.65e11 or 1.45000000000000012e33 < z Initial program 90.9%
Taylor expanded in z around inf
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6479.6
Applied rewrites79.6%
if -1.65e11 < z < 1.45000000000000012e33Initial program 90.3%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval99.3
Applied rewrites99.3%
Taylor expanded in z around 0
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6499.0
Applied rewrites99.0%
Final simplification90.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -165000000000.0) (not (<= z 1.45e+33))) (fabs (* (/ z y_m) x)) (fabs (/ (- -4.0 x) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((z <= -165000000000.0) || !(z <= 1.45e+33)) {
tmp = fabs(((z / y_m) * x));
} 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 ((z <= (-165000000000.0d0)) .or. (.not. (z <= 1.45d+33))) then
tmp = abs(((z / y_m) * x))
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 ((z <= -165000000000.0) || !(z <= 1.45e+33)) {
tmp = Math.abs(((z / y_m) * x));
} 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 (z <= -165000000000.0) or not (z <= 1.45e+33): tmp = math.fabs(((z / y_m) * x)) 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 ((z <= -165000000000.0) || !(z <= 1.45e+33)) tmp = abs(Float64(Float64(z / y_m) * x)); 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 ((z <= -165000000000.0) || ~((z <= 1.45e+33))) tmp = abs(((z / y_m) * x)); 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[z, -165000000000.0], N[Not[LessEqual[z, 1.45e+33]], $MachinePrecision]], N[Abs[N[(N[(z / y$95$m), $MachinePrecision] * x), $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}\;z \leq -165000000000 \lor \neg \left(z \leq 1.45 \cdot 10^{+33}\right):\\
\;\;\;\;\left|\frac{z}{y\_m} \cdot x\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.65e11 or 1.45000000000000012e33 < z Initial program 90.9%
Taylor expanded in x around 0
Applied rewrites98.1%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6494.8
Applied rewrites94.8%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.5
Applied rewrites77.5%
if -1.65e11 < z < 1.45000000000000012e33Initial program 90.3%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval99.3
Applied rewrites99.3%
Taylor expanded in z around 0
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6499.0
Applied rewrites99.0%
Final simplification89.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (fma z x (- -4.0 x)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((fma(z, x, (-4.0 - x)) / y_m));
}
y_m = abs(y) function code(x, y_m, z) return abs(Float64(fma(z, x, Float64(-4.0 - x)) / y_m)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(z * x + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\mathsf{fma}\left(z, x, -4 - x\right)}{y\_m}\right|
\end{array}
Initial program 90.6%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval97.4
Applied rewrites97.4%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (- -4.0 x) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs(((-4.0 - x) / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((((-4.0d0) - x) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs(((-4.0 - x) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs(((-4.0 - x) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(-4.0 - x) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs(((-4.0 - x) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{-4 - x}{y\_m}\right|
\end{array}
Initial program 90.6%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval97.4
Applied rewrites97.4%
Taylor expanded in z around 0
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6470.6
Applied rewrites70.6%
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 90.6%
Taylor expanded in x around 0
lower-/.f6438.6
Applied rewrites38.6%
herbie shell --seed 2024307
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))