
(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 11 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-35) (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 <= 2e-35) {
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 <= 2e-35) 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, 2e-35], 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 2 \cdot 10^{-35}:\\
\;\;\;\;\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 < 2.00000000000000002e-35Initial program 88.4%
associate-*l/89.7%
sub-div97.3%
Applied egg-rr97.3%
if 2.00000000000000002e-35 < y Initial program 96.0%
fabs-sub96.0%
associate-*l/93.3%
associate-*r/99.8%
fma-neg99.8%
distribute-neg-frac99.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
metadata-eval99.8%
Simplified99.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)))
(if (<= (fabs (- t_0 (* z (/ x y_m)))) 2e-93)
(fabs (- t_0 (/ (* 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 t_0 = (x + 4.0) / y_m;
double tmp;
if (fabs((t_0 - (z * (x / y_m)))) <= 2e-93) {
tmp = fabs((t_0 - ((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) :: t_0
real(8) :: tmp
t_0 = (x + 4.0d0) / y_m
if (abs((t_0 - (z * (x / y_m)))) <= 2d-93) then
tmp = abs((t_0 - ((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 t_0 = (x + 4.0) / y_m;
double tmp;
if (Math.abs((t_0 - (z * (x / y_m)))) <= 2e-93) {
tmp = Math.abs((t_0 - ((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): t_0 = (x + 4.0) / y_m tmp = 0 if math.fabs((t_0 - (z * (x / y_m)))) <= 2e-93: tmp = math.fabs((t_0 - ((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) t_0 = Float64(Float64(x + 4.0) / y_m) tmp = 0.0 if (abs(Float64(t_0 - Float64(z * Float64(x / y_m)))) <= 2e-93) tmp = abs(Float64(t_0 - Float64(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) t_0 = (x + 4.0) / y_m; tmp = 0.0; if (abs((t_0 - (z * (x / y_m)))) <= 2e-93) tmp = abs((t_0 - ((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_] := Block[{t$95$0 = N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[N[Abs[N[(t$95$0 - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2e-93], N[Abs[N[(t$95$0 - N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]), $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}
t_0 := \frac{x + 4}{y\_m}\\
\mathbf{if}\;\left|t\_0 - z \cdot \frac{x}{y\_m}\right| \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\left|t\_0 - \frac{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 #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1.9999999999999998e-93Initial program 91.1%
Taylor expanded in x around 0 100.0%
if 1.9999999999999998e-93 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 90.4%
associate-*l/88.7%
sub-div95.4%
Applied egg-rr95.4%
Taylor expanded in x around inf 95.3%
associate--l+95.3%
associate-*r/95.3%
metadata-eval95.3%
Simplified95.3%
*-commutative95.3%
associate-/l*99.7%
+-commutative99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Final simplification99.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= (fabs (- (/ (+ x 4.0) y_m) (* z (/ x y_m)))) 2e-93) (fabs (/ (- (+ x 4.0) (* 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((((x + 4.0) / y_m) - (z * (x / y_m)))) <= 2e-93) {
tmp = fabs((((x + 4.0) - (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((((x + 4.0d0) / y_m) - (z * (x / y_m)))) <= 2d-93) then
tmp = abs((((x + 4.0d0) - (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((((x + 4.0) / y_m) - (z * (x / y_m)))) <= 2e-93) {
tmp = Math.abs((((x + 4.0) - (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((((x + 4.0) / y_m) - (z * (x / y_m)))) <= 2e-93: tmp = math.fabs((((x + 4.0) - (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(x + 4.0) / y_m) - Float64(z * Float64(x / y_m)))) <= 2e-93) tmp = abs(Float64(Float64(Float64(x + 4.0) - 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((((x + 4.0) / y_m) - (z * (x / y_m)))) <= 2e-93) tmp = abs((((x + 4.0) - (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[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2e-93], N[Abs[N[(N[(N[(x + 4.0), $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{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\right| \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\left|\frac{\left(x + 4\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 #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1.9999999999999998e-93Initial program 91.1%
associate-*l/100.0%
sub-div99.9%
Applied egg-rr99.9%
if 1.9999999999999998e-93 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 90.4%
associate-*l/88.7%
sub-div95.4%
Applied egg-rr95.4%
Taylor expanded in x around inf 95.3%
associate--l+95.3%
associate-*r/95.3%
metadata-eval95.3%
Simplified95.3%
*-commutative95.3%
associate-/l*99.7%
+-commutative99.7%
associate-+l-99.7%
Applied egg-rr99.7%
Final simplification99.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* z (/ x y_m)))))
(if (<= x -6.5e+161)
t_0
(if (<= x -1.08e-51)
t_1
(if (<= x 0.0056)
(fabs (/ 4.0 y_m))
(if (or (<= x 1.1e+51)
(and (not (<= x 1.1e+85))
(or (<= x 5.6e+136)
(and (not (<= x 5.5e+213)) (<= x 1.45e+233)))))
t_0
t_1))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((z * (x / y_m)));
double tmp;
if (x <= -6.5e+161) {
tmp = t_0;
} else if (x <= -1.08e-51) {
tmp = t_1;
} else if (x <= 0.0056) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 1.1e+51) || (!(x <= 1.1e+85) && ((x <= 5.6e+136) || (!(x <= 5.5e+213) && (x <= 1.45e+233))))) {
tmp = t_0;
} 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) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((z * (x / y_m)))
if (x <= (-6.5d+161)) then
tmp = t_0
else if (x <= (-1.08d-51)) then
tmp = t_1
else if (x <= 0.0056d0) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 1.1d+51) .or. (.not. (x <= 1.1d+85)) .and. (x <= 5.6d+136) .or. (.not. (x <= 5.5d+213)) .and. (x <= 1.45d+233)) then
tmp = t_0
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((x / y_m));
double t_1 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -6.5e+161) {
tmp = t_0;
} else if (x <= -1.08e-51) {
tmp = t_1;
} else if (x <= 0.0056) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 1.1e+51) || (!(x <= 1.1e+85) && ((x <= 5.6e+136) || (!(x <= 5.5e+213) && (x <= 1.45e+233))))) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -6.5e+161: tmp = t_0 elif x <= -1.08e-51: tmp = t_1 elif x <= 0.0056: tmp = math.fabs((4.0 / y_m)) elif (x <= 1.1e+51) or (not (x <= 1.1e+85) and ((x <= 5.6e+136) or (not (x <= 5.5e+213) and (x <= 1.45e+233)))): tmp = t_0 else: tmp = t_1 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -6.5e+161) tmp = t_0; elseif (x <= -1.08e-51) tmp = t_1; elseif (x <= 0.0056) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 1.1e+51) || (!(x <= 1.1e+85) && ((x <= 5.6e+136) || (!(x <= 5.5e+213) && (x <= 1.45e+233))))) tmp = t_0; else tmp = t_1; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x / y_m)); t_1 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -6.5e+161) tmp = t_0; elseif (x <= -1.08e-51) tmp = t_1; elseif (x <= 0.0056) tmp = abs((4.0 / y_m)); elseif ((x <= 1.1e+51) || (~((x <= 1.1e+85)) && ((x <= 5.6e+136) || (~((x <= 5.5e+213)) && (x <= 1.45e+233))))) tmp = t_0; 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[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -6.5e+161], t$95$0, If[LessEqual[x, -1.08e-51], t$95$1, If[LessEqual[x, 0.0056], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 1.1e+51], And[N[Not[LessEqual[x, 1.1e+85]], $MachinePrecision], Or[LessEqual[x, 5.6e+136], And[N[Not[LessEqual[x, 5.5e+213]], $MachinePrecision], LessEqual[x, 1.45e+233]]]]], t$95$0, t$95$1]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y\_m}\right|\\
t_1 := \left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+161}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.08 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.0056:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+51} \lor \neg \left(x \leq 1.1 \cdot 10^{+85}\right) \land \left(x \leq 5.6 \cdot 10^{+136} \lor \neg \left(x \leq 5.5 \cdot 10^{+213}\right) \land x \leq 1.45 \cdot 10^{+233}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.5e161 or 0.00559999999999999994 < x < 1.09999999999999996e51 or 1.1000000000000001e85 < x < 5.6000000000000004e136 or 5.50000000000000059e213 < x < 1.45000000000000006e233Initial program 90.1%
Taylor expanded in z around 0 70.6%
Taylor expanded in x around inf 69.9%
if -6.5e161 < x < -1.08000000000000004e-51 or 1.09999999999999996e51 < x < 1.1000000000000001e85 or 5.6000000000000004e136 < x < 5.50000000000000059e213 or 1.45000000000000006e233 < x Initial program 82.9%
Simplified94.6%
Taylor expanded in z around inf 61.5%
associate-*r/61.5%
neg-mul-161.5%
distribute-rgt-neg-in61.5%
Simplified61.5%
*-commutative61.5%
associate-/l*71.2%
add-sqr-sqrt27.6%
sqrt-unprod60.7%
sqr-neg60.7%
sqrt-unprod43.5%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if -1.08000000000000004e-51 < x < 0.00559999999999999994Initial program 96.6%
Simplified99.9%
Taylor expanded in x around 0 79.9%
Final simplification75.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* z (/ x y_m)))))
(if (<= x -6.5e+158)
t_0
(if (<= x -9.8e-52)
t_1
(if (<= x 0.0056)
(fabs (/ 4.0 y_m))
(if (<= x 1.3e+53)
t_0
(if (<= x 8e+85)
t_1
(if (<= x 1.4e+132)
t_0
(if (<= x 6.8e+213)
t_1
(if (<= x 4.8e+232) t_0 (fabs (/ z (/ y_m x)))))))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((z * (x / y_m)));
double tmp;
if (x <= -6.5e+158) {
tmp = t_0;
} else if (x <= -9.8e-52) {
tmp = t_1;
} else if (x <= 0.0056) {
tmp = fabs((4.0 / y_m));
} else if (x <= 1.3e+53) {
tmp = t_0;
} else if (x <= 8e+85) {
tmp = t_1;
} else if (x <= 1.4e+132) {
tmp = t_0;
} else if (x <= 6.8e+213) {
tmp = t_1;
} else if (x <= 4.8e+232) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((z * (x / y_m)))
if (x <= (-6.5d+158)) then
tmp = t_0
else if (x <= (-9.8d-52)) then
tmp = t_1
else if (x <= 0.0056d0) then
tmp = abs((4.0d0 / y_m))
else if (x <= 1.3d+53) then
tmp = t_0
else if (x <= 8d+85) then
tmp = t_1
else if (x <= 1.4d+132) then
tmp = t_0
else if (x <= 6.8d+213) then
tmp = t_1
else if (x <= 4.8d+232) then
tmp = t_0
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 t_0 = Math.abs((x / y_m));
double t_1 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -6.5e+158) {
tmp = t_0;
} else if (x <= -9.8e-52) {
tmp = t_1;
} else if (x <= 0.0056) {
tmp = Math.abs((4.0 / y_m));
} else if (x <= 1.3e+53) {
tmp = t_0;
} else if (x <= 8e+85) {
tmp = t_1;
} else if (x <= 1.4e+132) {
tmp = t_0;
} else if (x <= 6.8e+213) {
tmp = t_1;
} else if (x <= 4.8e+232) {
tmp = t_0;
} else {
tmp = Math.abs((z / (y_m / x)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -6.5e+158: tmp = t_0 elif x <= -9.8e-52: tmp = t_1 elif x <= 0.0056: tmp = math.fabs((4.0 / y_m)) elif x <= 1.3e+53: tmp = t_0 elif x <= 8e+85: tmp = t_1 elif x <= 1.4e+132: tmp = t_0 elif x <= 6.8e+213: tmp = t_1 elif x <= 4.8e+232: tmp = t_0 else: tmp = math.fabs((z / (y_m / x))) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -6.5e+158) tmp = t_0; elseif (x <= -9.8e-52) tmp = t_1; elseif (x <= 0.0056) tmp = abs(Float64(4.0 / y_m)); elseif (x <= 1.3e+53) tmp = t_0; elseif (x <= 8e+85) tmp = t_1; elseif (x <= 1.4e+132) tmp = t_0; elseif (x <= 6.8e+213) tmp = t_1; elseif (x <= 4.8e+232) tmp = t_0; else tmp = abs(Float64(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)); t_1 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -6.5e+158) tmp = t_0; elseif (x <= -9.8e-52) tmp = t_1; elseif (x <= 0.0056) tmp = abs((4.0 / y_m)); elseif (x <= 1.3e+53) tmp = t_0; elseif (x <= 8e+85) tmp = t_1; elseif (x <= 1.4e+132) tmp = t_0; elseif (x <= 6.8e+213) tmp = t_1; elseif (x <= 4.8e+232) tmp = t_0; else tmp = abs((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[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -6.5e+158], t$95$0, If[LessEqual[x, -9.8e-52], t$95$1, If[LessEqual[x, 0.0056], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.3e+53], t$95$0, If[LessEqual[x, 8e+85], t$95$1, If[LessEqual[x, 1.4e+132], t$95$0, If[LessEqual[x, 6.8e+213], t$95$1, If[LessEqual[x, 4.8e+232], t$95$0, N[Abs[N[(z / 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}\right|\\
t_1 := \left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -9.8 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.0056:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+53}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+232}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{z}{\frac{y\_m}{x}}\right|\\
\end{array}
\end{array}
if x < -6.5000000000000001e158 or 0.00559999999999999994 < x < 1.29999999999999999e53 or 8.0000000000000001e85 < x < 1.4e132 or 6.79999999999999983e213 < x < 4.8000000000000003e232Initial program 90.1%
Taylor expanded in z around 0 70.6%
Taylor expanded in x around inf 69.9%
if -6.5000000000000001e158 < x < -9.80000000000000037e-52 or 1.29999999999999999e53 < x < 8.0000000000000001e85 or 1.4e132 < x < 6.79999999999999983e213Initial program 87.8%
Simplified95.8%
Taylor expanded in z around inf 61.2%
associate-*r/61.2%
neg-mul-161.2%
distribute-rgt-neg-in61.2%
Simplified61.2%
*-commutative61.2%
associate-/l*70.2%
add-sqr-sqrt25.1%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod44.9%
add-sqr-sqrt70.2%
Applied egg-rr70.2%
if -9.80000000000000037e-52 < x < 0.00559999999999999994Initial program 96.6%
Simplified99.9%
Taylor expanded in x around 0 79.9%
if 4.8000000000000003e232 < x Initial program 64.9%
Simplified90.3%
Taylor expanded in z around inf 62.5%
associate-*r/62.5%
neg-mul-162.5%
distribute-rgt-neg-in62.5%
Simplified62.5%
*-commutative62.5%
associate-/l*74.8%
add-sqr-sqrt36.5%
sqrt-unprod74.6%
sqr-neg74.6%
sqrt-unprod38.3%
add-sqr-sqrt74.8%
Applied egg-rr74.8%
clear-num74.8%
un-div-inv74.8%
Applied egg-rr74.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ (* x z) y_m))) (t_1 (fabs (/ (- -4.0 x) y_m))))
(if (<= z -2.05e+197)
t_0
(if (<= z 2.35e+112)
t_1
(if (<= z 7e+163)
(fabs (* x (/ z y_m)))
(if (<= z 4.5e+178)
t_1
(if (<= z 6.2e+259) (fabs (* z (/ x y_m))) t_0)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs(((x * z) / y_m));
double t_1 = fabs(((-4.0 - x) / y_m));
double tmp;
if (z <= -2.05e+197) {
tmp = t_0;
} else if (z <= 2.35e+112) {
tmp = t_1;
} else if (z <= 7e+163) {
tmp = fabs((x * (z / y_m)));
} else if (z <= 4.5e+178) {
tmp = t_1;
} else if (z <= 6.2e+259) {
tmp = fabs((z * (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) :: t_1
real(8) :: tmp
t_0 = abs(((x * z) / y_m))
t_1 = abs((((-4.0d0) - x) / y_m))
if (z <= (-2.05d+197)) then
tmp = t_0
else if (z <= 2.35d+112) then
tmp = t_1
else if (z <= 7d+163) then
tmp = abs((x * (z / y_m)))
else if (z <= 4.5d+178) then
tmp = t_1
else if (z <= 6.2d+259) then
tmp = abs((z * (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 * z) / y_m));
double t_1 = Math.abs(((-4.0 - x) / y_m));
double tmp;
if (z <= -2.05e+197) {
tmp = t_0;
} else if (z <= 2.35e+112) {
tmp = t_1;
} else if (z <= 7e+163) {
tmp = Math.abs((x * (z / y_m)));
} else if (z <= 4.5e+178) {
tmp = t_1;
} else if (z <= 6.2e+259) {
tmp = Math.abs((z * (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 * z) / y_m)) t_1 = math.fabs(((-4.0 - x) / y_m)) tmp = 0 if z <= -2.05e+197: tmp = t_0 elif z <= 2.35e+112: tmp = t_1 elif z <= 7e+163: tmp = math.fabs((x * (z / y_m))) elif z <= 4.5e+178: tmp = t_1 elif z <= 6.2e+259: tmp = math.fabs((z * (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 * z) / y_m)) t_1 = abs(Float64(Float64(-4.0 - x) / y_m)) tmp = 0.0 if (z <= -2.05e+197) tmp = t_0; elseif (z <= 2.35e+112) tmp = t_1; elseif (z <= 7e+163) tmp = abs(Float64(x * Float64(z / y_m))); elseif (z <= 4.5e+178) tmp = t_1; elseif (z <= 6.2e+259) tmp = abs(Float64(z * Float64(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 * z) / y_m)); t_1 = abs(((-4.0 - x) / y_m)); tmp = 0.0; if (z <= -2.05e+197) tmp = t_0; elseif (z <= 2.35e+112) tmp = t_1; elseif (z <= 7e+163) tmp = abs((x * (z / y_m))); elseif (z <= 4.5e+178) tmp = t_1; elseif (z <= 6.2e+259) tmp = abs((z * (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 * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -2.05e+197], t$95$0, If[LessEqual[z, 2.35e+112], t$95$1, If[LessEqual[z, 7e+163], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 4.5e+178], t$95$1, If[LessEqual[z, 6.2e+259], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x \cdot z}{y\_m}\right|\\
t_1 := \left|\frac{-4 - x}{y\_m}\right|\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{+197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+163}:\\
\;\;\;\;\left|x \cdot \frac{z}{y\_m}\right|\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+178}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+259}:\\
\;\;\;\;\left|z \cdot \frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.05000000000000015e197 or 6.2000000000000007e259 < z Initial program 81.9%
Simplified96.9%
Taylor expanded in z around inf 90.7%
mul-1-neg90.7%
distribute-frac-neg290.7%
associate-/l*72.7%
Simplified72.7%
associate-*r/90.7%
add-sqr-sqrt49.1%
sqrt-unprod69.3%
sqr-neg69.3%
sqrt-unprod41.3%
add-sqr-sqrt90.7%
Applied egg-rr90.7%
if -2.05000000000000015e197 < z < 2.34999999999999999e112 or 7.0000000000000005e163 < z < 4.4999999999999997e178Initial program 92.4%
Simplified98.8%
Taylor expanded in z around 0 84.3%
+-commutative84.3%
rem-square-sqrt49.0%
fabs-sqr49.0%
rem-square-sqrt84.3%
fabs-neg84.3%
distribute-neg-frac84.3%
distribute-neg-in84.3%
metadata-eval84.3%
+-commutative84.3%
sub-neg84.3%
rem-square-sqrt34.8%
fabs-sqr34.8%
rem-square-sqrt84.3%
Simplified84.3%
if 2.34999999999999999e112 < z < 7.0000000000000005e163Initial program 76.6%
Simplified70.4%
Taylor expanded in z around inf 65.3%
associate-*r/65.3%
neg-mul-165.3%
distribute-rgt-neg-in65.3%
Simplified65.3%
distribute-rgt-neg-out65.3%
distribute-frac-neg65.3%
distribute-frac-neg265.3%
associate-*r/94.6%
*-commutative94.6%
add-sqr-sqrt48.4%
sqrt-unprod57.0%
sqr-neg57.0%
sqrt-unprod45.8%
add-sqr-sqrt94.6%
Applied egg-rr94.6%
if 4.4999999999999997e178 < z < 6.2000000000000007e259Initial program 99.9%
Simplified75.8%
Taylor expanded in z around inf 67.9%
associate-*r/67.9%
neg-mul-167.9%
distribute-rgt-neg-in67.9%
Simplified67.9%
*-commutative67.9%
associate-/l*91.9%
add-sqr-sqrt0.0%
sqrt-unprod28.0%
sqr-neg28.0%
sqrt-unprod91.5%
add-sqr-sqrt91.9%
Applied egg-rr91.9%
Final simplification86.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1e+87) (not (<= x 0.0056))) (fabs (* x (/ (- 1.0 z) y_m))) (fabs (/ (- (+ x 4.0) (* x z)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -1e+87) || !(x <= 0.0056)) {
tmp = fabs((x * ((1.0 - z) / y_m)));
} else {
tmp = fabs((((x + 4.0) - (x * 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 <= (-1d+87)) .or. (.not. (x <= 0.0056d0))) then
tmp = abs((x * ((1.0d0 - z) / y_m)))
else
tmp = abs((((x + 4.0d0) - (x * 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 <= -1e+87) || !(x <= 0.0056)) {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -1e+87) or not (x <= 0.0056): tmp = math.fabs((x * ((1.0 - z) / y_m))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -1e+87) || !(x <= 0.0056)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -1e+87) || ~((x <= 0.0056))) tmp = abs((x * ((1.0 - z) / y_m))); else tmp = abs((((x + 4.0) - (x * z)) / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -1e+87], N[Not[LessEqual[x, 0.0056]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 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|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+87} \lor \neg \left(x \leq 0.0056\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y\_m}\right|\\
\end{array}
\end{array}
if x < -9.9999999999999996e86 or 0.00559999999999999994 < x Initial program 82.6%
Simplified90.5%
Taylor expanded in x around inf 90.5%
*-commutative90.5%
associate-/l*99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r/99.5%
mul-1-neg99.5%
neg-sub099.5%
associate-+l-99.5%
neg-sub099.5%
+-commutative99.5%
unsub-neg99.5%
Simplified99.5%
if -9.9999999999999996e86 < x < 0.00559999999999999994Initial program 96.0%
associate-*l/99.2%
sub-div99.9%
Applied egg-rr99.9%
Final simplification99.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -2e-10) (not (<= x 1.5e-38))) (fabs (* x (/ (- 1.0 z) y_m))) (fabs (* (+ x 4.0) (/ 1.0 y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -2e-10) || !(x <= 1.5e-38)) {
tmp = fabs((x * ((1.0 - z) / y_m)));
} else {
tmp = fabs(((x + 4.0) * (1.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 <= (-2d-10)) .or. (.not. (x <= 1.5d-38))) then
tmp = abs((x * ((1.0d0 - z) / y_m)))
else
tmp = abs(((x + 4.0d0) * (1.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 <= -2e-10) || !(x <= 1.5e-38)) {
tmp = Math.abs((x * ((1.0 - z) / y_m)));
} else {
tmp = Math.abs(((x + 4.0) * (1.0 / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -2e-10) or not (x <= 1.5e-38): tmp = math.fabs((x * ((1.0 - z) / y_m))) else: tmp = math.fabs(((x + 4.0) * (1.0 / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -2e-10) || !(x <= 1.5e-38)) tmp = abs(Float64(x * Float64(Float64(1.0 - z) / y_m))); else tmp = abs(Float64(Float64(x + 4.0) * Float64(1.0 / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -2e-10) || ~((x <= 1.5e-38))) tmp = abs((x * ((1.0 - z) / y_m))); else tmp = abs(((x + 4.0) * (1.0 / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -2e-10], N[Not[LessEqual[x, 1.5e-38]], $MachinePrecision]], N[Abs[N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x + 4.0), $MachinePrecision] * N[(1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-10} \lor \neg \left(x \leq 1.5 \cdot 10^{-38}\right):\\
\;\;\;\;\left|x \cdot \frac{1 - z}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\left(x + 4\right) \cdot \frac{1}{y\_m}\right|\\
\end{array}
\end{array}
if x < -2.00000000000000007e-10 or 1.49999999999999994e-38 < x Initial program 85.8%
Simplified93.0%
Taylor expanded in x around inf 86.9%
*-commutative86.9%
associate-/l*93.5%
associate-*r*93.5%
*-commutative93.5%
associate-*r/93.5%
mul-1-neg93.5%
neg-sub093.5%
associate-+l-93.5%
neg-sub093.5%
+-commutative93.5%
unsub-neg93.5%
Simplified93.5%
if -2.00000000000000007e-10 < x < 1.49999999999999994e-38Initial program 96.5%
Taylor expanded in z around 0 80.4%
div-inv80.4%
distribute-rgt-out80.4%
+-commutative80.4%
Applied egg-rr80.4%
Final simplification87.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -1.7e-9) (not (<= x 3.4e-39))) (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.7e-9) || !(x <= 3.4e-39)) {
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.7d-9)) .or. (.not. (x <= 3.4d-39))) 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.7e-9) || !(x <= 3.4e-39)) {
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.7e-9) or not (x <= 3.4e-39): 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.7e-9) || !(x <= 3.4e-39)) 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.7e-9) || ~((x <= 3.4e-39))) 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.7e-9], N[Not[LessEqual[x, 3.4e-39]], $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.7 \cdot 10^{-9} \lor \neg \left(x \leq 3.4 \cdot 10^{-39}\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.6999999999999999e-9 or 3.3999999999999999e-39 < x Initial program 85.8%
Simplified93.0%
Taylor expanded in x around inf 86.9%
*-commutative86.9%
associate-/l*93.5%
associate-*r*93.5%
*-commutative93.5%
associate-*r/93.5%
mul-1-neg93.5%
neg-sub093.5%
associate-+l-93.5%
neg-sub093.5%
+-commutative93.5%
unsub-neg93.5%
Simplified93.5%
if -1.6999999999999999e-9 < x < 3.3999999999999999e-39Initial program 96.5%
Simplified99.9%
Taylor expanded in z around 0 80.4%
+-commutative80.4%
rem-square-sqrt44.6%
fabs-sqr44.6%
rem-square-sqrt80.4%
fabs-neg80.4%
distribute-neg-frac80.4%
distribute-neg-in80.4%
metadata-eval80.4%
+-commutative80.4%
sub-neg80.4%
rem-square-sqrt35.2%
fabs-sqr35.2%
rem-square-sqrt80.4%
Simplified80.4%
Final simplification87.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -380000000000.0) (not (<= x 1.75e-10))) (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 <= -380000000000.0) || !(x <= 1.75e-10)) {
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 <= (-380000000000.0d0)) .or. (.not. (x <= 1.75d-10))) 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 <= -380000000000.0) || !(x <= 1.75e-10)) {
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 <= -380000000000.0) or not (x <= 1.75e-10): 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 <= -380000000000.0) || !(x <= 1.75e-10)) 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 <= -380000000000.0) || ~((x <= 1.75e-10))) 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, -380000000000.0], N[Not[LessEqual[x, 1.75e-10]], $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 -380000000000 \lor \neg \left(x \leq 1.75 \cdot 10^{-10}\right):\\
\;\;\;\;\left|\frac{x}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y\_m}\right|\\
\end{array}
\end{array}
if x < -3.8e11 or 1.7499999999999999e-10 < x Initial program 83.9%
Taylor expanded in z around 0 63.1%
Taylor expanded in x around inf 61.1%
if -3.8e11 < x < 1.7499999999999999e-10Initial program 96.9%
Simplified99.9%
Taylor expanded in x around 0 74.9%
Final simplification68.1%
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.5%
Simplified96.0%
Taylor expanded in x around 0 41.3%
herbie shell --seed 2024107
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))