
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 1.5e-39) (fabs (/ (fma (- 1.0 z) x 4.0) 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 <= 1.5e-39) {
tmp = fabs((fma((1.0 - z), x, 4.0) / 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 <= 1.5e-39) tmp = abs(Float64(fma(Float64(1.0 - z), x, 4.0) / y_m)); 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, 1.5e-39], N[Abs[N[(N[(N[(1.0 - z), $MachinePrecision] * x + 4.0), $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 1.5 \cdot 10^{-39}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(1 - z, x, 4\right)}{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 < 1.50000000000000014e-39Initial program 85.7%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites97.9%
if 1.50000000000000014e-39 < y Initial program 93.6%
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%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -850000.0)
(fabs (* (/ x y_m) (- 1.0 z)))
(if (<= x 4.0)
(fabs (/ (fma (- z) x 4.0) y_m))
(fabs (* (/ (- 1.0 z) y_m) x)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -850000.0) {
tmp = fabs(((x / y_m) * (1.0 - z)));
} else if (x <= 4.0) {
tmp = fabs((fma(-z, x, 4.0) / y_m));
} else {
tmp = fabs((((1.0 - z) / y_m) * x));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -850000.0) tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); elseif (x <= 4.0) tmp = abs(Float64(fma(Float64(-z), x, 4.0) / y_m)); else tmp = abs(Float64(Float64(Float64(1.0 - z) / y_m) * x)); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -850000.0], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.0], N[Abs[N[(N[((-z) * x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -850000:\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(-z, x, 4\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1 - z}{y\_m} \cdot x\right|\\
\end{array}
\end{array}
if x < -8.5e5Initial program 81.2%
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.5
Applied rewrites99.5%
if -8.5e5 < x < 4Initial program 94.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites99.1%
if 4 < x Initial program 80.5%
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.7
Applied rewrites99.7%
Applied rewrites99.8%
Final simplification99.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -2.55e-29) (fabs (* (/ x y_m) (- 1.0 z))) (if (<= x 4.8e-48) (fabs (/ 4.0 y_m)) (fabs (* (/ (- 1.0 z) y_m) x)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.55e-29) {
tmp = fabs(((x / y_m) * (1.0 - z)));
} else if (x <= 4.8e-48) {
tmp = fabs((4.0 / y_m));
} 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) :: tmp
if (x <= (-2.55d-29)) then
tmp = abs(((x / y_m) * (1.0d0 - z)))
else if (x <= 4.8d-48) then
tmp = abs((4.0d0 / y_m))
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 tmp;
if (x <= -2.55e-29) {
tmp = Math.abs(((x / y_m) * (1.0 - z)));
} else if (x <= 4.8e-48) {
tmp = Math.abs((4.0 / y_m));
} else {
tmp = Math.abs((((1.0 - z) / y_m) * x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2.55e-29: tmp = math.fabs(((x / y_m) * (1.0 - z))) elif x <= 4.8e-48: tmp = math.fabs((4.0 / y_m)) else: tmp = math.fabs((((1.0 - z) / y_m) * x)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2.55e-29) tmp = abs(Float64(Float64(x / y_m) * Float64(1.0 - z))); elseif (x <= 4.8e-48) tmp = abs(Float64(4.0 / y_m)); else tmp = abs(Float64(Float64(Float64(1.0 - z) / y_m) * x)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2.55e-29) tmp = abs(((x / y_m) * (1.0 - z))); elseif (x <= 4.8e-48) tmp = abs((4.0 / y_m)); 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_] := If[LessEqual[x, -2.55e-29], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 4.8e-48], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{-29}:\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot \left(1 - z\right)\right|\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{1 - z}{y\_m} \cdot x\right|\\
\end{array}
\end{array}
if x < -2.54999999999999993e-29Initial program 83.5%
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.2
Applied rewrites98.2%
if -2.54999999999999993e-29 < x < 4.8e-48Initial program 95.2%
Taylor expanded in x around 0
lower-/.f6481.4
Applied rewrites81.4%
if 4.8e-48 < x Initial program 80.2%
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-/.f6491.5
Applied rewrites91.5%
Applied rewrites94.3%
Final simplification89.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (* (/ (- 1.0 z) y_m) x)))) (if (<= x -2.55e-29) t_0 (if (<= x 4.8e-48) (fabs (/ 4.0 y_m)) t_0))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((((1.0 - z) / y_m) * x));
double tmp;
if (x <= -2.55e-29) {
tmp = t_0;
} else if (x <= 4.8e-48) {
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((((1.0d0 - z) / y_m) * x))
if (x <= (-2.55d-29)) then
tmp = t_0
else if (x <= 4.8d-48) 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((((1.0 - z) / y_m) * x));
double tmp;
if (x <= -2.55e-29) {
tmp = t_0;
} else if (x <= 4.8e-48) {
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((((1.0 - z) / y_m) * x)) tmp = 0 if x <= -2.55e-29: tmp = t_0 elif x <= 4.8e-48: 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(Float64(Float64(1.0 - z) / y_m) * x)) tmp = 0.0 if (x <= -2.55e-29) tmp = t_0; elseif (x <= 4.8e-48) 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((((1.0 - z) / y_m) * x)); tmp = 0.0; if (x <= -2.55e-29) tmp = t_0; elseif (x <= 4.8e-48) 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[(N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.55e-29], t$95$0, If[LessEqual[x, 4.8e-48], 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{1 - z}{y\_m} \cdot x\right|\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-48}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.54999999999999993e-29 or 4.8e-48 < x Initial program 81.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-/.f6495.0
Applied rewrites95.0%
Applied rewrites96.3%
if -2.54999999999999993e-29 < x < 4.8e-48Initial program 95.2%
Taylor expanded in x around 0
lower-/.f6481.4
Applied rewrites81.4%
Final simplification89.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (/ (* z x) y_m)))) (if (<= z -9.2e+91) t_0 (if (<= z 8.4e+18) (fabs (/ (+ 4.0 x) y_m)) t_0))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs(((z * x) / y_m));
double tmp;
if (z <= -9.2e+91) {
tmp = t_0;
} else if (z <= 8.4e+18) {
tmp = fabs(((4.0 + x) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(((z * x) / y_m))
if (z <= (-9.2d+91)) then
tmp = t_0
else if (z <= 8.4d+18) then
tmp = abs(((4.0d0 + x) / y_m))
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs(((z * x) / y_m));
double tmp;
if (z <= -9.2e+91) {
tmp = t_0;
} else if (z <= 8.4e+18) {
tmp = Math.abs(((4.0 + x) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs(((z * x) / y_m)) tmp = 0 if z <= -9.2e+91: tmp = t_0 elif z <= 8.4e+18: tmp = math.fabs(((4.0 + x) / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(Float64(z * x) / y_m)) tmp = 0.0 if (z <= -9.2e+91) tmp = t_0; elseif (z <= 8.4e+18) tmp = abs(Float64(Float64(4.0 + x) / y_m)); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs(((z * x) / y_m)); tmp = 0.0; if (z <= -9.2e+91) tmp = t_0; elseif (z <= 8.4e+18) tmp = abs(((4.0 + x) / y_m)); else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(z * x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -9.2e+91], t$95$0, If[LessEqual[z, 8.4e+18], N[Abs[N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{z \cdot x}{y\_m}\right|\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{4 + x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.19999999999999965e91 or 8.4e18 < z Initial program 84.3%
lift-fabs.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied rewrites95.4%
Taylor expanded in z around inf
lower-*.f6480.0
Applied rewrites80.0%
if -9.19999999999999965e91 < z < 8.4e18Initial program 90.6%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites94.5%
Final simplification88.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= z -9.2e+91) (fabs (* (/ x y_m) z)) (if (<= z 8.4e+18) (fabs (/ (+ 4.0 x) y_m)) (fabs (* (/ z y_m) x)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -9.2e+91) {
tmp = fabs(((x / y_m) * z));
} else if (z <= 8.4e+18) {
tmp = fabs(((4.0 + x) / y_m));
} else {
tmp = fabs(((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) :: tmp
if (z <= (-9.2d+91)) then
tmp = abs(((x / y_m) * z))
else if (z <= 8.4d+18) then
tmp = abs(((4.0d0 + x) / y_m))
else
tmp = abs(((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 tmp;
if (z <= -9.2e+91) {
tmp = Math.abs(((x / y_m) * z));
} else if (z <= 8.4e+18) {
tmp = Math.abs(((4.0 + x) / y_m));
} else {
tmp = Math.abs(((z / y_m) * x));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -9.2e+91: tmp = math.fabs(((x / y_m) * z)) elif z <= 8.4e+18: tmp = math.fabs(((4.0 + x) / y_m)) else: tmp = math.fabs(((z / y_m) * x)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -9.2e+91) tmp = abs(Float64(Float64(x / y_m) * z)); elseif (z <= 8.4e+18) tmp = abs(Float64(Float64(4.0 + x) / y_m)); else tmp = abs(Float64(Float64(z / y_m) * x)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -9.2e+91) tmp = abs(((x / y_m) * z)); elseif (z <= 8.4e+18) tmp = abs(((4.0 + x) / y_m)); else tmp = abs(((z / y_m) * x)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -9.2e+91], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 8.4e+18], N[Abs[N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(z / y$95$m), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+91}:\\
\;\;\;\;\left|\frac{x}{y\_m} \cdot z\right|\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{4 + x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{y\_m} \cdot x\right|\\
\end{array}
\end{array}
if z < -9.19999999999999965e91Initial program 95.7%
lift-fabs.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied rewrites95.8%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
Applied rewrites85.6%
if -9.19999999999999965e91 < z < 8.4e18Initial program 90.6%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites94.5%
if 8.4e18 < z Initial program 75.6%
lift-fabs.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied rewrites95.1%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.6
Applied rewrites75.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (* (/ x y_m) z)))) (if (<= z -9.2e+91) t_0 (if (<= z 8.4e+18) (fabs (/ (+ 4.0 x) y_m)) t_0))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs(((x / y_m) * z));
double tmp;
if (z <= -9.2e+91) {
tmp = t_0;
} else if (z <= 8.4e+18) {
tmp = fabs(((4.0 + x) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(((x / y_m) * z))
if (z <= (-9.2d+91)) then
tmp = t_0
else if (z <= 8.4d+18) then
tmp = abs(((4.0d0 + x) / y_m))
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs(((x / y_m) * z));
double tmp;
if (z <= -9.2e+91) {
tmp = t_0;
} else if (z <= 8.4e+18) {
tmp = Math.abs(((4.0 + x) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs(((x / y_m) * z)) tmp = 0 if z <= -9.2e+91: tmp = t_0 elif z <= 8.4e+18: tmp = math.fabs(((4.0 + x) / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(Float64(x / y_m) * z)) tmp = 0.0 if (z <= -9.2e+91) tmp = t_0; elseif (z <= 8.4e+18) tmp = abs(Float64(Float64(4.0 + x) / y_m)); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs(((x / y_m) * z)); tmp = 0.0; if (z <= -9.2e+91) tmp = t_0; elseif (z <= 8.4e+18) tmp = abs(((4.0 + x) / y_m)); else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y$95$m), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -9.2e+91], t$95$0, If[LessEqual[z, 8.4e+18], N[Abs[N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m} \cdot z\right|\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{4 + x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.19999999999999965e91 or 8.4e18 < z Initial program 84.3%
lift-fabs.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied rewrites95.4%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6478.1
Applied rewrites78.1%
Applied rewrites77.7%
if -9.19999999999999965e91 < z < 8.4e18Initial program 90.6%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites94.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (fma (- 1.0 z) x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((fma((1.0 - z), x, 4.0) / y_m));
}
y_m = abs(y) function code(x, y_m, z) return abs(Float64(fma(Float64(1.0 - z), x, 4.0) / y_m)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(1.0 - z), $MachinePrecision] * x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\mathsf{fma}\left(1 - z, x, 4\right)}{y\_m}\right|
\end{array}
Initial program 88.0%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites98.1%
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 88.0%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-out--N/A
associate-*r/N/A
*-rgt-identityN/A
associate-/l*N/A
associate--l+N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-*l*N/A
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
distribute-lft-out--N/A
*-commutativeN/A
associate-/l*N/A
Applied rewrites98.1%
Taylor expanded in z around 0
Applied rewrites71.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 88.0%
Taylor expanded in x around 0
lower-/.f6441.5
Applied rewrites41.5%
herbie shell --seed 2024332
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))