
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 4e-64) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (/ x (/ y z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 4e-64) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 (y <= 4d-64) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x / (y / z))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 4e-64) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 4e-64: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x / (y / z)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 4e-64) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(x / Float64(y / z)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 4e-64) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x / (y / z)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 4e-64], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{-64}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if y < 3.99999999999999986e-64Initial program 86.0%
associate-*l/89.9%
sub-div97.8%
Applied egg-rr97.8%
if 3.99999999999999986e-64 < y Initial program 99.3%
Simplified99.9%
Final simplification98.5%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (* x (/ z y)))))
(if (<= x -9.5e+77)
t_0
(if (<= x -2.5e-15)
t_1
(if (<= x 4.0) (fabs (/ 4.0 y)) (if (<= x 3.1e+255) t_0 t_1))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double t_1 = fabs((x * (z / y)));
double tmp;
if (x <= -9.5e+77) {
tmp = t_0;
} else if (x <= -2.5e-15) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if (x <= 3.1e+255) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y should be positive before calling this function
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) :: t_1
real(8) :: tmp
t_0 = abs((x / y))
t_1 = abs((x * (z / y)))
if (x <= (-9.5d+77)) then
tmp = t_0
else if (x <= (-2.5d-15)) then
tmp = t_1
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if (x <= 3.1d+255) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double t_1 = Math.abs((x * (z / y)));
double tmp;
if (x <= -9.5e+77) {
tmp = t_0;
} else if (x <= -2.5e-15) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if (x <= 3.1e+255) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((x * (z / y))) tmp = 0 if x <= -9.5e+77: tmp = t_0 elif x <= -2.5e-15: tmp = t_1 elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif x <= 3.1e+255: tmp = t_0 else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(x * Float64(z / y))) tmp = 0.0 if (x <= -9.5e+77) tmp = t_0; elseif (x <= -2.5e-15) tmp = t_1; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif (x <= 3.1e+255) tmp = t_0; else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); t_1 = abs((x * (z / y))); tmp = 0.0; if (x <= -9.5e+77) tmp = t_0; elseif (x <= -2.5e-15) tmp = t_1; elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif (x <= 3.1e+255) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -9.5e+77], t$95$0, If[LessEqual[x, -2.5e-15], t$95$1, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 3.1e+255], t$95$0, t$95$1]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|x \cdot \frac{z}{y}\right|\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+255}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -9.4999999999999998e77 or 4 < x < 3.1000000000000002e255Initial program 81.6%
Taylor expanded in z around 0 74.2%
associate-*r/74.2%
metadata-eval74.2%
Simplified74.2%
Taylor expanded in x around inf 72.7%
if -9.4999999999999998e77 < x < -2.5e-15 or 3.1000000000000002e255 < x Initial program 86.9%
Taylor expanded in z around inf 63.6%
mul-1-neg63.6%
associate-*r/78.2%
distribute-rgt-neg-out78.2%
distribute-neg-frac78.2%
Simplified78.2%
expm1-log1p-u49.8%
expm1-udef46.7%
div-inv46.7%
add-sqr-sqrt21.8%
sqrt-unprod23.2%
sqr-neg23.2%
sqrt-unprod6.7%
add-sqr-sqrt25.5%
div-inv25.5%
Applied egg-rr25.5%
expm1-def28.7%
expm1-log1p78.2%
Simplified78.2%
if -2.5e-15 < x < 4Initial program 96.8%
Taylor expanded in x around 0 79.4%
Final simplification76.8%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ x y))) (t_1 (fabs (/ x (/ y z)))))
(if (<= x -2.6e+78)
t_0
(if (<= x -4.2e-15)
t_1
(if (<= x 4.0) (fabs (/ 4.0 y)) (if (<= x 9.5e+254) t_0 t_1))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double t_1 = fabs((x / (y / z)));
double tmp;
if (x <= -2.6e+78) {
tmp = t_0;
} else if (x <= -4.2e-15) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if (x <= 9.5e+254) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y should be positive before calling this function
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) :: t_1
real(8) :: tmp
t_0 = abs((x / y))
t_1 = abs((x / (y / z)))
if (x <= (-2.6d+78)) then
tmp = t_0
else if (x <= (-4.2d-15)) then
tmp = t_1
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if (x <= 9.5d+254) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double t_1 = Math.abs((x / (y / z)));
double tmp;
if (x <= -2.6e+78) {
tmp = t_0;
} else if (x <= -4.2e-15) {
tmp = t_1;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if (x <= 9.5e+254) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((x / y)) t_1 = math.fabs((x / (y / z))) tmp = 0 if x <= -2.6e+78: tmp = t_0 elif x <= -4.2e-15: tmp = t_1 elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif x <= 9.5e+254: tmp = t_0 else: tmp = t_1 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(x / y)) t_1 = abs(Float64(x / Float64(y / z))) tmp = 0.0 if (x <= -2.6e+78) tmp = t_0; elseif (x <= -4.2e-15) tmp = t_1; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif (x <= 9.5e+254) tmp = t_0; else tmp = t_1; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((x / y)); t_1 = abs((x / (y / z))); tmp = 0.0; if (x <= -2.6e+78) tmp = t_0; elseif (x <= -4.2e-15) tmp = t_1; elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif (x <= 9.5e+254) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.6e+78], t$95$0, If[LessEqual[x, -4.2e-15], t$95$1, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 9.5e+254], t$95$0, t$95$1]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
t_1 := \left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+254}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.6e78 or 4 < x < 9.4999999999999998e254Initial program 81.6%
Taylor expanded in z around 0 74.2%
associate-*r/74.2%
metadata-eval74.2%
Simplified74.2%
Taylor expanded in x around inf 72.7%
if -2.6e78 < x < -4.19999999999999962e-15 or 9.4999999999999998e254 < x Initial program 86.9%
Taylor expanded in z around inf 63.6%
mul-1-neg63.6%
associate-*r/78.2%
distribute-rgt-neg-out78.2%
distribute-neg-frac78.2%
Simplified78.2%
associate-*r/63.6%
associate-/l*78.3%
add-sqr-sqrt42.2%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod35.7%
add-sqr-sqrt78.3%
Applied egg-rr78.3%
if -4.19999999999999962e-15 < x < 4Initial program 96.8%
Taylor expanded in x around 0 79.4%
Final simplification76.8%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ z (/ y x)))) (t_1 (fabs (/ (- -4.0 x) y))))
(if (<= z -1.75e+219)
t_0
(if (<= z -8e+174)
t_1
(if (<= z -5.7e+17)
t_0
(if (<= z 2.15e+48) t_1 (fabs (/ (* x z) y))))))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z / (y / x)));
double t_1 = fabs(((-4.0 - x) / y));
double tmp;
if (z <= -1.75e+219) {
tmp = t_0;
} else if (z <= -8e+174) {
tmp = t_1;
} else if (z <= -5.7e+17) {
tmp = t_0;
} else if (z <= 2.15e+48) {
tmp = t_1;
} else {
tmp = fabs(((x * z) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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) :: t_1
real(8) :: tmp
t_0 = abs((z / (y / x)))
t_1 = abs((((-4.0d0) - x) / y))
if (z <= (-1.75d+219)) then
tmp = t_0
else if (z <= (-8d+174)) then
tmp = t_1
else if (z <= (-5.7d+17)) then
tmp = t_0
else if (z <= 2.15d+48) then
tmp = t_1
else
tmp = abs(((x * z) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z / (y / x)));
double t_1 = Math.abs(((-4.0 - x) / y));
double tmp;
if (z <= -1.75e+219) {
tmp = t_0;
} else if (z <= -8e+174) {
tmp = t_1;
} else if (z <= -5.7e+17) {
tmp = t_0;
} else if (z <= 2.15e+48) {
tmp = t_1;
} else {
tmp = Math.abs(((x * z) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z / (y / x))) t_1 = math.fabs(((-4.0 - x) / y)) tmp = 0 if z <= -1.75e+219: tmp = t_0 elif z <= -8e+174: tmp = t_1 elif z <= -5.7e+17: tmp = t_0 elif z <= 2.15e+48: tmp = t_1 else: tmp = math.fabs(((x * z) / y)) return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z / Float64(y / x))) t_1 = abs(Float64(Float64(-4.0 - x) / y)) tmp = 0.0 if (z <= -1.75e+219) tmp = t_0; elseif (z <= -8e+174) tmp = t_1; elseif (z <= -5.7e+17) tmp = t_0; elseif (z <= 2.15e+48) tmp = t_1; else tmp = abs(Float64(Float64(x * z) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z / (y / x))); t_1 = abs(((-4.0 - x) / y)); tmp = 0.0; if (z <= -1.75e+219) tmp = t_0; elseif (z <= -8e+174) tmp = t_1; elseif (z <= -5.7e+17) tmp = t_0; elseif (z <= 2.15e+48) tmp = t_1; else tmp = abs(((x * z) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.75e+219], t$95$0, If[LessEqual[z, -8e+174], t$95$1, If[LessEqual[z, -5.7e+17], t$95$0, If[LessEqual[z, 2.15e+48], t$95$1, N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{z}{\frac{y}{x}}\right|\\
t_1 := \left|\frac{-4 - x}{y}\right|\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+174}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.7 \cdot 10^{+17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x \cdot z}{y}\right|\\
\end{array}
\end{array}
if z < -1.7500000000000001e219 or -8.00000000000000055e174 < z < -5.7e17Initial program 99.0%
Taylor expanded in z around inf 67.8%
mul-1-neg67.8%
associate-*r/71.7%
distribute-rgt-neg-out71.7%
distribute-neg-frac71.7%
Simplified71.7%
associate-*r/67.8%
associate-/l*73.3%
add-sqr-sqrt73.1%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod0.0%
add-sqr-sqrt73.3%
associate-/l*67.8%
*-commutative67.8%
associate-/l*78.4%
Applied egg-rr78.4%
if -1.7500000000000001e219 < z < -8.00000000000000055e174 or -5.7e17 < z < 2.14999999999999989e48Initial program 91.6%
Simplified96.9%
Taylor expanded in z around 0 96.6%
associate-*r/96.6%
distribute-lft-in96.6%
metadata-eval96.6%
neg-mul-196.6%
sub-neg96.6%
Simplified96.6%
if 2.14999999999999989e48 < z Initial program 75.7%
Taylor expanded in z around inf 79.1%
mul-1-neg79.1%
associate-*r/78.8%
distribute-rgt-neg-out78.8%
distribute-neg-frac78.8%
Simplified78.8%
associate-*r/79.1%
associate-/l*78.8%
add-sqr-sqrt0.0%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-unprod78.6%
add-sqr-sqrt78.8%
associate-/l*79.1%
Applied egg-rr79.1%
Final simplification89.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -5e+23) (fabs (- (/ (+ x 4.0) y) (* z (/ x y)))) (fabs (/ (- (+ x 4.0) (* x z)) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -5e+23) {
tmp = fabs((((x + 4.0) / y) - (z * (x / y))));
} else {
tmp = fabs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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 (z <= (-5d+23)) then
tmp = abs((((x + 4.0d0) / y) - (z * (x / y))))
else
tmp = abs((((x + 4.0d0) - (x * z)) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e+23) {
tmp = Math.abs((((x + 4.0) / y) - (z * (x / y))));
} else {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -5e+23: tmp = math.fabs((((x + 4.0) / y) - (z * (x / y)))) else: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -5e+23) tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(z * Float64(x / y)))); else tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e+23) tmp = abs((((x + 4.0) / y) - (z * (x / y)))); else tmp = abs((((x + 4.0) - (x * z)) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -5e+23], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+23}:\\
\;\;\;\;\left|\frac{x + 4}{y} - z \cdot \frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\end{array}
\end{array}
if z < -4.9999999999999999e23Initial program 97.5%
if -4.9999999999999999e23 < z Initial program 87.9%
associate-*l/91.9%
sub-div99.0%
Applied egg-rr99.0%
Final simplification98.7%
NOTE: y should be positive before calling this function
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ z (/ y x)))))
(if (<= x -3.4e-15)
t_0
(if (<= x 4.0)
(fabs (/ 4.0 y))
(if (<= x 1.5e+252) (fabs (/ x y)) t_0)))))y = abs(y);
double code(double x, double y, double z) {
double t_0 = fabs((z / (y / x)));
double tmp;
if (x <= -3.4e-15) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} else if (x <= 1.5e+252) {
tmp = fabs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: y should be positive before calling this function
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((z / (y / x)))
if (x <= (-3.4d-15)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else if (x <= 1.5d+252) then
tmp = abs((x / y))
else
tmp = t_0
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double t_0 = Math.abs((z / (y / x)));
double tmp;
if (x <= -3.4e-15) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.5e+252) {
tmp = Math.abs((x / y));
} else {
tmp = t_0;
}
return tmp;
}
y = abs(y) def code(x, y, z): t_0 = math.fabs((z / (y / x))) tmp = 0 if x <= -3.4e-15: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y)) elif x <= 1.5e+252: tmp = math.fabs((x / y)) else: tmp = t_0 return tmp
y = abs(y) function code(x, y, z) t_0 = abs(Float64(z / Float64(y / x))) tmp = 0.0 if (x <= -3.4e-15) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.5e+252) tmp = abs(Float64(x / y)); else tmp = t_0; end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) t_0 = abs((z / (y / x))); tmp = 0.0; if (x <= -3.4e-15) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y)); elseif (x <= 1.5e+252) tmp = abs((x / y)); else tmp = t_0; end tmp_2 = tmp; end
NOTE: y should be positive before calling this function
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.4e-15], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.5e+252], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
t_0 := \left|\frac{z}{\frac{y}{x}}\right|\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+252}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -3.4e-15 or 1.49999999999999995e252 < x Initial program 84.2%
Taylor expanded in z around inf 54.2%
mul-1-neg54.2%
associate-*r/64.6%
distribute-rgt-neg-out64.6%
distribute-neg-frac64.6%
Simplified64.6%
associate-*r/54.2%
associate-/l*64.7%
add-sqr-sqrt36.6%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod27.8%
add-sqr-sqrt64.7%
associate-/l*54.2%
*-commutative54.2%
associate-/l*72.8%
Applied egg-rr72.8%
if -3.4e-15 < x < 4Initial program 96.8%
Taylor expanded in x around 0 79.4%
if 4 < x < 1.49999999999999995e252Initial program 81.4%
Taylor expanded in z around 0 79.0%
associate-*r/79.0%
metadata-eval79.0%
Simplified79.0%
Taylor expanded in x around inf 76.5%
Final simplification77.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -8.6e-16) (not (<= x 90000.0))) (fabs (/ x (/ y (- 1.0 z)))) (fabs (/ (- -4.0 x) y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -8.6e-16) || !(x <= 90000.0)) {
tmp = fabs((x / (y / (1.0 - z))));
} else {
tmp = fabs(((-4.0 - x) / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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-16)) .or. (.not. (x <= 90000.0d0))) then
tmp = abs((x / (y / (1.0d0 - z))))
else
tmp = abs((((-4.0d0) - x) / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -8.6e-16) || !(x <= 90000.0)) {
tmp = Math.abs((x / (y / (1.0 - z))));
} else {
tmp = Math.abs(((-4.0 - x) / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -8.6e-16) or not (x <= 90000.0): tmp = math.fabs((x / (y / (1.0 - z)))) else: tmp = math.fabs(((-4.0 - x) / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -8.6e-16) || !(x <= 90000.0)) tmp = abs(Float64(x / Float64(y / Float64(1.0 - z)))); else tmp = abs(Float64(Float64(-4.0 - x) / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -8.6e-16) || ~((x <= 90000.0))) tmp = abs((x / (y / (1.0 - z)))); else tmp = abs(((-4.0 - x) / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -8.6e-16], N[Not[LessEqual[x, 90000.0]], $MachinePrecision]], N[Abs[N[(x / N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{-16} \lor \neg \left(x \leq 90000\right):\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\end{array}
\end{array}
if x < -8.5999999999999997e-16 or 9e4 < x Initial program 82.7%
associate-*l/82.3%
sub-div93.8%
Applied egg-rr93.8%
Taylor expanded in x around inf 92.3%
associate-/l*98.3%
Simplified98.3%
if -8.5999999999999997e-16 < x < 9e4Initial program 96.8%
Simplified90.2%
Taylor expanded in z around 0 79.8%
associate-*r/79.8%
distribute-lft-in79.8%
metadata-eval79.8%
neg-mul-179.8%
sub-neg79.8%
Simplified79.8%
Final simplification88.6%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ (- (+ x 4.0) (* x z)) y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((((x + 4.0) - (x * z)) / y));
}
NOTE: y should be positive before calling this function
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) - (x * z)) / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) - (x * z)) / y));
}
y = abs(y) def code(x, y, z): return math.fabs((((x + 4.0) - (x * z)) / y))
y = abs(y) function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((((x + 4.0) - (x * z)) / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|
\end{array}
Initial program 90.1%
associate-*l/91.5%
sub-div97.0%
Applied egg-rr97.0%
Final simplification97.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.5) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
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)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.5) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.5) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.5) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -1.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -1.5 or 4 < x Initial program 82.1%
Taylor expanded in z around 0 67.6%
associate-*r/67.6%
metadata-eval67.6%
Simplified67.6%
Taylor expanded in x around inf 66.3%
if -1.5 < x < 4Initial program 96.9%
Taylor expanded in x around 0 76.9%
Final simplification72.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
y = abs(y) def code(x, y, z): return math.fabs((4.0 / y))
y = abs(y) function code(x, y, z) return abs(Float64(4.0 / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 90.1%
Taylor expanded in x around 0 43.9%
Final simplification43.9%
herbie shell --seed 2023306
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))