
(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 8e-47) (fabs (/ (- (+ x 4.0) (* 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 <= 8e-47) {
tmp = fabs((((x + 4.0) - (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 <= 8e-47) tmp = abs(Float64(Float64(Float64(x + 4.0) - 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, 8e-47], N[Abs[N[(N[(N[(x + 4.0), $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 8 \cdot 10^{-47}:\\
\;\;\;\;\left|\frac{\left(x + 4\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 < 7.9999999999999998e-47Initial program 91.0%
Taylor expanded in y around 0 97.5%
if 7.9999999999999998e-47 < y Initial program 98.1%
Simplified99.9%
Final simplification98.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ 4.0 y_m)))
(t_1 (fabs (/ x y_m)))
(t_2 (fabs (* x (/ z y_m)))))
(if (<= x -2.6e+104)
t_1
(if (<= x -1e-16)
t_2
(if (<= x -6.2e-54)
t_0
(if (<= x -1.1e-90)
t_2
(if (<= x 3.6e-22) t_0 (if (<= x 3.2e+98) t_2 t_1))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((4.0 / y_m));
double t_1 = fabs((x / y_m));
double t_2 = fabs((x * (z / y_m)));
double tmp;
if (x <= -2.6e+104) {
tmp = t_1;
} else if (x <= -1e-16) {
tmp = t_2;
} else if (x <= -6.2e-54) {
tmp = t_0;
} else if (x <= -1.1e-90) {
tmp = t_2;
} else if (x <= 3.6e-22) {
tmp = t_0;
} else if (x <= 3.2e+98) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs((4.0d0 / y_m))
t_1 = abs((x / y_m))
t_2 = abs((x * (z / y_m)))
if (x <= (-2.6d+104)) then
tmp = t_1
else if (x <= (-1d-16)) then
tmp = t_2
else if (x <= (-6.2d-54)) then
tmp = t_0
else if (x <= (-1.1d-90)) then
tmp = t_2
else if (x <= 3.6d-22) then
tmp = t_0
else if (x <= 3.2d+98) then
tmp = t_2
else
tmp = t_1
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((4.0 / y_m));
double t_1 = Math.abs((x / y_m));
double t_2 = Math.abs((x * (z / y_m)));
double tmp;
if (x <= -2.6e+104) {
tmp = t_1;
} else if (x <= -1e-16) {
tmp = t_2;
} else if (x <= -6.2e-54) {
tmp = t_0;
} else if (x <= -1.1e-90) {
tmp = t_2;
} else if (x <= 3.6e-22) {
tmp = t_0;
} else if (x <= 3.2e+98) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((4.0 / y_m)) t_1 = math.fabs((x / y_m)) t_2 = math.fabs((x * (z / y_m))) tmp = 0 if x <= -2.6e+104: tmp = t_1 elif x <= -1e-16: tmp = t_2 elif x <= -6.2e-54: tmp = t_0 elif x <= -1.1e-90: tmp = t_2 elif x <= 3.6e-22: tmp = t_0 elif x <= 3.2e+98: tmp = t_2 else: tmp = t_1 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(4.0 / y_m)) t_1 = abs(Float64(x / y_m)) t_2 = abs(Float64(x * Float64(z / y_m))) tmp = 0.0 if (x <= -2.6e+104) tmp = t_1; elseif (x <= -1e-16) tmp = t_2; elseif (x <= -6.2e-54) tmp = t_0; elseif (x <= -1.1e-90) tmp = t_2; elseif (x <= 3.6e-22) tmp = t_0; elseif (x <= 3.2e+98) tmp = t_2; else tmp = t_1; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((4.0 / y_m)); t_1 = abs((x / y_m)); t_2 = abs((x * (z / y_m))); tmp = 0.0; if (x <= -2.6e+104) tmp = t_1; elseif (x <= -1e-16) tmp = t_2; elseif (x <= -6.2e-54) tmp = t_0; elseif (x <= -1.1e-90) tmp = t_2; elseif (x <= 3.6e-22) tmp = t_0; elseif (x <= 3.2e+98) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.6e+104], t$95$1, If[LessEqual[x, -1e-16], t$95$2, If[LessEqual[x, -6.2e-54], t$95$0, If[LessEqual[x, -1.1e-90], t$95$2, If[LessEqual[x, 3.6e-22], t$95$0, If[LessEqual[x, 3.2e+98], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{4}{y\_m}\right|\\
t_1 := \left|\frac{x}{y\_m}\right|\\
t_2 := \left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.6e104 or 3.2000000000000002e98 < x Initial program 85.3%
Simplified98.7%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 76.2%
associate-*r/76.2%
neg-mul-176.2%
Simplified76.2%
if -2.6e104 < x < -9.9999999999999998e-17 or -6.20000000000000008e-54 < x < -1.09999999999999993e-90 or 3.5999999999999998e-22 < x < 3.2000000000000002e98Initial program 93.3%
Simplified94.9%
Taylor expanded in x around inf 95.7%
Taylor expanded in z around inf 66.4%
associate-*r/71.0%
Simplified71.0%
if -9.9999999999999998e-17 < x < -6.20000000000000008e-54 or -1.09999999999999993e-90 < x < 3.5999999999999998e-22Initial program 98.1%
Taylor expanded in x around 0 80.0%
Final simplification76.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))) (t_1 (fabs (/ 4.0 y_m))))
(if (<= x -7e-12)
t_0
(if (<= x -1.4e-55)
t_1
(if (<= x -9.5e-90)
(fabs (* x (/ z y_m)))
(if (<= x 3.5e-22) t_1 (if (<= x 8e+101) t_0 (fabs (/ x y_m)))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double t_1 = fabs((4.0 / y_m));
double tmp;
if (x <= -7e-12) {
tmp = t_0;
} else if (x <= -1.4e-55) {
tmp = t_1;
} else if (x <= -9.5e-90) {
tmp = fabs((x * (z / y_m)));
} else if (x <= 3.5e-22) {
tmp = t_1;
} else if (x <= 8e+101) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
t_1 = abs((4.0d0 / y_m))
if (x <= (-7d-12)) then
tmp = t_0
else if (x <= (-1.4d-55)) then
tmp = t_1
else if (x <= (-9.5d-90)) then
tmp = abs((x * (z / y_m)))
else if (x <= 3.5d-22) then
tmp = t_1
else if (x <= 8d+101) then
tmp = t_0
else
tmp = abs((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 t_0 = Math.abs((z * (x / y_m)));
double t_1 = Math.abs((4.0 / y_m));
double tmp;
if (x <= -7e-12) {
tmp = t_0;
} else if (x <= -1.4e-55) {
tmp = t_1;
} else if (x <= -9.5e-90) {
tmp = Math.abs((x * (z / y_m)));
} else if (x <= 3.5e-22) {
tmp = t_1;
} else if (x <= 8e+101) {
tmp = t_0;
} else {
tmp = Math.abs((x / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) t_1 = math.fabs((4.0 / y_m)) tmp = 0 if x <= -7e-12: tmp = t_0 elif x <= -1.4e-55: tmp = t_1 elif x <= -9.5e-90: tmp = math.fabs((x * (z / y_m))) elif x <= 3.5e-22: tmp = t_1 elif x <= 8e+101: tmp = t_0 else: tmp = math.fabs((x / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) t_1 = abs(Float64(4.0 / y_m)) tmp = 0.0 if (x <= -7e-12) tmp = t_0; elseif (x <= -1.4e-55) tmp = t_1; elseif (x <= -9.5e-90) tmp = abs(Float64(x * Float64(z / y_m))); elseif (x <= 3.5e-22) tmp = t_1; elseif (x <= 8e+101) tmp = t_0; else tmp = abs(Float64(x / 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))); t_1 = abs((4.0 / y_m)); tmp = 0.0; if (x <= -7e-12) tmp = t_0; elseif (x <= -1.4e-55) tmp = t_1; elseif (x <= -9.5e-90) tmp = abs((x * (z / y_m))); elseif (x <= 3.5e-22) tmp = t_1; elseif (x <= 8e+101) tmp = t_0; else tmp = abs((x / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -7e-12], t$95$0, If[LessEqual[x, -1.4e-55], t$95$1, If[LessEqual[x, -9.5e-90], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.5e-22], t$95$1, If[LessEqual[x, 8e+101], t$95$0, N[Abs[N[(x / 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|\\
t_1 := \left|\frac{4}{y\_m}\right|\\
\mathbf{if}\;x \leq -7 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-90}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -7.0000000000000001e-12 or 3.50000000000000005e-22 < x < 7.9999999999999998e101Initial program 90.5%
Taylor expanded in z around inf 58.4%
mul-1-neg58.4%
associate-*l/69.2%
distribute-rgt-neg-out69.2%
Simplified69.2%
add-log-exp42.8%
exp-prod41.6%
add-sqr-sqrt20.8%
sqrt-unprod36.0%
sqr-neg36.0%
sqrt-unprod22.1%
add-sqr-sqrt41.6%
Applied egg-rr41.6%
log-pow42.1%
rem-log-exp69.2%
Simplified69.2%
if -7.0000000000000001e-12 < x < -1.39999999999999992e-55 or -9.5000000000000003e-90 < x < 3.50000000000000005e-22Initial program 98.1%
Taylor expanded in x around 0 80.0%
if -1.39999999999999992e-55 < x < -9.5000000000000003e-90Initial program 99.8%
Simplified100.0%
Taylor expanded in x around inf 88.2%
Taylor expanded in z around inf 88.2%
associate-*r/88.2%
Simplified88.2%
if 7.9999999999999998e101 < x Initial program 82.4%
Simplified97.4%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 83.6%
associate-*r/83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification76.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))) (t_1 (fabs (/ 4.0 y_m))))
(if (<= x -8.6e-15)
t_0
(if (<= x -1.15e-51)
t_1
(if (<= x -1.3e-89)
(fabs (/ z (/ y_m x)))
(if (<= x 3.1e-22) t_1 (if (<= x 3.2e+107) t_0 (fabs (/ x y_m)))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double t_1 = fabs((4.0 / y_m));
double tmp;
if (x <= -8.6e-15) {
tmp = t_0;
} else if (x <= -1.15e-51) {
tmp = t_1;
} else if (x <= -1.3e-89) {
tmp = fabs((z / (y_m / x)));
} else if (x <= 3.1e-22) {
tmp = t_1;
} else if (x <= 3.2e+107) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
t_1 = abs((4.0d0 / y_m))
if (x <= (-8.6d-15)) then
tmp = t_0
else if (x <= (-1.15d-51)) then
tmp = t_1
else if (x <= (-1.3d-89)) then
tmp = abs((z / (y_m / x)))
else if (x <= 3.1d-22) then
tmp = t_1
else if (x <= 3.2d+107) then
tmp = t_0
else
tmp = abs((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 t_0 = Math.abs((z * (x / y_m)));
double t_1 = Math.abs((4.0 / y_m));
double tmp;
if (x <= -8.6e-15) {
tmp = t_0;
} else if (x <= -1.15e-51) {
tmp = t_1;
} else if (x <= -1.3e-89) {
tmp = Math.abs((z / (y_m / x)));
} else if (x <= 3.1e-22) {
tmp = t_1;
} else if (x <= 3.2e+107) {
tmp = t_0;
} else {
tmp = Math.abs((x / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) t_1 = math.fabs((4.0 / y_m)) tmp = 0 if x <= -8.6e-15: tmp = t_0 elif x <= -1.15e-51: tmp = t_1 elif x <= -1.3e-89: tmp = math.fabs((z / (y_m / x))) elif x <= 3.1e-22: tmp = t_1 elif x <= 3.2e+107: tmp = t_0 else: tmp = math.fabs((x / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) t_1 = abs(Float64(4.0 / y_m)) tmp = 0.0 if (x <= -8.6e-15) tmp = t_0; elseif (x <= -1.15e-51) tmp = t_1; elseif (x <= -1.3e-89) tmp = abs(Float64(z / Float64(y_m / x))); elseif (x <= 3.1e-22) tmp = t_1; elseif (x <= 3.2e+107) tmp = t_0; else tmp = abs(Float64(x / 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))); t_1 = abs((4.0 / y_m)); tmp = 0.0; if (x <= -8.6e-15) tmp = t_0; elseif (x <= -1.15e-51) tmp = t_1; elseif (x <= -1.3e-89) tmp = abs((z / (y_m / x))); elseif (x <= 3.1e-22) tmp = t_1; elseif (x <= 3.2e+107) tmp = t_0; else tmp = abs((x / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -8.6e-15], t$95$0, If[LessEqual[x, -1.15e-51], t$95$1, If[LessEqual[x, -1.3e-89], N[Abs[N[(z / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.1e-22], t$95$1, If[LessEqual[x, 3.2e+107], t$95$0, N[Abs[N[(x / 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|\\
t_1 := \left|\frac{4}{y\_m}\right|\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-89}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if x < -8.5999999999999993e-15 or 3.10000000000000013e-22 < x < 3.20000000000000029e107Initial program 90.5%
Taylor expanded in z around inf 58.4%
mul-1-neg58.4%
associate-*l/69.2%
distribute-rgt-neg-out69.2%
Simplified69.2%
add-log-exp42.8%
exp-prod41.6%
add-sqr-sqrt20.8%
sqrt-unprod36.0%
sqr-neg36.0%
sqrt-unprod22.1%
add-sqr-sqrt41.6%
Applied egg-rr41.6%
log-pow42.1%
rem-log-exp69.2%
Simplified69.2%
if -8.5999999999999993e-15 < x < -1.15000000000000001e-51 or -1.2999999999999999e-89 < x < 3.10000000000000013e-22Initial program 98.1%
Taylor expanded in x around 0 80.0%
if -1.15000000000000001e-51 < x < -1.2999999999999999e-89Initial program 99.8%
Simplified100.0%
Taylor expanded in x around inf 88.2%
Taylor expanded in z around inf 88.2%
associate-*r/88.2%
*-commutative88.2%
associate-/r/88.2%
Simplified88.2%
if 3.20000000000000029e107 < x Initial program 82.4%
Simplified97.4%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around 0 83.6%
associate-*r/83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification76.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 7e-81) (fabs (/ (- (+ x 4.0) (* x z)) y_m)) (fabs (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 7e-81) {
tmp = fabs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = fabs((((x + 4.0) / y_m) - (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 (y_m <= 7d-81) then
tmp = abs((((x + 4.0d0) - (x * z)) / y_m))
else
tmp = abs((((x + 4.0d0) / y_m) - (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 (y_m <= 7e-81) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
} else {
tmp = Math.abs((((x + 4.0) / y_m) - (z * (x / y_m))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if y_m <= 7e-81: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) else: tmp = math.fabs((((x + 4.0) / y_m) - (z * (x / y_m)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 7e-81) 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(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 (y_m <= 7e-81) tmp = abs((((x + 4.0) - (x * z)) / y_m)); else tmp = abs((((x + 4.0) / y_m) - (z * (x / y_m)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 7e-81], 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[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 7 \cdot 10^{-81}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\right|\\
\end{array}
\end{array}
if y < 6.99999999999999973e-81Initial program 90.5%
Taylor expanded in y around 0 97.4%
if 6.99999999999999973e-81 < y Initial program 98.3%
Final simplification97.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= z -1.05e+38) (not (<= z 1.75e+130))) (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 <= -1.05e+38) || !(z <= 1.75e+130)) {
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 <= (-1.05d+38)) .or. (.not. (z <= 1.75d+130))) 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 <= -1.05e+38) || !(z <= 1.75e+130)) {
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 <= -1.05e+38) or not (z <= 1.75e+130): 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 <= -1.05e+38) || !(z <= 1.75e+130)) tmp = abs(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 <= -1.05e+38) || ~((z <= 1.75e+130))) 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, -1.05e+38], N[Not[LessEqual[z, 1.75e+130]], $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 -1.05 \cdot 10^{+38} \lor \neg \left(z \leq 1.75 \cdot 10^{+130}\right):\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y\_m}\right|\\
\end{array}
\end{array}
if z < -1.05e38 or 1.75e130 < z Initial program 96.6%
Taylor expanded in z around inf 78.6%
mul-1-neg78.6%
associate-*l/83.8%
distribute-rgt-neg-out83.8%
Simplified83.8%
add-log-exp38.8%
exp-prod35.3%
add-sqr-sqrt23.4%
sqrt-unprod35.3%
sqr-neg35.3%
sqrt-unprod13.6%
add-sqr-sqrt35.3%
Applied egg-rr35.3%
log-pow36.9%
rem-log-exp83.8%
Simplified83.8%
if -1.05e38 < z < 1.75e130Initial program 90.6%
Simplified98.1%
Taylor expanded in z around 0 93.2%
associate-*r/93.2%
distribute-lft-in93.2%
metadata-eval93.2%
neg-mul-193.2%
sub-neg93.2%
Simplified93.2%
Final simplification89.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.5) (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.5) || !(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.5d0)) .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.5) || !(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.5) 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.5) || !(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.5) || ~((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.5], 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.5 \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.5 or 4 < x Initial program 87.4%
Simplified96.8%
Taylor expanded in x around inf 99.2%
Taylor expanded in z around 0 64.3%
associate-*r/64.3%
neg-mul-164.3%
Simplified64.3%
if -1.5 < x < 4Initial program 98.2%
Taylor expanded in x around 0 72.3%
Final simplification68.3%
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 92.8%
Taylor expanded in y around 0 97.4%
Final simplification97.4%
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 92.8%
Taylor expanded in x around 0 38.7%
Final simplification38.7%
herbie shell --seed 2024027
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))