Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\]
↓
\[\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -1 \cdot 10^{-50} \lor \neg \left(z \leq 5 \cdot 10^{-71}\right):\\
\;\;\;\;z \cdot \left(b \cdot a\right) + \left(t \cdot a + t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(b \cdot z\right) + t \cdot a\right) + t_1\\
\end{array}
\]
(FPCore (x y z t a b)
:precision binary64
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b))) ↓
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (or (<= z -1e-50) (not (<= z 5e-71)))
(+ (* z (* b a)) (+ (* t a) t_1))
(+ (+ (* a (* b z)) (* t a)) t_1)))) double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
↓
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if ((z <= -1e-50) || !(z <= 5e-71)) {
tmp = (z * (b * a)) + ((t * a) + t_1);
} else {
tmp = ((a * (b * z)) + (t * a)) + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
↓
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * z)
if ((z <= (-1d-50)) .or. (.not. (z <= 5d-71))) then
tmp = (z * (b * a)) + ((t * a) + t_1)
else
tmp = ((a * (b * z)) + (t * a)) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
↓
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if ((z <= -1e-50) || !(z <= 5e-71)) {
tmp = (z * (b * a)) + ((t * a) + t_1);
} else {
tmp = ((a * (b * z)) + (t * a)) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b):
return ((x + (y * z)) + (t * a)) + ((a * z) * b)
↓
def code(x, y, z, t, a, b):
t_1 = x + (y * z)
tmp = 0
if (z <= -1e-50) or not (z <= 5e-71):
tmp = (z * (b * a)) + ((t * a) + t_1)
else:
tmp = ((a * (b * z)) + (t * a)) + t_1
return tmp
function code(x, y, z, t, a, b)
return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b))
end
↓
function code(x, y, z, t, a, b)
t_1 = Float64(x + Float64(y * z))
tmp = 0.0
if ((z <= -1e-50) || !(z <= 5e-71))
tmp = Float64(Float64(z * Float64(b * a)) + Float64(Float64(t * a) + t_1));
else
tmp = Float64(Float64(Float64(a * Float64(b * z)) + Float64(t * a)) + t_1);
end
return tmp
end
function tmp = code(x, y, z, t, a, b)
tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b);
end
↓
function tmp_2 = code(x, y, z, t, a, b)
t_1 = x + (y * z);
tmp = 0.0;
if ((z <= -1e-50) || ~((z <= 5e-71)))
tmp = (z * (b * a)) + ((t * a) + t_1);
else
tmp = ((a * (b * z)) + (t * a)) + t_1;
end
tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -1e-50], N[Not[LessEqual[z, 5e-71]], $MachinePrecision]], N[(N[(z * N[(b * a), $MachinePrecision]), $MachinePrecision] + N[(N[(t * a), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
↓
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -1 \cdot 10^{-50} \lor \neg \left(z \leq 5 \cdot 10^{-71}\right):\\
\;\;\;\;z \cdot \left(b \cdot a\right) + \left(t \cdot a + t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot \left(b \cdot z\right) + t \cdot a\right) + t_1\\
\end{array}
Alternatives Alternative 1 Accuracy 98.7% Cost 13641
\[\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+161} \lor \neg \left(b \leq 5 \cdot 10^{+51}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + \left(t \cdot a + \left(x + y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(y, z, x\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 62.8% Cost 1768
\[\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := a \cdot \left(t + b \cdot z\right)\\
t_3 := x + y \cdot z\\
t_4 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{-16}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-49}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-178}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-239}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-234}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-191}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-102}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+74}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+158}:\\
\;\;\;\;x + b \cdot \left(z \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 3 Accuracy 63.4% Cost 1640
\[\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := a \cdot \left(t + b \cdot z\right)\\
t_3 := x + y \cdot z\\
t_4 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-16}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -3.15 \cdot 10^{-49}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-178}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{-239}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{-236}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{-191}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-103}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+61}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;x \leq 10^{+196}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 4 Accuracy 62.0% Cost 1636
\[\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := a \cdot \left(t + b \cdot z\right)\\
t_3 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{-15}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-50}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.18 \cdot 10^{-179}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -1.95 \cdot 10^{-239}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-234}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 10^{-190}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-103}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+74}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\end{array}
\]
Alternative 5 Accuracy 46.1% Cost 1380
\[\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+143}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{+86}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq -13600000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-49}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-162}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq -9.5 \cdot 10^{-240}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-75}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+75}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 6 Accuracy 54.2% Cost 1380
\[\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+143} \lor \neg \left(x \leq -1.9 \cdot 10^{+86}\right) \land \left(x \leq -7.4 \cdot 10^{-50} \lor \neg \left(x \leq -7.5 \cdot 10^{-162}\right) \land \left(x \leq -1.6 \cdot 10^{-239} \lor \neg \left(x \leq 5.4 \cdot 10^{-106}\right) \land \left(x \leq 3.5 \cdot 10^{+16} \lor \neg \left(x \leq 2.35 \cdot 10^{+60}\right)\right)\right)\right):\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\]
Alternative 7 Accuracy 63.4% Cost 1376
\[\begin{array}{l}
t_1 := x + t \cdot a\\
t_2 := z \cdot \left(y + b \cdot a\right)\\
t_3 := x + y \cdot z\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{+25}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-178}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-239}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.52 \cdot 10^{-103}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+61}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+197}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\]
Alternative 8 Accuracy 67.8% Cost 1368
\[\begin{array}{l}
t_1 := t \cdot a + y \cdot z\\
\mathbf{if}\;x \leq -19000000:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-163}:\\
\;\;\;\;z \cdot \left(y + b \cdot a\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+14}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+74}:\\
\;\;\;\;z \cdot \left(b \cdot a\right) + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\end{array}
\]
Alternative 9 Accuracy 68.0% Cost 1368
\[\begin{array}{l}
t_1 := t \cdot a + y \cdot z\\
\mathbf{if}\;x \leq -5800000:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;x \leq -7.8 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-158}:\\
\;\;\;\;b \cdot \left(z \cdot a\right) + y \cdot z\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+16}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+74}:\\
\;\;\;\;z \cdot \left(b \cdot a\right) + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\end{array}
\]
Alternative 10 Accuracy 67.8% Cost 1240
\[\begin{array}{l}
t_1 := t \cdot a + y \cdot z\\
t_2 := z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;x \leq -90000000:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-165}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+16}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\end{array}
\]
Alternative 11 Accuracy 76.7% Cost 1236
\[\begin{array}{l}
t_1 := t \cdot a + y \cdot z\\
t_2 := x + z \cdot \left(y + b \cdot a\right)\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+111}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.029:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-82}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 12 Accuracy 85.2% Cost 1236
\[\begin{array}{l}
t_1 := z \cdot \left(y + b \cdot a\right) + t \cdot a\\
t_2 := t \cdot a + \left(x + y \cdot z\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{-49}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-146}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+15}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.55 \cdot 10^{+75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+127}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 13 Accuracy 95.6% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;a \leq -6.4 \cdot 10^{-146} \lor \neg \left(a \leq 9.5 \cdot 10^{-136}\right):\\
\;\;\;\;\left(a \cdot \left(b \cdot z\right) + t \cdot a\right) + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + b \cdot a\right)\\
\end{array}
\]
Alternative 14 Accuracy 98.9% Cost 1225
\[\begin{array}{l}
t_1 := t \cdot a + \left(x + y \cdot z\right)\\
\mathbf{if}\;b \leq -2.7 \cdot 10^{+87} \lor \neg \left(b \leq 1.12 \cdot 10^{+136}\right):\\
\;\;\;\;b \cdot \left(z \cdot a\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(b \cdot a\right) + t_1\\
\end{array}
\]
Alternative 15 Accuracy 87.7% Cost 841
\[\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{-20} \lor \neg \left(t \leq 1.4 \cdot 10^{-106}\right):\\
\;\;\;\;t \cdot a + \left(x + y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + b \cdot a\right)\\
\end{array}
\]
Alternative 16 Accuracy 67.5% Cost 585
\[\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-42} \lor \neg \left(t \leq 2.8 \cdot 10^{+121}\right):\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\]
Alternative 17 Accuracy 48.5% Cost 456
\[\begin{array}{l}
\mathbf{if}\;x \leq -190000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-48}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 18 Accuracy 37.1% Cost 64
\[x
\]