
(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}
(FPCore (x y z) :precision binary64 (if (or (<= x -13.5) (not (<= x 1.7e+37))) (fabs (* (+ -1.0 z) (/ x y))) (fabs (* (/ -1.0 y) (fma x z (- -4.0 x))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -13.5) || !(x <= 1.7e+37)) {
tmp = fabs(((-1.0 + z) * (x / y)));
} else {
tmp = fabs(((-1.0 / y) * fma(x, z, (-4.0 - x))));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -13.5) || !(x <= 1.7e+37)) tmp = abs(Float64(Float64(-1.0 + z) * Float64(x / y))); else tmp = abs(Float64(Float64(-1.0 / y) * fma(x, z, Float64(-4.0 - x)))); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -13.5], N[Not[LessEqual[x, 1.7e+37]], $MachinePrecision]], N[Abs[N[(N[(-1.0 + z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-1.0 / y), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -13.5 \lor \neg \left(x \leq 1.7 \cdot 10^{+37}\right):\\
\;\;\;\;\left|\left(-1 + z\right) \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\end{array}
\end{array}
if x < -13.5 or 1.70000000000000003e37 < x Initial program 85.0%
fabs-sub85.0%
associate-*l/81.4%
associate-*r/89.2%
fma-neg92.5%
distribute-neg-frac92.5%
+-commutative92.5%
distribute-neg-in92.5%
unsub-neg92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in x around inf 99.8%
div-sub99.8%
*-commutative99.8%
associate-*l/92.2%
associate-/l*99.9%
sub-neg99.9%
remove-double-neg99.9%
neg-mul-199.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-in99.9%
+-commutative99.9%
distribute-lft-in99.9%
metadata-eval99.9%
neg-mul-199.9%
remove-double-neg99.9%
Simplified99.9%
if -13.5 < x < 1.70000000000000003e37Initial program 93.6%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fabs (- (/ (+ x 4.0) y) (* z (/ x y)))))) (if (<= t_0 1e+306) t_0 (fabs (* (+ -1.0 z) (/ x y))))))
double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if (t_0 <= 1e+306) {
tmp = t_0;
} else {
tmp = fabs(((-1.0 + z) * (x / y)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((((x + 4.0d0) / y) - (z * (x / y))))
if (t_0 <= 1d+306) then
tmp = t_0
else
tmp = abs((((-1.0d0) + z) * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((((x + 4.0) / y) - (z * (x / y))));
double tmp;
if (t_0 <= 1e+306) {
tmp = t_0;
} else {
tmp = Math.abs(((-1.0 + z) * (x / y)));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((((x + 4.0) / y) - (z * (x / y)))) tmp = 0 if t_0 <= 1e+306: tmp = t_0 else: tmp = math.fabs(((-1.0 + z) * (x / y))) return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))) tmp = 0.0 if (t_0 <= 1e+306) tmp = t_0; else tmp = abs(Float64(Float64(-1.0 + z) * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((((x + 4.0) / y) - (z * (x / y)))); tmp = 0.0; if (t_0 <= 1e+306) tmp = t_0; else tmp = abs(((-1.0 + z) * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 1e+306], t$95$0, N[Abs[N[(N[(-1.0 + z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{if}\;t\_0 \leq 10^{+306}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\left(-1 + z\right) \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 1.00000000000000002e306Initial program 95.3%
if 1.00000000000000002e306 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 73.9%
fabs-sub73.9%
associate-*l/81.2%
associate-*r/81.2%
fma-neg87.0%
distribute-neg-frac87.0%
+-commutative87.0%
distribute-neg-in87.0%
unsub-neg87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in x around inf 100.0%
div-sub100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
sub-neg100.0%
remove-double-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
distribute-lft-in100.0%
+-commutative100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification96.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.3e-45) (fabs (* (/ -1.0 y) (fma x z (- -4.0 x)))) (fabs (fma x (/ z y) (/ (- -4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.3e-45) {
tmp = fabs(((-1.0 / y) * fma(x, z, (-4.0 - x))));
} else {
tmp = fabs(fma(x, (z / y), ((-4.0 - x) / y)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.3e-45) tmp = abs(Float64(Float64(-1.0 / y) * fma(x, z, Float64(-4.0 - x)))); else tmp = abs(fma(x, Float64(z / y), Float64(Float64(-4.0 - x) / y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.3e-45], N[Abs[N[(N[(-1.0 / y), $MachinePrecision] * N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.3 \cdot 10^{-45}:\\
\;\;\;\;\left|\frac{-1}{y} \cdot \mathsf{fma}\left(x, z, -4 - x\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y}, \frac{-4 - x}{y}\right)\right|\\
\end{array}
\end{array}
if y < 1.29999999999999993e-45Initial program 87.0%
Simplified98.3%
if 1.29999999999999993e-45 < y Initial program 96.1%
fabs-sub96.1%
associate-*l/90.8%
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%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.16e-23) (not (<= x 1.06e-17))) (fabs (* (+ -1.0 z) (/ x y))) (+ (/ (+ x 4.0) y) (* (/ -1.0 y) (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.16e-23) || !(x <= 1.06e-17)) {
tmp = fabs(((-1.0 + z) * (x / y)));
} else {
tmp = ((x + 4.0) / y) + ((-1.0 / y) * (x * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.16d-23)) .or. (.not. (x <= 1.06d-17))) then
tmp = abs((((-1.0d0) + z) * (x / y)))
else
tmp = ((x + 4.0d0) / y) + (((-1.0d0) / y) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.16e-23) || !(x <= 1.06e-17)) {
tmp = Math.abs(((-1.0 + z) * (x / y)));
} else {
tmp = ((x + 4.0) / y) + ((-1.0 / y) * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.16e-23) or not (x <= 1.06e-17): tmp = math.fabs(((-1.0 + z) * (x / y))) else: tmp = ((x + 4.0) / y) + ((-1.0 / y) * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.16e-23) || !(x <= 1.06e-17)) tmp = abs(Float64(Float64(-1.0 + z) * Float64(x / y))); else tmp = Float64(Float64(Float64(x + 4.0) / y) + Float64(Float64(-1.0 / y) * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.16e-23) || ~((x <= 1.06e-17))) tmp = abs(((-1.0 + z) * (x / y))); else tmp = ((x + 4.0) / y) + ((-1.0 / y) * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.16e-23], N[Not[LessEqual[x, 1.06e-17]], $MachinePrecision]], N[Abs[N[(N[(-1.0 + z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] + N[(N[(-1.0 / y), $MachinePrecision] * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.16 \cdot 10^{-23} \lor \neg \left(x \leq 1.06 \cdot 10^{-17}\right):\\
\;\;\;\;\left|\left(-1 + z\right) \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y} + \frac{-1}{y} \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.1599999999999999e-23 or 1.06000000000000006e-17 < x Initial program 86.1%
fabs-sub86.1%
associate-*l/82.8%
associate-*r/90.0%
fma-neg93.0%
distribute-neg-frac93.0%
+-commutative93.0%
distribute-neg-in93.0%
unsub-neg93.0%
metadata-eval93.0%
Simplified93.0%
Taylor expanded in x around inf 97.9%
div-sub97.9%
*-commutative97.9%
associate-*l/90.8%
associate-/l*98.0%
sub-neg98.0%
remove-double-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
distribute-lft-in98.0%
+-commutative98.0%
distribute-lft-in98.0%
metadata-eval98.0%
neg-mul-198.0%
remove-double-neg98.0%
Simplified98.0%
if -1.1599999999999999e-23 < x < 1.06000000000000006e-17Initial program 93.1%
Simplified99.9%
add-sqr-sqrt51.6%
fabs-sqr51.6%
add-sqr-sqrt52.8%
fma-undefine52.8%
distribute-rgt-in52.8%
sub-neg52.8%
metadata-eval52.8%
distribute-neg-in52.8%
+-commutative52.8%
frac-2neg52.8%
metadata-eval52.8%
div-inv52.8%
frac-2neg52.8%
Applied egg-rr52.8%
Final simplification75.9%
(FPCore (x y z)
:precision binary64
(if (<= x -2.2e+241)
(/ (- x) y)
(if (<= x -2150.0)
(* x (/ (+ -1.0 z) y))
(if (<= x 4.0) (/ (- 4.0 (* x z)) y) (* x (/ (- 1.0 z) y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.2e+241) {
tmp = -x / y;
} else if (x <= -2150.0) {
tmp = x * ((-1.0 + z) / y);
} else if (x <= 4.0) {
tmp = (4.0 - (x * z)) / y;
} else {
tmp = x * ((1.0 - z) / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2.2d+241)) then
tmp = -x / y
else if (x <= (-2150.0d0)) then
tmp = x * (((-1.0d0) + z) / y)
else if (x <= 4.0d0) then
tmp = (4.0d0 - (x * z)) / y
else
tmp = x * ((1.0d0 - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.2e+241) {
tmp = -x / y;
} else if (x <= -2150.0) {
tmp = x * ((-1.0 + z) / y);
} else if (x <= 4.0) {
tmp = (4.0 - (x * z)) / y;
} else {
tmp = x * ((1.0 - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.2e+241: tmp = -x / y elif x <= -2150.0: tmp = x * ((-1.0 + z) / y) elif x <= 4.0: tmp = (4.0 - (x * z)) / y else: tmp = x * ((1.0 - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.2e+241) tmp = Float64(Float64(-x) / y); elseif (x <= -2150.0) tmp = Float64(x * Float64(Float64(-1.0 + z) / y)); elseif (x <= 4.0) tmp = Float64(Float64(4.0 - Float64(x * z)) / y); else tmp = Float64(x * Float64(Float64(1.0 - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.2e+241) tmp = -x / y; elseif (x <= -2150.0) tmp = x * ((-1.0 + z) / y); elseif (x <= 4.0) tmp = (4.0 - (x * z)) / y; else tmp = x * ((1.0 - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.2e+241], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -2150.0], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(N[(4.0 - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+241}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -2150:\\
\;\;\;\;x \cdot \frac{-1 + z}{y}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4 - x \cdot z}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y}\\
\end{array}
\end{array}
if x < -2.2e241Initial program 70.0%
fabs-sub70.0%
associate-*l/56.0%
associate-*r/70.0%
fma-neg80.0%
distribute-neg-frac80.0%
+-commutative80.0%
distribute-neg-in80.0%
unsub-neg80.0%
metadata-eval80.0%
Simplified80.0%
add-sqr-sqrt39.7%
fabs-sqr39.7%
add-sqr-sqrt40.1%
fma-undefine35.1%
associate-*r/30.4%
associate-*l/35.1%
div-inv35.1%
sub-neg35.1%
metadata-eval35.1%
distribute-neg-in35.1%
+-commutative35.1%
cancel-sign-sub-inv35.1%
div-inv35.1%
associate-*l/30.4%
sub-div50.4%
Applied egg-rr50.4%
Taylor expanded in x around inf 50.4%
Taylor expanded in z around 0 30.8%
neg-mul-130.8%
distribute-neg-frac30.8%
Simplified30.8%
if -2.2e241 < x < -2150Initial program 95.1%
fabs-sub95.1%
associate-*l/95.4%
associate-*r/99.9%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.0%
fma-undefine48.0%
associate-*r/45.7%
associate-*l/45.6%
div-inv45.5%
sub-neg45.5%
metadata-eval45.5%
distribute-neg-in45.5%
+-commutative45.5%
cancel-sign-sub-inv45.5%
div-inv45.6%
associate-*l/45.7%
sub-div45.7%
Applied egg-rr45.7%
Taylor expanded in x around inf 45.7%
associate-/l*48.0%
sub-neg48.0%
metadata-eval48.0%
Simplified48.0%
if -2150 < x < 4Initial program 93.4%
fabs-sub93.4%
associate-*l/99.9%
associate-*r/91.4%
fma-neg91.4%
distribute-neg-frac91.4%
+-commutative91.4%
distribute-neg-in91.4%
unsub-neg91.4%
metadata-eval91.4%
Simplified91.4%
fma-undefine91.4%
associate-*r/99.9%
associate-*l/93.4%
div-inv93.4%
sub-neg93.4%
metadata-eval93.4%
distribute-neg-in93.4%
+-commutative93.4%
cancel-sign-sub-inv93.4%
div-inv93.4%
fabs-sub93.4%
add-sqr-sqrt46.8%
fabs-sqr46.8%
add-sqr-sqrt48.0%
associate-*l/52.3%
sub-div52.3%
Applied egg-rr52.3%
Taylor expanded in x around 0 51.5%
if 4 < x Initial program 83.7%
fabs-sub83.7%
associate-*l/81.1%
associate-*r/88.6%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
fma-undefine88.6%
associate-*r/81.1%
associate-*l/83.7%
div-inv83.6%
sub-neg83.6%
metadata-eval83.6%
distribute-neg-in83.6%
+-commutative83.6%
cancel-sign-sub-inv83.6%
div-inv83.7%
fabs-sub83.7%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt43.7%
sub-neg43.7%
distribute-rgt-neg-in43.7%
Applied egg-rr43.7%
Taylor expanded in x around -inf 47.5%
mul-1-neg47.5%
div-sub47.5%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.1%
neg-mul-143.1%
sub-neg43.1%
*-lft-identity43.1%
sub-neg43.1%
distribute-rgt-in43.1%
*-rgt-identity43.1%
remove-double-neg43.1%
*-commutative43.1%
mul-1-neg43.1%
associate-*r*43.1%
neg-mul-143.1%
distribute-rgt-neg-in43.1%
mul-1-neg43.1%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified47.5%
Final simplification48.3%
(FPCore (x y z)
:precision binary64
(if (<= x -1.25e+242)
(/ (- x) y)
(if (<= x -2e-21)
(* x (/ (+ -1.0 z) y))
(if (<= x 7400000000000.0) (/ (+ x 4.0) y) (* x (/ (- 1.0 z) y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+242) {
tmp = -x / y;
} else if (x <= -2e-21) {
tmp = x * ((-1.0 + z) / y);
} else if (x <= 7400000000000.0) {
tmp = (x + 4.0) / y;
} else {
tmp = x * ((1.0 - z) / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.25d+242)) then
tmp = -x / y
else if (x <= (-2d-21)) then
tmp = x * (((-1.0d0) + z) / y)
else if (x <= 7400000000000.0d0) then
tmp = (x + 4.0d0) / y
else
tmp = x * ((1.0d0 - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.25e+242) {
tmp = -x / y;
} else if (x <= -2e-21) {
tmp = x * ((-1.0 + z) / y);
} else if (x <= 7400000000000.0) {
tmp = (x + 4.0) / y;
} else {
tmp = x * ((1.0 - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.25e+242: tmp = -x / y elif x <= -2e-21: tmp = x * ((-1.0 + z) / y) elif x <= 7400000000000.0: tmp = (x + 4.0) / y else: tmp = x * ((1.0 - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.25e+242) tmp = Float64(Float64(-x) / y); elseif (x <= -2e-21) tmp = Float64(x * Float64(Float64(-1.0 + z) / y)); elseif (x <= 7400000000000.0) tmp = Float64(Float64(x + 4.0) / y); else tmp = Float64(x * Float64(Float64(1.0 - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.25e+242) tmp = -x / y; elseif (x <= -2e-21) tmp = x * ((-1.0 + z) / y); elseif (x <= 7400000000000.0) tmp = (x + 4.0) / y; else tmp = x * ((1.0 - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.25e+242], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -2e-21], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7400000000000.0], N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision], N[(x * N[(N[(1.0 - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+242}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y}\\
\mathbf{elif}\;x \leq 7400000000000:\\
\;\;\;\;\frac{x + 4}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - z}{y}\\
\end{array}
\end{array}
if x < -1.2500000000000001e242Initial program 70.0%
fabs-sub70.0%
associate-*l/56.0%
associate-*r/70.0%
fma-neg80.0%
distribute-neg-frac80.0%
+-commutative80.0%
distribute-neg-in80.0%
unsub-neg80.0%
metadata-eval80.0%
Simplified80.0%
add-sqr-sqrt39.7%
fabs-sqr39.7%
add-sqr-sqrt40.1%
fma-undefine35.1%
associate-*r/30.4%
associate-*l/35.1%
div-inv35.1%
sub-neg35.1%
metadata-eval35.1%
distribute-neg-in35.1%
+-commutative35.1%
cancel-sign-sub-inv35.1%
div-inv35.1%
associate-*l/30.4%
sub-div50.4%
Applied egg-rr50.4%
Taylor expanded in x around inf 50.4%
Taylor expanded in z around 0 30.8%
neg-mul-130.8%
distribute-neg-frac30.8%
Simplified30.8%
if -1.2500000000000001e242 < x < -1.99999999999999982e-21Initial program 95.7%
fabs-sub95.7%
associate-*l/95.9%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
add-sqr-sqrt47.7%
fabs-sqr47.7%
add-sqr-sqrt48.5%
fma-undefine48.5%
associate-*r/46.4%
associate-*l/46.3%
div-inv46.3%
sub-neg46.3%
metadata-eval46.3%
distribute-neg-in46.3%
+-commutative46.3%
cancel-sign-sub-inv46.3%
div-inv46.3%
associate-*l/46.4%
sub-div46.4%
Applied egg-rr46.4%
Taylor expanded in x around inf 46.7%
associate-/l*48.7%
sub-neg48.7%
metadata-eval48.7%
Simplified48.7%
if -1.99999999999999982e-21 < x < 7.4e12Initial program 93.3%
fabs-sub93.3%
associate-*l/99.9%
associate-*r/91.2%
fma-neg91.2%
distribute-neg-frac91.2%
+-commutative91.2%
distribute-neg-in91.2%
unsub-neg91.2%
metadata-eval91.2%
Simplified91.2%
fma-undefine91.2%
associate-*r/99.9%
associate-*l/93.3%
div-inv93.3%
sub-neg93.3%
metadata-eval93.3%
distribute-neg-in93.3%
+-commutative93.3%
cancel-sign-sub-inv93.3%
div-inv93.3%
fabs-sub93.3%
add-sqr-sqrt46.3%
fabs-sqr46.3%
add-sqr-sqrt47.6%
associate-*l/51.9%
sub-div51.9%
Applied egg-rr51.9%
Taylor expanded in z around 0 36.9%
if 7.4e12 < x Initial program 82.9%
fabs-sub82.9%
associate-*l/80.1%
associate-*r/88.0%
fma-neg91.4%
distribute-neg-frac91.4%
+-commutative91.4%
distribute-neg-in91.4%
unsub-neg91.4%
metadata-eval91.4%
Simplified91.4%
fma-undefine88.0%
associate-*r/80.1%
associate-*l/82.9%
div-inv82.8%
sub-neg82.8%
metadata-eval82.8%
distribute-neg-in82.8%
+-commutative82.8%
cancel-sign-sub-inv82.8%
div-inv82.9%
fabs-sub82.9%
add-sqr-sqrt43.9%
fabs-sqr43.9%
add-sqr-sqrt44.2%
sub-neg44.2%
distribute-rgt-neg-in44.2%
Applied egg-rr44.2%
Taylor expanded in x around -inf 49.2%
mul-1-neg49.2%
div-sub49.2%
associate-/l*44.6%
sub-neg44.6%
metadata-eval44.6%
distribute-rgt-in44.6%
neg-mul-144.6%
sub-neg44.6%
*-lft-identity44.6%
sub-neg44.6%
distribute-rgt-in44.6%
*-rgt-identity44.6%
remove-double-neg44.6%
*-commutative44.6%
mul-1-neg44.6%
associate-*r*44.6%
neg-mul-144.6%
distribute-rgt-neg-in44.6%
mul-1-neg44.6%
distribute-lft-in44.6%
+-commutative44.6%
distribute-lft-neg-in44.6%
Simplified49.2%
Final simplification41.5%
(FPCore (x y z)
:precision binary64
(if (<= x -7.6e+241)
(/ (- x) y)
(if (<= x -14.5)
(- (* x (/ z y)) (/ (+ x 4.0) y))
(/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e+241) {
tmp = -x / y;
} else if (x <= -14.5) {
tmp = (x * (z / y)) - ((x + 4.0) / y);
} else {
tmp = ((x + 4.0) - (x * z)) / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-7.6d+241)) then
tmp = -x / y
else if (x <= (-14.5d0)) then
tmp = (x * (z / y)) - ((x + 4.0d0) / y)
else
tmp = ((x + 4.0d0) - (x * z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -7.6e+241) {
tmp = -x / y;
} else if (x <= -14.5) {
tmp = (x * (z / y)) - ((x + 4.0) / y);
} else {
tmp = ((x + 4.0) - (x * z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -7.6e+241: tmp = -x / y elif x <= -14.5: tmp = (x * (z / y)) - ((x + 4.0) / y) else: tmp = ((x + 4.0) - (x * z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -7.6e+241) tmp = Float64(Float64(-x) / y); elseif (x <= -14.5) tmp = Float64(Float64(x * Float64(z / y)) - Float64(Float64(x + 4.0) / y)); else tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -7.6e+241) tmp = -x / y; elseif (x <= -14.5) tmp = (x * (z / y)) - ((x + 4.0) / y); else tmp = ((x + 4.0) - (x * z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -7.6e+241], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -14.5], N[(N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+241}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -14.5:\\
\;\;\;\;x \cdot \frac{z}{y} - \frac{x + 4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\
\end{array}
\end{array}
if x < -7.59999999999999944e241Initial program 70.0%
fabs-sub70.0%
associate-*l/56.0%
associate-*r/70.0%
fma-neg80.0%
distribute-neg-frac80.0%
+-commutative80.0%
distribute-neg-in80.0%
unsub-neg80.0%
metadata-eval80.0%
Simplified80.0%
add-sqr-sqrt39.7%
fabs-sqr39.7%
add-sqr-sqrt40.1%
fma-undefine35.1%
associate-*r/30.4%
associate-*l/35.1%
div-inv35.1%
sub-neg35.1%
metadata-eval35.1%
distribute-neg-in35.1%
+-commutative35.1%
cancel-sign-sub-inv35.1%
div-inv35.1%
associate-*l/30.4%
sub-div50.4%
Applied egg-rr50.4%
Taylor expanded in x around inf 50.4%
Taylor expanded in z around 0 30.8%
neg-mul-130.8%
distribute-neg-frac30.8%
Simplified30.8%
if -7.59999999999999944e241 < x < -14.5Initial program 95.1%
fabs-sub95.1%
associate-*l/95.4%
associate-*r/99.9%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.0%
fma-undefine48.0%
associate-*r/45.7%
associate-*l/45.6%
div-inv45.5%
sub-neg45.5%
metadata-eval45.5%
distribute-neg-in45.5%
+-commutative45.5%
cancel-sign-sub-inv45.5%
div-inv45.6%
associate-*l/45.7%
associate-*r/48.0%
Applied egg-rr48.0%
if -14.5 < x Initial program 90.3%
fabs-sub90.3%
associate-*l/93.9%
associate-*r/90.5%
fma-neg91.5%
distribute-neg-frac91.5%
+-commutative91.5%
distribute-neg-in91.5%
unsub-neg91.5%
metadata-eval91.5%
Simplified91.5%
fma-undefine90.5%
associate-*r/93.9%
associate-*l/90.3%
div-inv90.3%
sub-neg90.3%
metadata-eval90.3%
distribute-neg-in90.3%
+-commutative90.3%
cancel-sign-sub-inv90.3%
div-inv90.3%
fabs-sub90.3%
add-sqr-sqrt45.7%
fabs-sqr45.7%
add-sqr-sqrt46.6%
associate-*l/48.6%
sub-div49.6%
Applied egg-rr49.6%
(FPCore (x y z) :precision binary64 (if (<= x -8.6e+241) (/ (- x) y) (if (<= x -22.0) (* x (/ (+ -1.0 z) y)) (/ (- (+ x 4.0) (* x z)) y))))
double code(double x, double y, double z) {
double tmp;
if (x <= -8.6e+241) {
tmp = -x / y;
} else if (x <= -22.0) {
tmp = x * ((-1.0 + z) / y);
} else {
tmp = ((x + 4.0) - (x * z)) / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-8.6d+241)) then
tmp = -x / y
else if (x <= (-22.0d0)) then
tmp = x * (((-1.0d0) + z) / y)
else
tmp = ((x + 4.0d0) - (x * z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -8.6e+241) {
tmp = -x / y;
} else if (x <= -22.0) {
tmp = x * ((-1.0 + z) / y);
} else {
tmp = ((x + 4.0) - (x * z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -8.6e+241: tmp = -x / y elif x <= -22.0: tmp = x * ((-1.0 + z) / y) else: tmp = ((x + 4.0) - (x * z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -8.6e+241) tmp = Float64(Float64(-x) / y); elseif (x <= -22.0) tmp = Float64(x * Float64(Float64(-1.0 + z) / y)); else tmp = Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -8.6e+241) tmp = -x / y; elseif (x <= -22.0) tmp = x * ((-1.0 + z) / y); else tmp = ((x + 4.0) - (x * z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -8.6e+241], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -22.0], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{+241}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -22:\\
\;\;\;\;x \cdot \frac{-1 + z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 4\right) - x \cdot z}{y}\\
\end{array}
\end{array}
if x < -8.60000000000000008e241Initial program 70.0%
fabs-sub70.0%
associate-*l/56.0%
associate-*r/70.0%
fma-neg80.0%
distribute-neg-frac80.0%
+-commutative80.0%
distribute-neg-in80.0%
unsub-neg80.0%
metadata-eval80.0%
Simplified80.0%
add-sqr-sqrt39.7%
fabs-sqr39.7%
add-sqr-sqrt40.1%
fma-undefine35.1%
associate-*r/30.4%
associate-*l/35.1%
div-inv35.1%
sub-neg35.1%
metadata-eval35.1%
distribute-neg-in35.1%
+-commutative35.1%
cancel-sign-sub-inv35.1%
div-inv35.1%
associate-*l/30.4%
sub-div50.4%
Applied egg-rr50.4%
Taylor expanded in x around inf 50.4%
Taylor expanded in z around 0 30.8%
neg-mul-130.8%
distribute-neg-frac30.8%
Simplified30.8%
if -8.60000000000000008e241 < x < -22Initial program 95.1%
fabs-sub95.1%
associate-*l/95.4%
associate-*r/99.9%
fma-neg100.0%
distribute-neg-frac100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
add-sqr-sqrt47.4%
fabs-sqr47.4%
add-sqr-sqrt48.0%
fma-undefine48.0%
associate-*r/45.7%
associate-*l/45.6%
div-inv45.5%
sub-neg45.5%
metadata-eval45.5%
distribute-neg-in45.5%
+-commutative45.5%
cancel-sign-sub-inv45.5%
div-inv45.6%
associate-*l/45.7%
sub-div45.7%
Applied egg-rr45.7%
Taylor expanded in x around inf 45.7%
associate-/l*48.0%
sub-neg48.0%
metadata-eval48.0%
Simplified48.0%
if -22 < x Initial program 90.3%
fabs-sub90.3%
associate-*l/93.9%
associate-*r/90.5%
fma-neg91.5%
distribute-neg-frac91.5%
+-commutative91.5%
distribute-neg-in91.5%
unsub-neg91.5%
metadata-eval91.5%
Simplified91.5%
fma-undefine90.5%
associate-*r/93.9%
associate-*l/90.3%
div-inv90.3%
sub-neg90.3%
metadata-eval90.3%
distribute-neg-in90.3%
+-commutative90.3%
cancel-sign-sub-inv90.3%
div-inv90.3%
fabs-sub90.3%
add-sqr-sqrt45.7%
fabs-sqr45.7%
add-sqr-sqrt46.6%
associate-*l/48.6%
sub-div49.6%
Applied egg-rr49.6%
Final simplification47.9%
(FPCore (x y z) :precision binary64 (if (<= x -4.2e+31) (/ (- x) y) (if (<= x -2.7e-21) (* x (/ z y)) (if (<= x 4.0) (/ 4.0 y) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+31) {
tmp = -x / y;
} else if (x <= -2.7e-21) {
tmp = x * (z / y);
} else if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-4.2d+31)) then
tmp = -x / y
else if (x <= (-2.7d-21)) then
tmp = x * (z / y)
else if (x <= 4.0d0) then
tmp = 4.0d0 / y
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e+31) {
tmp = -x / y;
} else if (x <= -2.7e-21) {
tmp = x * (z / y);
} else if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.2e+31: tmp = -x / y elif x <= -2.7e-21: tmp = x * (z / y) elif x <= 4.0: tmp = 4.0 / y else: tmp = x / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.2e+31) tmp = Float64(Float64(-x) / y); elseif (x <= -2.7e-21) tmp = Float64(x * Float64(z / y)); elseif (x <= 4.0) tmp = Float64(4.0 / y); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.2e+31) tmp = -x / y; elseif (x <= -2.7e-21) tmp = x * (z / y); elseif (x <= 4.0) tmp = 4.0 / y; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.2e+31], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -2.7e-21], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+31}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \frac{z}{y}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.19999999999999958e31Initial program 85.9%
fabs-sub85.9%
associate-*l/81.2%
associate-*r/89.4%
fma-neg93.0%
distribute-neg-frac93.0%
+-commutative93.0%
distribute-neg-in93.0%
unsub-neg93.0%
metadata-eval93.0%
Simplified93.0%
add-sqr-sqrt43.6%
fabs-sqr43.6%
add-sqr-sqrt44.2%
fma-undefine42.4%
associate-*r/39.2%
associate-*l/40.6%
div-inv40.6%
sub-neg40.6%
metadata-eval40.6%
distribute-neg-in40.6%
+-commutative40.6%
cancel-sign-sub-inv40.6%
div-inv40.6%
associate-*l/39.2%
sub-div46.2%
Applied egg-rr46.2%
Taylor expanded in x around inf 46.2%
Taylor expanded in z around 0 31.7%
neg-mul-131.7%
distribute-neg-frac31.7%
Simplified31.7%
if -4.19999999999999958e31 < x < -2.7000000000000001e-21Initial program 99.7%
fabs-sub99.7%
associate-*l/99.3%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
add-sqr-sqrt54.4%
fabs-sqr54.4%
add-sqr-sqrt55.5%
fma-undefine55.5%
associate-*r/55.0%
associate-*l/55.5%
div-inv55.5%
sub-neg55.5%
metadata-eval55.5%
distribute-neg-in55.5%
+-commutative55.5%
cancel-sign-sub-inv55.5%
div-inv55.5%
associate-*l/55.0%
sub-div55.0%
Applied egg-rr55.0%
Taylor expanded in x around inf 56.1%
Taylor expanded in z around inf 55.0%
associate-*r/55.4%
Simplified55.4%
if -2.7000000000000001e-21 < x < 4Initial program 93.1%
fabs-sub93.1%
associate-*l/99.9%
associate-*r/91.0%
fma-neg91.0%
distribute-neg-frac91.0%
+-commutative91.0%
distribute-neg-in91.0%
unsub-neg91.0%
metadata-eval91.0%
Simplified91.0%
fma-undefine91.0%
associate-*r/99.9%
associate-*l/93.1%
div-inv93.1%
sub-neg93.1%
metadata-eval93.1%
distribute-neg-in93.1%
+-commutative93.1%
cancel-sign-sub-inv93.1%
div-inv93.1%
fabs-sub93.1%
add-sqr-sqrt46.7%
fabs-sqr46.7%
add-sqr-sqrt47.9%
associate-*l/52.4%
sub-div52.4%
Applied egg-rr52.4%
Taylor expanded in x around 0 37.0%
if 4 < x Initial program 83.7%
fabs-sub83.7%
associate-*l/81.1%
associate-*r/88.6%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
fma-undefine88.6%
associate-*r/81.1%
associate-*l/83.7%
div-inv83.6%
sub-neg83.6%
metadata-eval83.6%
distribute-neg-in83.6%
+-commutative83.6%
cancel-sign-sub-inv83.6%
div-inv83.7%
fabs-sub83.7%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt43.7%
sub-neg43.7%
distribute-rgt-neg-in43.7%
Applied egg-rr43.7%
Taylor expanded in x around -inf 47.5%
mul-1-neg47.5%
div-sub47.5%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.1%
neg-mul-143.1%
sub-neg43.1%
*-lft-identity43.1%
sub-neg43.1%
distribute-rgt-in43.1%
*-rgt-identity43.1%
remove-double-neg43.1%
*-commutative43.1%
mul-1-neg43.1%
associate-*r*43.1%
neg-mul-143.1%
distribute-rgt-neg-in43.1%
mul-1-neg43.1%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified47.5%
Taylor expanded in z around 0 35.9%
(FPCore (x y z) :precision binary64 (if (<= x -3.4e+242) (/ (- x) y) (if (<= x -1.4e-21) (* x (/ (+ -1.0 z) y)) (/ (+ x 4.0) y))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e+242) {
tmp = -x / y;
} else if (x <= -1.4e-21) {
tmp = x * ((-1.0 + z) / y);
} else {
tmp = (x + 4.0) / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-3.4d+242)) then
tmp = -x / y
else if (x <= (-1.4d-21)) then
tmp = x * (((-1.0d0) + z) / y)
else
tmp = (x + 4.0d0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.4e+242) {
tmp = -x / y;
} else if (x <= -1.4e-21) {
tmp = x * ((-1.0 + z) / y);
} else {
tmp = (x + 4.0) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.4e+242: tmp = -x / y elif x <= -1.4e-21: tmp = x * ((-1.0 + z) / y) else: tmp = (x + 4.0) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.4e+242) tmp = Float64(Float64(-x) / y); elseif (x <= -1.4e-21) tmp = Float64(x * Float64(Float64(-1.0 + z) / y)); else tmp = Float64(Float64(x + 4.0) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.4e+242) tmp = -x / y; elseif (x <= -1.4e-21) tmp = x * ((-1.0 + z) / y); else tmp = (x + 4.0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.4e+242], N[((-x) / y), $MachinePrecision], If[LessEqual[x, -1.4e-21], N[(x * N[(N[(-1.0 + z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+242}:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \frac{-1 + z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y}\\
\end{array}
\end{array}
if x < -3.39999999999999982e242Initial program 70.0%
fabs-sub70.0%
associate-*l/56.0%
associate-*r/70.0%
fma-neg80.0%
distribute-neg-frac80.0%
+-commutative80.0%
distribute-neg-in80.0%
unsub-neg80.0%
metadata-eval80.0%
Simplified80.0%
add-sqr-sqrt39.7%
fabs-sqr39.7%
add-sqr-sqrt40.1%
fma-undefine35.1%
associate-*r/30.4%
associate-*l/35.1%
div-inv35.1%
sub-neg35.1%
metadata-eval35.1%
distribute-neg-in35.1%
+-commutative35.1%
cancel-sign-sub-inv35.1%
div-inv35.1%
associate-*l/30.4%
sub-div50.4%
Applied egg-rr50.4%
Taylor expanded in x around inf 50.4%
Taylor expanded in z around 0 30.8%
neg-mul-130.8%
distribute-neg-frac30.8%
Simplified30.8%
if -3.39999999999999982e242 < x < -1.40000000000000002e-21Initial program 95.7%
fabs-sub95.7%
associate-*l/95.9%
associate-*r/99.9%
fma-neg99.9%
distribute-neg-frac99.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
metadata-eval99.9%
Simplified99.9%
add-sqr-sqrt47.7%
fabs-sqr47.7%
add-sqr-sqrt48.5%
fma-undefine48.5%
associate-*r/46.4%
associate-*l/46.3%
div-inv46.3%
sub-neg46.3%
metadata-eval46.3%
distribute-neg-in46.3%
+-commutative46.3%
cancel-sign-sub-inv46.3%
div-inv46.3%
associate-*l/46.4%
sub-div46.4%
Applied egg-rr46.4%
Taylor expanded in x around inf 46.7%
associate-/l*48.7%
sub-neg48.7%
metadata-eval48.7%
Simplified48.7%
if -1.40000000000000002e-21 < x Initial program 90.0%
fabs-sub90.0%
associate-*l/93.7%
associate-*r/90.2%
fma-neg91.3%
distribute-neg-frac91.3%
+-commutative91.3%
distribute-neg-in91.3%
unsub-neg91.3%
metadata-eval91.3%
Simplified91.3%
fma-undefine90.2%
associate-*r/93.7%
associate-*l/90.0%
div-inv90.0%
sub-neg90.0%
metadata-eval90.0%
distribute-neg-in90.0%
+-commutative90.0%
cancel-sign-sub-inv90.0%
div-inv90.0%
fabs-sub90.0%
add-sqr-sqrt45.6%
fabs-sqr45.6%
add-sqr-sqrt46.5%
associate-*l/48.6%
sub-div49.6%
Applied egg-rr49.6%
Taylor expanded in z around 0 36.9%
Final simplification38.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.5) (/ (- x) y) (if (<= x 4.0) (/ 4.0 y) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5) {
tmp = -x / y;
} else if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.5d0)) then
tmp = -x / y
else if (x <= 4.0d0) then
tmp = 4.0d0 / y
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.5) {
tmp = -x / y;
} else if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5: tmp = -x / y elif x <= 4.0: tmp = 4.0 / y else: tmp = x / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5) tmp = Float64(Float64(-x) / y); elseif (x <= 4.0) tmp = Float64(4.0 / y); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.5) tmp = -x / y; elseif (x <= 4.0) tmp = 4.0 / y; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5], N[((-x) / y), $MachinePrecision], If[LessEqual[x, 4.0], N[(4.0 / y), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.5Initial program 87.2%
fabs-sub87.2%
associate-*l/82.9%
associate-*r/90.4%
fma-neg93.6%
distribute-neg-frac93.6%
+-commutative93.6%
distribute-neg-in93.6%
unsub-neg93.6%
metadata-eval93.6%
Simplified93.6%
add-sqr-sqrt45.8%
fabs-sqr45.8%
add-sqr-sqrt46.3%
fma-undefine44.7%
associate-*r/41.7%
associate-*l/43.1%
div-inv43.1%
sub-neg43.1%
metadata-eval43.1%
distribute-neg-in43.1%
+-commutative43.1%
cancel-sign-sub-inv43.1%
div-inv43.1%
associate-*l/41.7%
sub-div48.1%
Applied egg-rr48.1%
Taylor expanded in x around inf 48.1%
Taylor expanded in z around 0 29.1%
neg-mul-129.1%
distribute-neg-frac29.1%
Simplified29.1%
if -1.5 < x < 4Initial program 93.4%
fabs-sub93.4%
associate-*l/99.9%
associate-*r/91.3%
fma-neg91.3%
distribute-neg-frac91.3%
+-commutative91.3%
distribute-neg-in91.3%
unsub-neg91.3%
metadata-eval91.3%
Simplified91.3%
fma-undefine91.3%
associate-*r/99.9%
associate-*l/93.4%
div-inv93.4%
sub-neg93.4%
metadata-eval93.4%
distribute-neg-in93.4%
+-commutative93.4%
cancel-sign-sub-inv93.4%
div-inv93.4%
fabs-sub93.4%
add-sqr-sqrt47.1%
fabs-sqr47.1%
add-sqr-sqrt48.4%
associate-*l/52.6%
sub-div52.7%
Applied egg-rr52.7%
Taylor expanded in x around 0 36.4%
if 4 < x Initial program 83.7%
fabs-sub83.7%
associate-*l/81.1%
associate-*r/88.6%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
fma-undefine88.6%
associate-*r/81.1%
associate-*l/83.7%
div-inv83.6%
sub-neg83.6%
metadata-eval83.6%
distribute-neg-in83.6%
+-commutative83.6%
cancel-sign-sub-inv83.6%
div-inv83.7%
fabs-sub83.7%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt43.7%
sub-neg43.7%
distribute-rgt-neg-in43.7%
Applied egg-rr43.7%
Taylor expanded in x around -inf 47.5%
mul-1-neg47.5%
div-sub47.5%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.1%
neg-mul-143.1%
sub-neg43.1%
*-lft-identity43.1%
sub-neg43.1%
distribute-rgt-in43.1%
*-rgt-identity43.1%
remove-double-neg43.1%
*-commutative43.1%
mul-1-neg43.1%
associate-*r*43.1%
neg-mul-143.1%
distribute-rgt-neg-in43.1%
mul-1-neg43.1%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified47.5%
Taylor expanded in z around 0 35.9%
(FPCore (x y z) :precision binary64 (if (<= x -4.0) (/ (- x) y) (/ (+ x 4.0) y)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.0) {
tmp = -x / y;
} else {
tmp = (x + 4.0) / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-4.0d0)) then
tmp = -x / y
else
tmp = (x + 4.0d0) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4.0) {
tmp = -x / y;
} else {
tmp = (x + 4.0) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.0: tmp = -x / y else: tmp = (x + 4.0) / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.0) tmp = Float64(Float64(-x) / y); else tmp = Float64(Float64(x + 4.0) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.0) tmp = -x / y; else tmp = (x + 4.0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.0], N[((-x) / y), $MachinePrecision], N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4:\\
\;\;\;\;\frac{-x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + 4}{y}\\
\end{array}
\end{array}
if x < -4Initial program 87.2%
fabs-sub87.2%
associate-*l/82.9%
associate-*r/90.4%
fma-neg93.6%
distribute-neg-frac93.6%
+-commutative93.6%
distribute-neg-in93.6%
unsub-neg93.6%
metadata-eval93.6%
Simplified93.6%
add-sqr-sqrt45.8%
fabs-sqr45.8%
add-sqr-sqrt46.3%
fma-undefine44.7%
associate-*r/41.7%
associate-*l/43.1%
div-inv43.1%
sub-neg43.1%
metadata-eval43.1%
distribute-neg-in43.1%
+-commutative43.1%
cancel-sign-sub-inv43.1%
div-inv43.1%
associate-*l/41.7%
sub-div48.1%
Applied egg-rr48.1%
Taylor expanded in x around inf 48.1%
Taylor expanded in z around 0 29.1%
neg-mul-129.1%
distribute-neg-frac29.1%
Simplified29.1%
if -4 < x Initial program 90.3%
fabs-sub90.3%
associate-*l/93.9%
associate-*r/90.4%
fma-neg91.5%
distribute-neg-frac91.5%
+-commutative91.5%
distribute-neg-in91.5%
unsub-neg91.5%
metadata-eval91.5%
Simplified91.5%
fma-undefine90.4%
associate-*r/93.9%
associate-*l/90.3%
div-inv90.2%
sub-neg90.2%
metadata-eval90.2%
distribute-neg-in90.2%
+-commutative90.2%
cancel-sign-sub-inv90.2%
div-inv90.3%
fabs-sub90.3%
add-sqr-sqrt45.9%
fabs-sqr45.9%
add-sqr-sqrt46.9%
associate-*l/48.8%
sub-div49.9%
Applied egg-rr49.9%
Taylor expanded in z around 0 37.1%
Final simplification35.1%
(FPCore (x y z) :precision binary64 (if (<= x 4.0) (/ 4.0 y) (/ x y)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 4.0d0) then
tmp = 4.0d0 / y
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.0) {
tmp = 4.0 / y;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.0: tmp = 4.0 / y else: tmp = x / y return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.0) tmp = Float64(4.0 / y); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.0) tmp = 4.0 / y; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.0], N[(4.0 / y), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4:\\
\;\;\;\;\frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < 4Initial program 91.4%
fabs-sub91.4%
associate-*l/94.4%
associate-*r/91.0%
fma-neg92.1%
distribute-neg-frac92.1%
+-commutative92.1%
distribute-neg-in92.1%
unsub-neg92.1%
metadata-eval92.1%
Simplified92.1%
fma-undefine91.0%
associate-*r/94.4%
associate-*l/91.4%
div-inv91.4%
sub-neg91.4%
metadata-eval91.4%
distribute-neg-in91.4%
+-commutative91.4%
cancel-sign-sub-inv91.4%
div-inv91.4%
fabs-sub91.4%
add-sqr-sqrt46.2%
fabs-sqr46.2%
add-sqr-sqrt47.2%
associate-*l/49.1%
sub-div50.1%
Applied egg-rr50.1%
Taylor expanded in x around 0 25.6%
if 4 < x Initial program 83.7%
fabs-sub83.7%
associate-*l/81.1%
associate-*r/88.6%
fma-neg91.8%
distribute-neg-frac91.8%
+-commutative91.8%
distribute-neg-in91.8%
unsub-neg91.8%
metadata-eval91.8%
Simplified91.8%
fma-undefine88.6%
associate-*r/81.1%
associate-*l/83.7%
div-inv83.6%
sub-neg83.6%
metadata-eval83.6%
distribute-neg-in83.6%
+-commutative83.6%
cancel-sign-sub-inv83.6%
div-inv83.7%
fabs-sub83.7%
add-sqr-sqrt43.4%
fabs-sqr43.4%
add-sqr-sqrt43.7%
sub-neg43.7%
distribute-rgt-neg-in43.7%
Applied egg-rr43.7%
Taylor expanded in x around -inf 47.5%
mul-1-neg47.5%
div-sub47.5%
associate-/l*43.2%
sub-neg43.2%
metadata-eval43.2%
distribute-rgt-in43.1%
neg-mul-143.1%
sub-neg43.1%
*-lft-identity43.1%
sub-neg43.1%
distribute-rgt-in43.1%
*-rgt-identity43.1%
remove-double-neg43.1%
*-commutative43.1%
mul-1-neg43.1%
associate-*r*43.1%
neg-mul-143.1%
distribute-rgt-neg-in43.1%
mul-1-neg43.1%
distribute-lft-in43.2%
+-commutative43.2%
distribute-lft-neg-in43.2%
Simplified47.5%
Taylor expanded in z around 0 35.9%
(FPCore (x y z) :precision binary64 (/ 4.0 y))
double code(double x, double y, double z) {
return 4.0 / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 4.0d0 / y
end function
public static double code(double x, double y, double z) {
return 4.0 / y;
}
def code(x, y, z): return 4.0 / y
function code(x, y, z) return Float64(4.0 / y) end
function tmp = code(x, y, z) tmp = 4.0 / y; end
code[x_, y_, z_] := N[(4.0 / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{y}
\end{array}
Initial program 89.5%
fabs-sub89.5%
associate-*l/91.2%
associate-*r/90.4%
fma-neg92.0%
distribute-neg-frac92.0%
+-commutative92.0%
distribute-neg-in92.0%
unsub-neg92.0%
metadata-eval92.0%
Simplified92.0%
fma-undefine90.4%
associate-*r/91.2%
associate-*l/89.5%
div-inv89.5%
sub-neg89.5%
metadata-eval89.5%
distribute-neg-in89.5%
+-commutative89.5%
cancel-sign-sub-inv89.5%
div-inv89.5%
fabs-sub89.5%
add-sqr-sqrt45.5%
fabs-sqr45.5%
add-sqr-sqrt46.3%
associate-*l/47.1%
sub-div48.7%
Applied egg-rr48.7%
Taylor expanded in x around 0 20.3%
(FPCore (x y z) :precision binary64 (/ -4.0 y))
double code(double x, double y, double z) {
return -4.0 / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (-4.0d0) / y
end function
public static double code(double x, double y, double z) {
return -4.0 / y;
}
def code(x, y, z): return -4.0 / y
function code(x, y, z) return Float64(-4.0 / y) end
function tmp = code(x, y, z) tmp = -4.0 / y; end
code[x_, y_, z_] := N[(-4.0 / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{-4}{y}
\end{array}
Initial program 89.5%
fabs-sub89.5%
associate-*l/91.2%
associate-*r/90.4%
fma-neg92.0%
distribute-neg-frac92.0%
+-commutative92.0%
distribute-neg-in92.0%
unsub-neg92.0%
metadata-eval92.0%
Simplified92.0%
add-sqr-sqrt43.9%
fabs-sqr43.9%
add-sqr-sqrt44.8%
fma-undefine44.5%
associate-*r/45.2%
associate-*l/44.4%
div-inv44.4%
sub-neg44.4%
metadata-eval44.4%
distribute-neg-in44.4%
+-commutative44.4%
cancel-sign-sub-inv44.4%
div-inv44.4%
associate-*l/45.2%
sub-div48.7%
Applied egg-rr48.7%
Taylor expanded in x around 0 18.9%
herbie shell --seed 2024132
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))