
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 4e-91) (fabs (/ (- (+ 4.0 x) (* x z)) y_m)) (fabs (fma x (/ z y_m) (/ (- -4.0 x) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 4e-91) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs(fma(x, (z / y_m), ((-4.0 - x) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 4e-91) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(fma(x, Float64(z / y_m), Float64(Float64(-4.0 - x) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 4e-91], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision] + N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 4 \cdot 10^{-91}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(x, \frac{z}{y_m}, \frac{-4 - x}{y_m}\right)\right|\\
\end{array}
\end{array}
if y < 4.00000000000000009e-91Initial program 90.6%
Taylor expanded in y around 0 96.6%
if 4.00000000000000009e-91 < y Initial program 94.3%
Simplified99.8%
Final simplification97.7%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (* z (/ x y_m))) (t_1 (fabs (- t_0 (/ (+ 4.0 x) y_m)))))
(if (<= t_1 1e-181)
(fabs (/ (- (+ 4.0 x) (* x z)) y_m))
(if (<= t_1 1e+304) t_1 (fabs t_0)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = z * (x / y_m);
double t_1 = fabs((t_0 - ((4.0 + x) / y_m)));
double tmp;
if (t_1 <= 1e-181) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else if (t_1 <= 1e+304) {
tmp = t_1;
} else {
tmp = fabs(t_0);
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (x / y_m)
t_1 = abs((t_0 - ((4.0d0 + x) / y_m)))
if (t_1 <= 1d-181) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else if (t_1 <= 1d+304) then
tmp = t_1
else
tmp = abs(t_0)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = z * (x / y_m);
double t_1 = Math.abs((t_0 - ((4.0 + x) / y_m)));
double tmp;
if (t_1 <= 1e-181) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else if (t_1 <= 1e+304) {
tmp = t_1;
} else {
tmp = Math.abs(t_0);
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = z * (x / y_m) t_1 = math.fabs((t_0 - ((4.0 + x) / y_m))) tmp = 0 if t_1 <= 1e-181: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) elif t_1 <= 1e+304: tmp = t_1 else: tmp = math.fabs(t_0) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(z * Float64(x / y_m)) t_1 = abs(Float64(t_0 - Float64(Float64(4.0 + x) / y_m))) tmp = 0.0 if (t_1 <= 1e-181) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); elseif (t_1 <= 1e+304) tmp = t_1; else tmp = abs(t_0); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = z * (x / y_m); t_1 = abs((t_0 - ((4.0 + x) / y_m))); tmp = 0.0; if (t_1 <= 1e-181) tmp = abs((((4.0 + x) - (x * z)) / y_m)); elseif (t_1 <= 1e+304) tmp = t_1; else tmp = abs(t_0); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(t$95$0 - N[(N[(4.0 + x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 1e-181], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 1e+304], t$95$1, N[Abs[t$95$0], $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := z \cdot \frac{x}{y_m}\\
t_1 := \left|t_0 - \frac{4 + x}{y_m}\right|\\
\mathbf{if}\;t_1 \leq 10^{-181}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{elif}\;t_1 \leq 10^{+304}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left|t_0\right|\\
\end{array}
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 1.00000000000000005e-181Initial program 79.9%
Taylor expanded in y around 0 100.0%
if 1.00000000000000005e-181 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) < 9.9999999999999994e303Initial program 99.9%
if 9.9999999999999994e303 < (fabs.f64 (-.f64 (/.f64 (+.f64 x 4) y) (*.f64 (/.f64 x y) z))) Initial program 72.2%
Taylor expanded in z around inf 86.2%
mul-1-neg86.2%
associate-*l/100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
expm1-log1p-u59.0%
expm1-udef59.0%
add-sqr-sqrt25.9%
sqrt-unprod40.7%
sqr-neg40.7%
sqrt-unprod24.1%
add-sqr-sqrt40.7%
associate-*l/37.2%
*-commutative37.2%
associate-/l*40.7%
Applied egg-rr40.7%
expm1-def40.7%
expm1-log1p100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Final simplification99.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))) (t_1 (fabs (/ 4.0 y_m))))
(if (<= x -2.5e-16)
t_0
(if (<= x 1.55e-121)
t_1
(if (<= x 8.5e-61)
t_0
(if (<= x 5.6e-20)
t_1
(if (or (<= x 1.75e+99) (not (<= x 2.8e+186)))
t_0
(fabs (/ x y_m)))))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double t_1 = fabs((4.0 / y_m));
double tmp;
if (x <= -2.5e-16) {
tmp = t_0;
} else if (x <= 1.55e-121) {
tmp = t_1;
} else if (x <= 8.5e-61) {
tmp = t_0;
} else if (x <= 5.6e-20) {
tmp = t_1;
} else if ((x <= 1.75e+99) || !(x <= 2.8e+186)) {
tmp = t_0;
} else {
tmp = fabs((x / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
t_1 = abs((4.0d0 / y_m))
if (x <= (-2.5d-16)) then
tmp = t_0
else if (x <= 1.55d-121) then
tmp = t_1
else if (x <= 8.5d-61) then
tmp = t_0
else if (x <= 5.6d-20) then
tmp = t_1
else if ((x <= 1.75d+99) .or. (.not. (x <= 2.8d+186))) then
tmp = t_0
else
tmp = abs((x / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((z * (x / y_m)));
double t_1 = Math.abs((4.0 / y_m));
double tmp;
if (x <= -2.5e-16) {
tmp = t_0;
} else if (x <= 1.55e-121) {
tmp = t_1;
} else if (x <= 8.5e-61) {
tmp = t_0;
} else if (x <= 5.6e-20) {
tmp = t_1;
} else if ((x <= 1.75e+99) || !(x <= 2.8e+186)) {
tmp = t_0;
} else {
tmp = Math.abs((x / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) t_1 = math.fabs((4.0 / y_m)) tmp = 0 if x <= -2.5e-16: tmp = t_0 elif x <= 1.55e-121: tmp = t_1 elif x <= 8.5e-61: tmp = t_0 elif x <= 5.6e-20: tmp = t_1 elif (x <= 1.75e+99) or not (x <= 2.8e+186): tmp = t_0 else: tmp = math.fabs((x / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) t_1 = abs(Float64(4.0 / y_m)) tmp = 0.0 if (x <= -2.5e-16) tmp = t_0; elseif (x <= 1.55e-121) tmp = t_1; elseif (x <= 8.5e-61) tmp = t_0; elseif (x <= 5.6e-20) tmp = t_1; elseif ((x <= 1.75e+99) || !(x <= 2.8e+186)) tmp = t_0; else tmp = abs(Float64(x / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((z * (x / y_m))); t_1 = abs((4.0 / y_m)); tmp = 0.0; if (x <= -2.5e-16) tmp = t_0; elseif (x <= 1.55e-121) tmp = t_1; elseif (x <= 8.5e-61) tmp = t_0; elseif (x <= 5.6e-20) tmp = t_1; elseif ((x <= 1.75e+99) || ~((x <= 2.8e+186))) tmp = t_0; else tmp = abs((x / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2.5e-16], t$95$0, If[LessEqual[x, 1.55e-121], t$95$1, If[LessEqual[x, 8.5e-61], t$95$0, If[LessEqual[x, 5.6e-20], t$95$1, If[Or[LessEqual[x, 1.75e+99], N[Not[LessEqual[x, 2.8e+186]], $MachinePrecision]], t$95$0, N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y_m}\right|\\
t_1 := \left|\frac{4}{y_m}\right|\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+99} \lor \neg \left(x \leq 2.8 \cdot 10^{+186}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\end{array}
\end{array}
if x < -2.5000000000000002e-16 or 1.5499999999999999e-121 < x < 8.50000000000000016e-61 or 5.6000000000000005e-20 < x < 1.7499999999999999e99 or 2.80000000000000018e186 < x Initial program 87.7%
Taylor expanded in z around inf 60.2%
mul-1-neg60.2%
associate-*l/71.8%
distribute-rgt-neg-out71.8%
Simplified71.8%
expm1-log1p-u41.0%
expm1-udef39.4%
add-sqr-sqrt19.8%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod15.2%
add-sqr-sqrt30.8%
associate-*l/27.8%
*-commutative27.8%
associate-/l*30.8%
Applied egg-rr30.8%
expm1-def32.5%
expm1-log1p71.8%
Simplified71.8%
clear-num71.8%
associate-/r/71.7%
clear-num71.8%
Applied egg-rr71.8%
if -2.5000000000000002e-16 < x < 1.5499999999999999e-121 or 8.50000000000000016e-61 < x < 5.6000000000000005e-20Initial program 95.8%
Taylor expanded in x around 0 83.8%
if 1.7499999999999999e99 < x < 2.80000000000000018e186Initial program 94.9%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 95.1%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around 0 81.6%
Final simplification77.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (/ x y_m))) (t_1 (fabs (* x (/ z y_m)))))
(if (<= x -4.1e+123)
t_0
(if (<= x -3.8e-18)
t_1
(if (<= x 2.5e-121)
(fabs (/ 4.0 y_m))
(if (or (<= x 8e+98) (not (<= x 6.8e+187))) t_1 t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x / y_m));
double t_1 = fabs((x * (z / y_m)));
double tmp;
if (x <= -4.1e+123) {
tmp = t_0;
} else if (x <= -3.8e-18) {
tmp = t_1;
} else if (x <= 2.5e-121) {
tmp = fabs((4.0 / y_m));
} else if ((x <= 8e+98) || !(x <= 6.8e+187)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((x / y_m))
t_1 = abs((x * (z / y_m)))
if (x <= (-4.1d+123)) then
tmp = t_0
else if (x <= (-3.8d-18)) then
tmp = t_1
else if (x <= 2.5d-121) then
tmp = abs((4.0d0 / y_m))
else if ((x <= 8d+98) .or. (.not. (x <= 6.8d+187))) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((x / y_m));
double t_1 = Math.abs((x * (z / y_m)));
double tmp;
if (x <= -4.1e+123) {
tmp = t_0;
} else if (x <= -3.8e-18) {
tmp = t_1;
} else if (x <= 2.5e-121) {
tmp = Math.abs((4.0 / y_m));
} else if ((x <= 8e+98) || !(x <= 6.8e+187)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x / y_m)) t_1 = math.fabs((x * (z / y_m))) tmp = 0 if x <= -4.1e+123: tmp = t_0 elif x <= -3.8e-18: tmp = t_1 elif x <= 2.5e-121: tmp = math.fabs((4.0 / y_m)) elif (x <= 8e+98) or not (x <= 6.8e+187): tmp = t_1 else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(x / y_m)) t_1 = abs(Float64(x * Float64(z / y_m))) tmp = 0.0 if (x <= -4.1e+123) tmp = t_0; elseif (x <= -3.8e-18) tmp = t_1; elseif (x <= 2.5e-121) tmp = abs(Float64(4.0 / y_m)); elseif ((x <= 8e+98) || !(x <= 6.8e+187)) tmp = t_1; else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x / y_m)); t_1 = abs((x * (z / y_m))); tmp = 0.0; if (x <= -4.1e+123) tmp = t_0; elseif (x <= -3.8e-18) tmp = t_1; elseif (x <= 2.5e-121) tmp = abs((4.0 / y_m)); elseif ((x <= 8e+98) || ~((x <= 6.8e+187))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.1e+123], t$95$0, If[LessEqual[x, -3.8e-18], t$95$1, If[LessEqual[x, 2.5e-121], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[x, 8e+98], N[Not[LessEqual[x, 6.8e+187]], $MachinePrecision]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y_m}\right|\\
t_1 := \left|x \cdot \frac{z}{y_m}\right|\\
\mathbf{if}\;x \leq -4.1 \cdot 10^{+123}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-121}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+98} \lor \neg \left(x \leq 6.8 \cdot 10^{+187}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -4.09999999999999989e123 or 7.99999999999999998e98 < x < 6.7999999999999999e187Initial program 87.2%
Taylor expanded in y around 0 91.4%
Taylor expanded in x around inf 91.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 74.4%
if -4.09999999999999989e123 < x < -3.7999999999999998e-18 or 2.49999999999999995e-121 < x < 7.99999999999999998e98 or 6.7999999999999999e187 < x Initial program 89.5%
Taylor expanded in z around inf 65.1%
mul-1-neg65.1%
associate-*l/71.0%
distribute-rgt-neg-out71.0%
Simplified71.0%
expm1-log1p-u37.4%
expm1-udef35.2%
add-sqr-sqrt18.4%
sqrt-unprod27.0%
sqr-neg27.0%
sqrt-unprod18.5%
add-sqr-sqrt34.5%
associate-*l/31.6%
*-commutative31.6%
associate-/l*34.5%
Applied egg-rr34.5%
expm1-def36.6%
expm1-log1p70.9%
associate-/r/69.1%
*-commutative69.1%
Simplified69.1%
if -3.7999999999999998e-18 < x < 2.49999999999999995e-121Initial program 96.4%
Taylor expanded in x around 0 84.4%
Final simplification76.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (fabs (* z (/ x y_m)))))
(if (<= x -4.2e-15)
t_0
(if (<= x 2.4e-121)
(fabs (/ 4.0 y_m))
(if (<= x 8e+98)
(fabs (/ (* x z) y_m))
(if (<= x 1.55e+184) (fabs (/ x y_m)) t_0))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((z * (x / y_m)));
double tmp;
if (x <= -4.2e-15) {
tmp = t_0;
} else if (x <= 2.4e-121) {
tmp = fabs((4.0 / y_m));
} else if (x <= 8e+98) {
tmp = fabs(((x * z) / y_m));
} else if (x <= 1.55e+184) {
tmp = fabs((x / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((z * (x / y_m)))
if (x <= (-4.2d-15)) then
tmp = t_0
else if (x <= 2.4d-121) then
tmp = abs((4.0d0 / y_m))
else if (x <= 8d+98) then
tmp = abs(((x * z) / y_m))
else if (x <= 1.55d+184) then
tmp = abs((x / y_m))
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((z * (x / y_m)));
double tmp;
if (x <= -4.2e-15) {
tmp = t_0;
} else if (x <= 2.4e-121) {
tmp = Math.abs((4.0 / y_m));
} else if (x <= 8e+98) {
tmp = Math.abs(((x * z) / y_m));
} else if (x <= 1.55e+184) {
tmp = Math.abs((x / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((z * (x / y_m))) tmp = 0 if x <= -4.2e-15: tmp = t_0 elif x <= 2.4e-121: tmp = math.fabs((4.0 / y_m)) elif x <= 8e+98: tmp = math.fabs(((x * z) / y_m)) elif x <= 1.55e+184: tmp = math.fabs((x / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(z * Float64(x / y_m))) tmp = 0.0 if (x <= -4.2e-15) tmp = t_0; elseif (x <= 2.4e-121) tmp = abs(Float64(4.0 / y_m)); elseif (x <= 8e+98) tmp = abs(Float64(Float64(x * z) / y_m)); elseif (x <= 1.55e+184) tmp = abs(Float64(x / y_m)); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((z * (x / y_m))); tmp = 0.0; if (x <= -4.2e-15) tmp = t_0; elseif (x <= 2.4e-121) tmp = abs((4.0 / y_m)); elseif (x <= 8e+98) tmp = abs(((x * z) / y_m)); elseif (x <= 1.55e+184) tmp = abs((x / y_m)); else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.2e-15], t$95$0, If[LessEqual[x, 2.4e-121], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 8e+98], N[Abs[N[(N[(x * z), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.55e+184], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{if}\;x \leq -4.2 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-121}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+98}:\\
\;\;\;\;\left|\frac{x \cdot z}{y_m}\right|\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+184}:\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -4.19999999999999962e-15 or 1.5499999999999999e184 < x Initial program 85.3%
Taylor expanded in z around inf 54.1%
mul-1-neg54.1%
associate-*l/69.9%
distribute-rgt-neg-out69.9%
Simplified69.9%
expm1-log1p-u39.7%
expm1-udef39.5%
add-sqr-sqrt17.1%
sqrt-unprod22.8%
sqr-neg22.8%
sqrt-unprod14.1%
add-sqr-sqrt28.8%
associate-*l/25.7%
*-commutative25.7%
associate-/l*28.8%
Applied egg-rr28.8%
expm1-def28.9%
expm1-log1p69.8%
Simplified69.8%
clear-num69.8%
associate-/r/69.8%
clear-num69.9%
Applied egg-rr69.9%
if -4.19999999999999962e-15 < x < 2.40000000000000003e-121Initial program 96.4%
Taylor expanded in x around 0 84.4%
if 2.40000000000000003e-121 < x < 7.99999999999999998e98Initial program 92.9%
Taylor expanded in z around inf 67.7%
mul-1-neg67.7%
associate-*l/65.5%
distribute-rgt-neg-out65.5%
Simplified65.5%
add-sqr-sqrt37.1%
sqrt-unprod35.0%
sqr-neg35.0%
sqrt-unprod28.1%
add-sqr-sqrt65.5%
associate-*l/67.7%
Applied egg-rr67.7%
if 7.99999999999999998e98 < x < 1.5499999999999999e184Initial program 94.9%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 95.1%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around 0 81.6%
Final simplification76.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= x -1.3e+72)
(fabs (* x (+ (/ z y_m) (/ -1.0 y_m))))
(if (<= x 600000000.0)
(fabs (/ (- (+ 4.0 x) (* x z)) y_m))
(fabs (/ x (/ y_m (- 1.0 z)))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.3e+72) {
tmp = fabs((x * ((z / y_m) + (-1.0 / y_m))));
} else if (x <= 600000000.0) {
tmp = fabs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = fabs((x / (y_m / (1.0 - z))));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.3d+72)) then
tmp = abs((x * ((z / y_m) + ((-1.0d0) / y_m))))
else if (x <= 600000000.0d0) then
tmp = abs((((4.0d0 + x) - (x * z)) / y_m))
else
tmp = abs((x / (y_m / (1.0d0 - z))))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -1.3e+72) {
tmp = Math.abs((x * ((z / y_m) + (-1.0 / y_m))));
} else if (x <= 600000000.0) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y_m));
} else {
tmp = Math.abs((x / (y_m / (1.0 - z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -1.3e+72: tmp = math.fabs((x * ((z / y_m) + (-1.0 / y_m)))) elif x <= 600000000.0: tmp = math.fabs((((4.0 + x) - (x * z)) / y_m)) else: tmp = math.fabs((x / (y_m / (1.0 - z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -1.3e+72) tmp = abs(Float64(x * Float64(Float64(z / y_m) + Float64(-1.0 / y_m)))); elseif (x <= 600000000.0) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y_m)); else tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -1.3e+72) tmp = abs((x * ((z / y_m) + (-1.0 / y_m)))); elseif (x <= 600000000.0) tmp = abs((((4.0 + x) - (x * z)) / y_m)); else tmp = abs((x / (y_m / (1.0 - z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -1.3e+72], N[Abs[N[(x * N[(N[(z / y$95$m), $MachinePrecision] + N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 600000000.0], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+72}:\\
\;\;\;\;\left|x \cdot \left(\frac{z}{y_m} + \frac{-1}{y_m}\right)\right|\\
\mathbf{elif}\;x \leq 600000000:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\end{array}
\end{array}
if x < -1.29999999999999991e72Initial program 83.3%
Simplified89.6%
Taylor expanded in x around inf 99.9%
if -1.29999999999999991e72 < x < 6e8Initial program 96.0%
Taylor expanded in y around 0 99.9%
if 6e8 < x Initial program 88.9%
Taylor expanded in y around 0 92.6%
Taylor expanded in x around inf 92.6%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -3.6e-17) (not (<= x 2.5e-121))) (fabs (/ x (/ y_m (- 1.0 z)))) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -3.6e-17) || !(x <= 2.5e-121)) {
tmp = fabs((x / (y_m / (1.0 - z))));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-3.6d-17)) .or. (.not. (x <= 2.5d-121))) then
tmp = abs((x / (y_m / (1.0d0 - z))))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -3.6e-17) || !(x <= 2.5e-121)) {
tmp = Math.abs((x / (y_m / (1.0 - z))));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -3.6e-17) or not (x <= 2.5e-121): tmp = math.fabs((x / (y_m / (1.0 - z)))) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -3.6e-17) || !(x <= 2.5e-121)) tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -3.6e-17) || ~((x <= 2.5e-121))) tmp = abs((x / (y_m / (1.0 - z)))); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -3.6e-17], N[Not[LessEqual[x, 2.5e-121]], $MachinePrecision]], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-17} \lor \neg \left(x \leq 2.5 \cdot 10^{-121}\right):\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\end{array}
\end{array}
if x < -3.59999999999999995e-17 or 2.49999999999999995e-121 < x Initial program 88.7%
Taylor expanded in y around 0 93.0%
Taylor expanded in x around inf 86.4%
associate-/l*92.0%
Simplified92.0%
if -3.59999999999999995e-17 < x < 2.49999999999999995e-121Initial program 96.4%
Taylor expanded in x around 0 84.4%
Final simplification88.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -2e-17) (fabs (* x (+ (/ z y_m) (/ -1.0 y_m)))) (if (<= x 2.5e-121) (fabs (/ 4.0 y_m)) (fabs (/ x (/ y_m (- 1.0 z)))))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -2e-17) {
tmp = fabs((x * ((z / y_m) + (-1.0 / y_m))));
} else if (x <= 2.5e-121) {
tmp = fabs((4.0 / y_m));
} else {
tmp = fabs((x / (y_m / (1.0 - z))));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-2d-17)) then
tmp = abs((x * ((z / y_m) + ((-1.0d0) / y_m))))
else if (x <= 2.5d-121) then
tmp = abs((4.0d0 / y_m))
else
tmp = abs((x / (y_m / (1.0d0 - z))))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (x <= -2e-17) {
tmp = Math.abs((x * ((z / y_m) + (-1.0 / y_m))));
} else if (x <= 2.5e-121) {
tmp = Math.abs((4.0 / y_m));
} else {
tmp = Math.abs((x / (y_m / (1.0 - z))));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if x <= -2e-17: tmp = math.fabs((x * ((z / y_m) + (-1.0 / y_m)))) elif x <= 2.5e-121: tmp = math.fabs((4.0 / y_m)) else: tmp = math.fabs((x / (y_m / (1.0 - z)))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -2e-17) tmp = abs(Float64(x * Float64(Float64(z / y_m) + Float64(-1.0 / y_m)))); elseif (x <= 2.5e-121) tmp = abs(Float64(4.0 / y_m)); else tmp = abs(Float64(x / Float64(y_m / Float64(1.0 - z)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (x <= -2e-17) tmp = abs((x * ((z / y_m) + (-1.0 / y_m)))); elseif (x <= 2.5e-121) tmp = abs((4.0 / y_m)); else tmp = abs((x / (y_m / (1.0 - z)))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[x, -2e-17], N[Abs[N[(x * N[(N[(z / y$95$m), $MachinePrecision] + N[(-1.0 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 2.5e-121], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y$95$m / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\left|x \cdot \left(\frac{z}{y_m} + \frac{-1}{y_m}\right)\right|\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-121}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y_m}{1 - z}}\right|\\
\end{array}
\end{array}
if x < -2.00000000000000014e-17Initial program 86.6%
Simplified91.6%
Taylor expanded in x around inf 98.0%
if -2.00000000000000014e-17 < x < 2.49999999999999995e-121Initial program 96.4%
Taylor expanded in x around 0 84.4%
if 2.49999999999999995e-121 < x Initial program 90.0%
Taylor expanded in y around 0 94.7%
Taylor expanded in x around inf 84.8%
associate-/l*88.0%
Simplified88.0%
Final simplification88.9%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(if (<= z -8500.0)
(fabs (* z (/ x y_m)))
(if (<= z 4000000000000.0)
(fabs (/ (- -4.0 x) y_m))
(fabs (* x (/ z y_m))))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (z <= -8500.0) {
tmp = fabs((z * (x / y_m)));
} else if (z <= 4000000000000.0) {
tmp = fabs(((-4.0 - x) / y_m));
} else {
tmp = fabs((x * (z / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-8500.0d0)) then
tmp = abs((z * (x / y_m)))
else if (z <= 4000000000000.0d0) then
tmp = abs((((-4.0d0) - x) / y_m))
else
tmp = abs((x * (z / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if (z <= -8500.0) {
tmp = Math.abs((z * (x / y_m)));
} else if (z <= 4000000000000.0) {
tmp = Math.abs(((-4.0 - x) / y_m));
} else {
tmp = Math.abs((x * (z / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if z <= -8500.0: tmp = math.fabs((z * (x / y_m))) elif z <= 4000000000000.0: tmp = math.fabs(((-4.0 - x) / y_m)) else: tmp = math.fabs((x * (z / y_m))) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (z <= -8500.0) tmp = abs(Float64(z * Float64(x / y_m))); elseif (z <= 4000000000000.0) tmp = abs(Float64(Float64(-4.0 - x) / y_m)); else tmp = abs(Float64(x * Float64(z / y_m))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if (z <= -8500.0) tmp = abs((z * (x / y_m))); elseif (z <= 4000000000000.0) tmp = abs(((-4.0 - x) / y_m)); else tmp = abs((x * (z / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[z, -8500.0], N[Abs[N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 4000000000000.0], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8500:\\
\;\;\;\;\left|z \cdot \frac{x}{y_m}\right|\\
\mathbf{elif}\;z \leq 4000000000000:\\
\;\;\;\;\left|\frac{-4 - x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y_m}\right|\\
\end{array}
\end{array}
if z < -8500Initial program 97.2%
Taylor expanded in z around inf 68.1%
mul-1-neg68.1%
associate-*l/72.1%
distribute-rgt-neg-out72.1%
Simplified72.1%
expm1-log1p-u39.8%
expm1-udef37.1%
add-sqr-sqrt37.1%
sqrt-unprod26.4%
sqr-neg26.4%
sqrt-unprod0.0%
add-sqr-sqrt33.4%
associate-*l/32.1%
*-commutative32.1%
associate-/l*33.4%
Applied egg-rr33.4%
expm1-def36.1%
expm1-log1p72.0%
Simplified72.0%
clear-num72.0%
associate-/r/71.9%
clear-num72.1%
Applied egg-rr72.1%
if -8500 < z < 4e12Initial program 96.0%
Simplified100.0%
Taylor expanded in z around 0 97.7%
associate-*r/97.7%
distribute-lft-in97.7%
metadata-eval97.7%
neg-mul-197.7%
sub-neg97.7%
Simplified97.7%
if 4e12 < z Initial program 77.3%
Taylor expanded in z around inf 74.8%
mul-1-neg74.8%
associate-*l/77.7%
distribute-rgt-neg-out77.7%
Simplified77.7%
expm1-log1p-u46.0%
expm1-udef42.5%
add-sqr-sqrt0.0%
sqrt-unprod22.7%
sqr-neg22.7%
sqrt-unprod31.8%
add-sqr-sqrt31.8%
associate-*l/30.4%
*-commutative30.4%
associate-/l*31.8%
Applied egg-rr31.8%
expm1-def35.3%
expm1-log1p77.6%
associate-/r/81.0%
*-commutative81.0%
Simplified81.0%
Final simplification86.6%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (or (<= x -10.5) (not (<= x 4.0))) (fabs (/ x y_m)) (fabs (/ 4.0 y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = fabs((x / y_m));
} else {
tmp = fabs((4.0 / y_m));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-10.5d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y_m))
else
tmp = abs((4.0d0 / y_m))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double tmp;
if ((x <= -10.5) || !(x <= 4.0)) {
tmp = Math.abs((x / y_m));
} else {
tmp = Math.abs((4.0 / y_m));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): tmp = 0 if (x <= -10.5) or not (x <= 4.0): tmp = math.fabs((x / y_m)) else: tmp = math.fabs((4.0 / y_m)) return tmp
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if ((x <= -10.5) || !(x <= 4.0)) tmp = abs(Float64(x / y_m)); else tmp = abs(Float64(4.0 / y_m)); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) tmp = 0.0; if ((x <= -10.5) || ~((x <= 4.0))) tmp = abs((x / y_m)); else tmp = abs((4.0 / y_m)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[Or[LessEqual[x, -10.5], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -10.5 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y_m}\right|\\
\end{array}
\end{array}
if x < -10.5 or 4 < x Initial program 87.7%
Taylor expanded in y around 0 91.5%
Taylor expanded in x around inf 90.4%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in z around 0 57.7%
if -10.5 < x < 4Initial program 95.7%
Taylor expanded in x around 0 74.6%
Final simplification66.5%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ 4.0 y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((4.0 / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs((4.0d0 / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs((4.0 / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs((4.0 / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(4.0 / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs((4.0 / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(4.0 / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{4}{y_m}\right|
\end{array}
Initial program 91.9%
Taylor expanded in x around 0 41.1%
Final simplification41.1%
herbie shell --seed 2023334
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))