
(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 15 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 3.6e-43) (fabs (* (/ -1.0 y_m) (fma x z (- -4.0 x)))) (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 3.6e-43) {
tmp = fabs(((-1.0 / y_m) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 3.6e-43) tmp = abs(Float64(Float64(-1.0 / y_m) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z)))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 3.6e-43], N[Abs[N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 3.6 \cdot 10^{-43}:\\
\;\;\;\;\left|\frac{-1}{y\_m} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|\\
\end{array}
\end{array}
if y < 3.5999999999999999e-43Initial program 87.6%
Simplified98.3%
if 3.5999999999999999e-43 < y Initial program 98.6%
associate-*l/90.8%
associate-*r/99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (+ x 4.0) y_m)) (t_1 (* z (/ x y_m))))
(if (<= (- t_0 t_1) 1e+308)
(fabs (- t_1 t_0))
(fabs (* x (- (/ (+ -1.0 z) y_m) (/ 4.0 (* y_m x))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= 1e+308) {
tmp = fabs((t_1 - t_0));
} else {
tmp = fabs((x * (((-1.0 + z) / y_m) - (4.0 / (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 = (x + 4.0d0) / y_m
t_1 = z * (x / y_m)
if ((t_0 - t_1) <= 1d+308) then
tmp = abs((t_1 - t_0))
else
tmp = abs((x * ((((-1.0d0) + z) / y_m) - (4.0d0 / (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 = (x + 4.0) / y_m;
double t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= 1e+308) {
tmp = Math.abs((t_1 - t_0));
} else {
tmp = Math.abs((x * (((-1.0 + z) / y_m) - (4.0 / (y_m * x)))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m t_1 = z * (x / y_m) tmp = 0 if (t_0 - t_1) <= 1e+308: tmp = math.fabs((t_1 - t_0)) else: tmp = math.fabs((x * (((-1.0 + z) / y_m) - (4.0 / (y_m * x))))) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) t_1 = Float64(z * Float64(x / y_m)) tmp = 0.0 if (Float64(t_0 - t_1) <= 1e+308) tmp = abs(Float64(t_1 - t_0)); else tmp = abs(Float64(x * Float64(Float64(Float64(-1.0 + z) / y_m) - Float64(4.0 / Float64(y_m * x))))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; t_1 = z * (x / y_m); tmp = 0.0; if ((t_0 - t_1) <= 1e+308) tmp = abs((t_1 - t_0)); else tmp = abs((x * (((-1.0 + z) / y_m) - (4.0 / (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[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], 1e+308], N[Abs[N[(t$95$1 - t$95$0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(4.0 / N[(y$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
t_1 := z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 - t\_1 \leq 10^{+308}:\\
\;\;\;\;\left|t\_1 - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \left(\frac{-1 + z}{y\_m} - \frac{4}{y\_m \cdot x}\right)\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < 1e308Initial program 98.4%
if 1e308 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 39.4%
fabs-sub39.4%
associate-*l/69.7%
associate-*r/69.7%
fma-neg81.8%
distribute-neg-frac81.8%
+-commutative81.8%
distribute-neg-in81.8%
unsub-neg81.8%
metadata-eval81.8%
Simplified81.8%
Taylor expanded in x around inf 97.0%
associate--r+97.0%
div-sub97.0%
sub-neg97.0%
remove-double-neg97.0%
neg-mul-197.0%
metadata-eval97.0%
metadata-eval97.0%
distribute-lft-in97.0%
+-commutative97.0%
neg-mul-197.0%
associate-*r/97.0%
Simplified97.0%
Final simplification98.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (/ (+ x 4.0) y_m)) (t_1 (* z (/ x y_m)))) (if (<= (- t_0 t_1) INFINITY) (fabs (- t_1 t_0)) (* x (/ (+ -1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = (x + 4.0) / y_m;
double t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= ((double) INFINITY)) {
tmp = fabs((t_1 - t_0));
} else {
tmp = x * ((-1.0 + z) / y_m);
}
return tmp;
}
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 t_1 = z * (x / y_m);
double tmp;
if ((t_0 - t_1) <= Double.POSITIVE_INFINITY) {
tmp = Math.abs((t_1 - t_0));
} else {
tmp = x * ((-1.0 + z) / y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = (x + 4.0) / y_m t_1 = z * (x / y_m) tmp = 0 if (t_0 - t_1) <= math.inf: tmp = math.fabs((t_1 - t_0)) else: tmp = x * ((-1.0 + z) / y_m) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(x + 4.0) / y_m) t_1 = Float64(z * Float64(x / y_m)) tmp = 0.0 if (Float64(t_0 - t_1) <= Inf) tmp = abs(Float64(t_1 - t_0)); else tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = (x + 4.0) / y_m; t_1 = z * (x / y_m); tmp = 0.0; if ((t_0 - t_1) <= Inf) tmp = abs((t_1 - t_0)); else tmp = x * ((-1.0 + z) / y_m); 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]}, Block[{t$95$1 = N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 - t$95$1), $MachinePrecision], Infinity], N[Abs[N[(t$95$1 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m}\\
t_1 := z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 - t\_1 \leq \infty:\\
\;\;\;\;\left|t\_1 - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < +inf.0Initial program 98.5%
if +inf.0 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 0.0%
fabs-sub0.0%
associate-*l/50.0%
associate-*r/50.0%
fma-neg70.0%
distribute-neg-frac70.0%
+-commutative70.0%
distribute-neg-in70.0%
unsub-neg70.0%
metadata-eval70.0%
Simplified70.0%
add-sqr-sqrt45.0%
fabs-sqr45.0%
add-sqr-sqrt45.0%
fma-undefine30.0%
associate-*r/30.0%
associate-*l/0.0%
div-inv0.0%
sub-neg0.0%
metadata-eval0.0%
distribute-neg-in0.0%
+-commutative0.0%
cancel-sign-sub-inv0.0%
div-inv0.0%
associate-*l/30.0%
sub-div55.0%
Applied egg-rr55.0%
Taylor expanded in x around inf 55.0%
associate-/l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Final simplification95.1%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (- (/ (+ x 4.0) y_m) (/ x (/ y_m z)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
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) / y_m) - (x / (y_m / z))))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((((x + 4.0) / y_m) - (x / (y_m / z))));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((((x + 4.0) / y_m) - (x / (y_m / z))))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(Float64(x + 4.0) / y_m) - Float64(x / Float64(y_m / z)))) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((((x + 4.0) / y_m) - (x / (y_m / z)))); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(x / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{x + 4}{y\_m} - \frac{x}{\frac{y\_m}{z}}\right|
\end{array}
Initial program 90.8%
associate-*l/92.3%
associate-*r/93.8%
clear-num93.8%
un-div-inv93.8%
Applied egg-rr93.8%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -2.6e-12)
(* x (/ (+ -1.0 z) y_m))
(if (<= x 1.75e+116)
(+ (/ (+ x 4.0) y_m) (* (/ -1.0 y_m) (* x z)))
(* (/ x y_m) (+ z 1.0)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1.75e+116) {
tmp = ((x + 4.0) / y_m) + ((-1.0 / y_m) * (x * z));
} else {
tmp = (x / y_m) * (z + 1.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) :: tmp
if (x <= (-2.6d-12)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 1.75d+116) then
tmp = ((x + 4.0d0) / y_m) + (((-1.0d0) / y_m) * (x * z))
else
tmp = (x / y_m) * (z + 1.0d0)
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.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1.75e+116) {
tmp = ((x + 4.0) / y_m) + ((-1.0 / y_m) * (x * z));
} else {
tmp = (x / y_m) * (z + 1.0);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2.6e-12: tmp = x * ((-1.0 + z) / y_m) elif x <= 1.75e+116: tmp = ((x + 4.0) / y_m) + ((-1.0 / y_m) * (x * z)) else: tmp = (x / y_m) * (z + 1.0) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2.6e-12) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 1.75e+116) tmp = Float64(Float64(Float64(x + 4.0) / y_m) + Float64(Float64(-1.0 / y_m) * Float64(x * z))); else tmp = Float64(Float64(x / y_m) * Float64(z + 1.0)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2.6e-12) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 1.75e+116) tmp = ((x + 4.0) / y_m) + ((-1.0 / y_m) * (x * z)); else tmp = (x / y_m) * (z + 1.0); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -2.6e-12], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e+116], N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] + N[(N[(-1.0 / y$95$m), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+116}:\\
\;\;\;\;\frac{x + 4}{y\_m} + \frac{-1}{y\_m} \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -2.59999999999999983e-12Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -2.59999999999999983e-12 < x < 1.74999999999999998e116Initial program 96.8%
Simplified99.8%
add-sqr-sqrt56.7%
fabs-sqr56.7%
add-sqr-sqrt57.7%
fma-undefine57.7%
distribute-rgt-in57.8%
sub-neg57.8%
metadata-eval57.8%
distribute-neg-in57.8%
+-commutative57.8%
frac-2neg57.8%
metadata-eval57.8%
div-inv57.8%
frac-2neg57.8%
Applied egg-rr57.8%
if 1.74999999999999998e116 < x Initial program 82.6%
fabs-sub82.6%
associate-*l/77.6%
associate-*r/90.4%
fma-neg94.2%
distribute-neg-frac94.2%
+-commutative94.2%
distribute-neg-in94.2%
unsub-neg94.2%
metadata-eval94.2%
Simplified94.2%
fma-undefine90.4%
associate-*r/77.6%
associate-*l/82.6%
div-inv82.4%
sub-neg82.4%
metadata-eval82.4%
distribute-neg-in82.4%
+-commutative82.4%
cancel-sign-sub-inv82.4%
div-inv82.6%
fabs-sub82.6%
add-sqr-sqrt32.5%
fabs-sqr32.5%
add-sqr-sqrt33.0%
sub-neg33.0%
distribute-rgt-neg-in33.0%
Applied egg-rr33.0%
Taylor expanded in x around inf 33.0%
*-un-lft-identity33.0%
*-commutative33.0%
distribute-rgt-out42.6%
add-sqr-sqrt21.3%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod19.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
Final simplification53.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -2.6e-12)
(* x (/ (+ -1.0 z) y_m))
(if (<= x 1.05e+116)
(/ (- (+ x 4.0) (* x z)) y_m)
(* (/ x y_m) (+ z 1.0)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1.05e+116) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = (x / y_m) * (z + 1.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) :: tmp
if (x <= (-2.6d-12)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 1.05d+116) then
tmp = ((x + 4.0d0) - (x * z)) / y_m
else
tmp = (x / y_m) * (z + 1.0d0)
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.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1.05e+116) {
tmp = ((x + 4.0) - (x * z)) / y_m;
} else {
tmp = (x / y_m) * (z + 1.0);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2.6e-12: tmp = x * ((-1.0 + z) / y_m) elif x <= 1.05e+116: tmp = ((x + 4.0) - (x * z)) / y_m else: tmp = (x / y_m) * (z + 1.0) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2.6e-12) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 1.05e+116) tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y_m); else tmp = Float64(Float64(x / y_m) * Float64(z + 1.0)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2.6e-12) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 1.05e+116) tmp = ((x + 4.0) - (x * z)) / y_m; else tmp = (x / y_m) * (z + 1.0); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -2.6e-12], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.05e+116], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+116}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -2.59999999999999983e-12Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -2.59999999999999983e-12 < x < 1.0500000000000001e116Initial program 96.8%
fabs-sub96.8%
associate-*l/99.9%
associate-*r/95.8%
fma-neg95.8%
distribute-neg-frac95.8%
+-commutative95.8%
distribute-neg-in95.8%
unsub-neg95.8%
metadata-eval95.8%
Simplified95.8%
fma-undefine95.8%
associate-*r/99.9%
associate-*l/96.8%
div-inv96.7%
sub-neg96.7%
metadata-eval96.7%
distribute-neg-in96.7%
+-commutative96.7%
cancel-sign-sub-inv96.7%
div-inv96.8%
fabs-sub96.8%
add-sqr-sqrt53.9%
fabs-sqr53.9%
add-sqr-sqrt55.0%
associate-*l/57.8%
sub-div57.8%
Applied egg-rr57.8%
if 1.0500000000000001e116 < x Initial program 82.6%
fabs-sub82.6%
associate-*l/77.6%
associate-*r/90.4%
fma-neg94.2%
distribute-neg-frac94.2%
+-commutative94.2%
distribute-neg-in94.2%
unsub-neg94.2%
metadata-eval94.2%
Simplified94.2%
fma-undefine90.4%
associate-*r/77.6%
associate-*l/82.6%
div-inv82.4%
sub-neg82.4%
metadata-eval82.4%
distribute-neg-in82.4%
+-commutative82.4%
cancel-sign-sub-inv82.4%
div-inv82.6%
fabs-sub82.6%
add-sqr-sqrt32.5%
fabs-sqr32.5%
add-sqr-sqrt33.0%
sub-neg33.0%
distribute-rgt-neg-in33.0%
Applied egg-rr33.0%
Taylor expanded in x around inf 33.0%
*-un-lft-identity33.0%
*-commutative33.0%
distribute-rgt-out42.6%
add-sqr-sqrt21.3%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod19.4%
add-sqr-sqrt37.0%
+-commutative37.0%
Applied egg-rr37.0%
Final simplification53.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -2.6e-12) (* x (/ (+ -1.0 z) y_m)) (if (<= x 5.2e-9) (/ (- 4.0 (* x z)) y_m) (* (/ x y_m) (+ z 1.0)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 5.2e-9) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = (x / y_m) * (z + 1.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) :: tmp
if (x <= (-2.6d-12)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 5.2d-9) then
tmp = (4.0d0 - (x * z)) / y_m
else
tmp = (x / y_m) * (z + 1.0d0)
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.6e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 5.2e-9) {
tmp = (4.0 - (x * z)) / y_m;
} else {
tmp = (x / y_m) * (z + 1.0);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2.6e-12: tmp = x * ((-1.0 + z) / y_m) elif x <= 5.2e-9: tmp = (4.0 - (x * z)) / y_m else: tmp = (x / y_m) * (z + 1.0) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2.6e-12) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 5.2e-9) tmp = Float64(Float64(4.0 - Float64(x * z)) / y_m); else tmp = Float64(Float64(x / y_m) * Float64(z + 1.0)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2.6e-12) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 5.2e-9) tmp = (4.0 - (x * z)) / y_m; else tmp = (x / y_m) * (z + 1.0); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -2.6e-12], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e-9], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{4 - x \cdot z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -2.59999999999999983e-12Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -2.59999999999999983e-12 < x < 5.2000000000000002e-9Initial program 96.9%
fabs-sub96.9%
associate-*l/99.9%
associate-*r/95.0%
fma-neg95.0%
distribute-neg-frac95.0%
+-commutative95.0%
distribute-neg-in95.0%
unsub-neg95.0%
metadata-eval95.0%
Simplified95.0%
fma-undefine95.0%
associate-*r/99.9%
associate-*l/96.9%
div-inv96.9%
sub-neg96.9%
metadata-eval96.9%
distribute-neg-in96.9%
+-commutative96.9%
cancel-sign-sub-inv96.9%
div-inv96.9%
fabs-sub96.9%
add-sqr-sqrt53.5%
fabs-sqr53.5%
add-sqr-sqrt54.7%
associate-*l/57.2%
sub-div57.2%
Applied egg-rr57.2%
Taylor expanded in x around 0 57.1%
if 5.2000000000000002e-9 < x Initial program 86.9%
fabs-sub86.9%
associate-*l/84.9%
associate-*r/93.4%
fma-neg96.0%
distribute-neg-frac96.0%
+-commutative96.0%
distribute-neg-in96.0%
unsub-neg96.0%
metadata-eval96.0%
Simplified96.0%
fma-undefine93.4%
associate-*r/84.9%
associate-*l/86.9%
div-inv86.8%
sub-neg86.8%
metadata-eval86.8%
distribute-neg-in86.8%
+-commutative86.8%
cancel-sign-sub-inv86.8%
div-inv86.9%
fabs-sub86.9%
add-sqr-sqrt40.0%
fabs-sqr40.0%
add-sqr-sqrt40.6%
sub-neg40.6%
distribute-rgt-neg-in40.6%
Applied egg-rr40.6%
Taylor expanded in x around inf 37.9%
*-un-lft-identity37.9%
*-commutative37.9%
distribute-rgt-out45.6%
add-sqr-sqrt20.2%
sqrt-unprod30.7%
sqr-neg30.7%
sqrt-unprod17.8%
add-sqr-sqrt32.1%
+-commutative32.1%
Applied egg-rr32.1%
Final simplification49.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.32e-14) (* x (/ (+ -1.0 z) y_m)) (if (<= x 2.95e+16) (/ (+ x 4.0) y_m) (* (/ x y_m) (+ z 1.0)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.32e-14) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 2.95e+16) {
tmp = (x + 4.0) / y_m;
} else {
tmp = (x / y_m) * (z + 1.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) :: tmp
if (x <= (-1.32d-14)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 2.95d+16) then
tmp = (x + 4.0d0) / y_m
else
tmp = (x / y_m) * (z + 1.0d0)
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.32e-14) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 2.95e+16) {
tmp = (x + 4.0) / y_m;
} else {
tmp = (x / y_m) * (z + 1.0);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.32e-14: tmp = x * ((-1.0 + z) / y_m) elif x <= 2.95e+16: tmp = (x + 4.0) / y_m else: tmp = (x / y_m) * (z + 1.0) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.32e-14) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 2.95e+16) tmp = Float64(Float64(x + 4.0) / y_m); else tmp = Float64(Float64(x / y_m) * Float64(z + 1.0)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.32e-14) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 2.95e+16) tmp = (x + 4.0) / y_m; else tmp = (x / y_m) * (z + 1.0); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.32e-14], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.95e+16], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{+16}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m} \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.32e-14Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -1.32e-14 < x < 2.95e16Initial program 97.1%
fabs-sub97.1%
associate-*l/99.9%
associate-*r/95.3%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
fma-undefine95.3%
associate-*r/99.9%
associate-*l/97.1%
div-inv97.1%
sub-neg97.1%
metadata-eval97.1%
distribute-neg-in97.1%
+-commutative97.1%
cancel-sign-sub-inv97.1%
div-inv97.1%
fabs-sub97.1%
add-sqr-sqrt54.1%
fabs-sqr54.1%
add-sqr-sqrt55.3%
associate-*l/57.6%
sub-div57.6%
Applied egg-rr57.6%
Taylor expanded in z around 0 42.9%
if 2.95e16 < x Initial program 85.4%
fabs-sub85.4%
associate-*l/83.2%
associate-*r/92.7%
fma-neg95.6%
distribute-neg-frac95.6%
+-commutative95.6%
distribute-neg-in95.6%
unsub-neg95.6%
metadata-eval95.6%
Simplified95.6%
fma-undefine92.7%
associate-*r/83.2%
associate-*l/85.4%
div-inv85.3%
sub-neg85.3%
metadata-eval85.3%
distribute-neg-in85.3%
+-commutative85.3%
cancel-sign-sub-inv85.3%
div-inv85.4%
fabs-sub85.4%
add-sqr-sqrt37.4%
fabs-sqr37.4%
add-sqr-sqrt38.0%
sub-neg38.0%
distribute-rgt-neg-in38.0%
Applied egg-rr38.0%
Taylor expanded in x around inf 38.0%
*-un-lft-identity38.0%
*-commutative38.0%
distribute-rgt-out46.7%
add-sqr-sqrt22.0%
sqrt-unprod31.4%
sqr-neg31.4%
sqrt-unprod17.6%
add-sqr-sqrt32.5%
+-commutative32.5%
Applied egg-rr32.5%
Final simplification43.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -2.5e-12) (* x (/ (+ -1.0 z) y_m)) (if (<= x 1020000.0) (/ (+ x 4.0) y_m) (* x (/ (- 1.0 z) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.5e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1020000.0) {
tmp = (x + 4.0) / y_m;
} else {
tmp = x * ((1.0 - z) / y_m);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.5d-12)) then
tmp = x * (((-1.0d0) + z) / y_m)
else if (x <= 1020000.0d0) then
tmp = (x + 4.0d0) / y_m
else
tmp = x * ((1.0d0 - z) / y_m)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -2.5e-12) {
tmp = x * ((-1.0 + z) / y_m);
} else if (x <= 1020000.0) {
tmp = (x + 4.0) / y_m;
} else {
tmp = x * ((1.0 - z) / y_m);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2.5e-12: tmp = x * ((-1.0 + z) / y_m) elif x <= 1020000.0: tmp = (x + 4.0) / y_m else: tmp = x * ((1.0 - z) / y_m) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2.5e-12) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); elseif (x <= 1020000.0) tmp = Float64(Float64(x + 4.0) / y_m); else tmp = Float64(x * Float64(Float64(1.0 - z) / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2.5e-12) tmp = x * ((-1.0 + z) / y_m); elseif (x <= 1020000.0) tmp = (x + 4.0) / y_m; else tmp = x * ((1.0 - z) / y_m); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -2.5e-12], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1020000.0], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{elif}\;x \leq 1020000:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y\_m}\\
\end{array}
\end{array}
if x < -2.49999999999999985e-12Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -2.49999999999999985e-12 < x < 1.02e6Initial program 97.1%
fabs-sub97.1%
associate-*l/99.9%
associate-*r/95.2%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
fma-undefine95.2%
associate-*r/99.9%
associate-*l/97.1%
div-inv97.1%
sub-neg97.1%
metadata-eval97.1%
distribute-neg-in97.1%
+-commutative97.1%
cancel-sign-sub-inv97.1%
div-inv97.1%
fabs-sub97.1%
add-sqr-sqrt54.2%
fabs-sqr54.2%
add-sqr-sqrt55.3%
associate-*l/57.7%
sub-div57.7%
Applied egg-rr57.7%
Taylor expanded in z around 0 42.8%
if 1.02e6 < x Initial program 85.8%
fabs-sub85.8%
associate-*l/83.6%
associate-*r/92.9%
fma-neg95.7%
distribute-neg-frac95.7%
+-commutative95.7%
distribute-neg-in95.7%
unsub-neg95.7%
metadata-eval95.7%
Simplified95.7%
fma-undefine92.9%
associate-*r/83.6%
associate-*l/85.8%
div-inv85.7%
sub-neg85.7%
metadata-eval85.7%
distribute-neg-in85.7%
+-commutative85.7%
cancel-sign-sub-inv85.7%
div-inv85.8%
fabs-sub85.8%
add-sqr-sqrt37.7%
fabs-sqr37.7%
add-sqr-sqrt38.4%
sub-neg38.4%
distribute-rgt-neg-in38.4%
Applied egg-rr38.4%
Taylor expanded in x around -inf 46.8%
mul-1-neg46.8%
div-sub46.8%
associate-/l*40.1%
sub-neg40.1%
metadata-eval40.1%
distribute-lft-in40.1%
*-commutative40.1%
neg-mul-140.1%
remove-double-neg40.1%
distribute-rgt-neg-in40.1%
mul-1-neg40.1%
distribute-lft-neg-in40.1%
*-rgt-identity40.1%
distribute-lft-in40.1%
neg-mul-140.1%
+-commutative40.1%
associate-*r*40.1%
associate-*r/40.1%
mul-1-neg40.1%
distribute-neg-frac240.1%
Simplified46.8%
Final simplification47.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -1.52) (/ x (- y_m)) (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.52) {
tmp = x / -y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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.52d0)) then
tmp = x / -y_m
else if (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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.52) {
tmp = x / -y_m;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.52: tmp = x / -y_m elif x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.52) tmp = Float64(x / Float64(-y_m)); elseif (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.52) tmp = x / -y_m; elseif (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.52], N[(x / (-y$95$m)), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52:\\
\;\;\;\;\frac{x}{-y\_m}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < -1.52Initial program 84.0%
fabs-sub84.0%
associate-*l/87.5%
associate-*r/91.9%
fma-neg95.1%
distribute-neg-frac95.1%
+-commutative95.1%
distribute-neg-in95.1%
unsub-neg95.1%
metadata-eval95.1%
Simplified95.1%
add-sqr-sqrt56.9%
fabs-sqr56.9%
add-sqr-sqrt57.3%
fma-undefine54.1%
associate-*r/49.7%
associate-*l/47.8%
div-inv47.8%
sub-neg47.8%
metadata-eval47.8%
distribute-neg-in47.8%
+-commutative47.8%
cancel-sign-sub-inv47.8%
div-inv47.8%
associate-*l/49.7%
sub-div54.4%
Applied egg-rr54.4%
Taylor expanded in z around 0 36.5%
associate-*r/36.5%
distribute-lft-in36.5%
metadata-eval36.5%
neg-mul-136.5%
sub-neg36.5%
Simplified36.5%
Taylor expanded in x around inf 36.5%
neg-mul-136.5%
Simplified36.5%
if -1.52 < x < 4Initial program 97.0%
fabs-sub97.0%
associate-*l/99.9%
associate-*r/95.1%
fma-neg95.1%
distribute-neg-frac95.1%
+-commutative95.1%
distribute-neg-in95.1%
unsub-neg95.1%
metadata-eval95.1%
Simplified95.1%
fma-undefine95.1%
associate-*r/99.9%
associate-*l/97.0%
div-inv97.0%
sub-neg97.0%
metadata-eval97.0%
distribute-neg-in97.0%
+-commutative97.0%
cancel-sign-sub-inv97.0%
div-inv97.0%
fabs-sub97.0%
add-sqr-sqrt54.2%
fabs-sqr54.2%
add-sqr-sqrt55.4%
associate-*l/57.9%
sub-div57.9%
Applied egg-rr57.9%
Taylor expanded in x around 0 41.1%
if 4 < x Initial program 86.4%
fabs-sub86.4%
associate-*l/84.3%
associate-*r/93.2%
fma-neg95.9%
distribute-neg-frac95.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
metadata-eval95.9%
Simplified95.9%
fma-undefine93.2%
associate-*r/84.3%
associate-*l/86.4%
div-inv86.3%
sub-neg86.3%
metadata-eval86.3%
distribute-neg-in86.3%
+-commutative86.3%
cancel-sign-sub-inv86.3%
div-inv86.4%
fabs-sub86.4%
add-sqr-sqrt38.9%
fabs-sqr38.9%
add-sqr-sqrt39.5%
sub-neg39.5%
distribute-rgt-neg-in39.5%
Applied egg-rr39.5%
Taylor expanded in x around -inf 46.0%
mul-1-neg46.0%
div-sub46.0%
associate-/l*39.6%
sub-neg39.6%
metadata-eval39.6%
distribute-lft-in39.6%
*-commutative39.6%
neg-mul-139.6%
remove-double-neg39.6%
distribute-rgt-neg-in39.6%
mul-1-neg39.6%
distribute-lft-neg-in39.6%
*-rgt-identity39.6%
distribute-lft-in39.6%
neg-mul-139.6%
+-commutative39.6%
associate-*r*39.6%
associate-*r/39.6%
mul-1-neg39.6%
distribute-neg-frac239.6%
Simplified46.0%
Taylor expanded in z around 0 22.8%
Final simplification34.7%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -5.2e-14) (* x (/ (+ -1.0 z) y_m)) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5.2e-14) {
tmp = x * ((-1.0 + z) / y_m);
} else {
tmp = (x + 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 <= (-5.2d-14)) then
tmp = x * (((-1.0d0) + z) / y_m)
else
tmp = (x + 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 <= -5.2e-14) {
tmp = x * ((-1.0 + z) / y_m);
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -5.2e-14: tmp = x * ((-1.0 + z) / y_m) else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -5.2e-14) tmp = Float64(x * Float64(Float64(-1.0 + z) / y_m)); else tmp = Float64(Float64(x + 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 <= -5.2e-14) tmp = x * ((-1.0 + z) / y_m); else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -5.2e-14], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -5.19999999999999993e-14Initial program 84.3%
fabs-sub84.3%
associate-*l/87.7%
associate-*r/92.0%
fma-neg95.2%
distribute-neg-frac95.2%
+-commutative95.2%
distribute-neg-in95.2%
unsub-neg95.2%
metadata-eval95.2%
Simplified95.2%
add-sqr-sqrt56.0%
fabs-sqr56.0%
add-sqr-sqrt56.4%
fma-undefine53.3%
associate-*r/48.9%
associate-*l/47.1%
div-inv47.0%
sub-neg47.0%
metadata-eval47.0%
distribute-neg-in47.0%
+-commutative47.0%
cancel-sign-sub-inv47.0%
div-inv47.1%
associate-*l/48.9%
sub-div53.6%
Applied egg-rr53.6%
Taylor expanded in x around inf 53.6%
associate-/l*57.9%
sub-neg57.9%
metadata-eval57.9%
Simplified57.9%
if -5.19999999999999993e-14 < x Initial program 92.9%
fabs-sub92.9%
associate-*l/93.9%
associate-*r/94.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
fma-undefine94.4%
associate-*r/93.9%
associate-*l/92.9%
div-inv92.9%
sub-neg92.9%
metadata-eval92.9%
distribute-neg-in92.9%
+-commutative92.9%
cancel-sign-sub-inv92.9%
div-inv92.9%
fabs-sub92.9%
add-sqr-sqrt48.1%
fabs-sqr48.1%
add-sqr-sqrt49.1%
associate-*l/49.7%
sub-div51.2%
Applied egg-rr51.2%
Taylor expanded in z around 0 35.4%
Final simplification41.0%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -4.0) (/ x (- y_m)) (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -4.0) {
tmp = x / -y_m;
} else {
tmp = (x + 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 <= (-4.0d0)) then
tmp = x / -y_m
else
tmp = (x + 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 <= -4.0) {
tmp = x / -y_m;
} else {
tmp = (x + 4.0) / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -4.0: tmp = x / -y_m else: tmp = (x + 4.0) / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(x / Float64(-y_m)); else tmp = Float64(Float64(x + 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 <= -4.0) tmp = x / -y_m; else tmp = (x + 4.0) / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -4.0], N[(x / (-y$95$m)), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{x}{-y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y\_m}\\
\end{array}
\end{array}
if x < -4Initial program 84.0%
fabs-sub84.0%
associate-*l/87.5%
associate-*r/91.9%
fma-neg95.1%
distribute-neg-frac95.1%
+-commutative95.1%
distribute-neg-in95.1%
unsub-neg95.1%
metadata-eval95.1%
Simplified95.1%
add-sqr-sqrt56.9%
fabs-sqr56.9%
add-sqr-sqrt57.3%
fma-undefine54.1%
associate-*r/49.7%
associate-*l/47.8%
div-inv47.8%
sub-neg47.8%
metadata-eval47.8%
distribute-neg-in47.8%
+-commutative47.8%
cancel-sign-sub-inv47.8%
div-inv47.8%
associate-*l/49.7%
sub-div54.4%
Applied egg-rr54.4%
Taylor expanded in z around 0 36.5%
associate-*r/36.5%
distribute-lft-in36.5%
metadata-eval36.5%
neg-mul-136.5%
sub-neg36.5%
Simplified36.5%
Taylor expanded in x around inf 36.5%
neg-mul-136.5%
Simplified36.5%
if -4 < x Initial program 93.0%
fabs-sub93.0%
associate-*l/93.9%
associate-*r/94.4%
fma-neg95.4%
distribute-neg-frac95.4%
+-commutative95.4%
distribute-neg-in95.4%
unsub-neg95.4%
metadata-eval95.4%
Simplified95.4%
fma-undefine94.4%
associate-*r/93.9%
associate-*l/93.0%
div-inv92.9%
sub-neg92.9%
metadata-eval92.9%
distribute-neg-in92.9%
+-commutative92.9%
cancel-sign-sub-inv92.9%
div-inv93.0%
fabs-sub93.0%
add-sqr-sqrt48.3%
fabs-sqr48.3%
add-sqr-sqrt49.3%
associate-*l/49.9%
sub-div51.5%
Applied egg-rr51.5%
Taylor expanded in z around 0 35.2%
Final simplification35.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x 4.0) (/ 4.0 y_m) (/ x y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = 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 <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = 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 <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = x / y_m;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= 4.0: tmp = 4.0 / y_m else: tmp = x / y_m return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = Float64(x / y_m); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= 4.0) tmp = 4.0 / y_m; else tmp = x / y_m; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], N[(x / y$95$m), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y\_m}\\
\end{array}
\end{array}
if x < 4Initial program 92.5%
fabs-sub92.5%
associate-*l/95.6%
associate-*r/94.0%
fma-neg95.1%
distribute-neg-frac95.1%
+-commutative95.1%
distribute-neg-in95.1%
unsub-neg95.1%
metadata-eval95.1%
Simplified95.1%
fma-undefine94.0%
associate-*r/95.6%
associate-*l/92.5%
div-inv92.5%
sub-neg92.5%
metadata-eval92.5%
distribute-neg-in92.5%
+-commutative92.5%
cancel-sign-sub-inv92.5%
div-inv92.5%
fabs-sub92.5%
add-sqr-sqrt48.1%
fabs-sqr48.1%
add-sqr-sqrt49.0%
associate-*l/51.2%
sub-div52.3%
Applied egg-rr52.3%
Taylor expanded in x around 0 28.1%
if 4 < x Initial program 86.4%
fabs-sub86.4%
associate-*l/84.3%
associate-*r/93.2%
fma-neg95.9%
distribute-neg-frac95.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
metadata-eval95.9%
Simplified95.9%
fma-undefine93.2%
associate-*r/84.3%
associate-*l/86.4%
div-inv86.3%
sub-neg86.3%
metadata-eval86.3%
distribute-neg-in86.3%
+-commutative86.3%
cancel-sign-sub-inv86.3%
div-inv86.4%
fabs-sub86.4%
add-sqr-sqrt38.9%
fabs-sqr38.9%
add-sqr-sqrt39.5%
sub-neg39.5%
distribute-rgt-neg-in39.5%
Applied egg-rr39.5%
Taylor expanded in x around -inf 46.0%
mul-1-neg46.0%
div-sub46.0%
associate-/l*39.6%
sub-neg39.6%
metadata-eval39.6%
distribute-lft-in39.6%
*-commutative39.6%
neg-mul-139.6%
remove-double-neg39.6%
distribute-rgt-neg-in39.6%
mul-1-neg39.6%
distribute-lft-neg-in39.6%
*-rgt-identity39.6%
distribute-lft-in39.6%
neg-mul-139.6%
+-commutative39.6%
associate-*r*39.6%
associate-*r/39.6%
mul-1-neg39.6%
distribute-neg-frac239.6%
Simplified46.0%
Taylor expanded in z around 0 22.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ 4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return 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 = 4.0d0 / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return 4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return 4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = 4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{4}{y\_m}
\end{array}
Initial program 90.8%
fabs-sub90.8%
associate-*l/92.3%
associate-*r/93.8%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
fma-undefine93.8%
associate-*r/92.3%
associate-*l/90.8%
div-inv90.7%
sub-neg90.7%
metadata-eval90.7%
distribute-neg-in90.7%
+-commutative90.7%
cancel-sign-sub-inv90.7%
div-inv90.8%
fabs-sub90.8%
add-sqr-sqrt45.4%
fabs-sqr45.4%
add-sqr-sqrt46.3%
associate-*l/47.1%
sub-div49.1%
Applied egg-rr49.1%
Taylor expanded in x around 0 20.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ -4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return -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 = (-4.0d0) / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return -4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return -4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(-4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = -4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(-4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{-4}{y\_m}
\end{array}
Initial program 90.8%
fabs-sub90.8%
associate-*l/92.3%
associate-*r/93.8%
fma-neg95.3%
distribute-neg-frac95.3%
+-commutative95.3%
distribute-neg-in95.3%
unsub-neg95.3%
metadata-eval95.3%
Simplified95.3%
add-sqr-sqrt48.1%
fabs-sqr48.1%
add-sqr-sqrt49.1%
fma-undefine47.9%
associate-*r/46.5%
associate-*l/45.8%
div-inv45.8%
sub-neg45.8%
metadata-eval45.8%
distribute-neg-in45.8%
+-commutative45.8%
cancel-sign-sub-inv45.8%
div-inv45.8%
associate-*l/46.5%
sub-div48.4%
Applied egg-rr48.4%
Taylor expanded in x around 0 17.6%
herbie shell --seed 2024137
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))