
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
distribute-rgt-in97.2%
associate-+l+97.2%
+-commutative97.2%
count-297.2%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= t -4e+97)
(* x t)
(if (<= t -6e-254)
t_1
(if (<= t 2.9e-217)
(* y 5.0)
(if (<= t 3.2e-134)
t_1
(if (<= t 52000000000.0)
(* x (* y 2.0))
(if (<= t 3.1e+62) t_1 (* x t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -4e+97) {
tmp = x * t;
} else if (t <= -6e-254) {
tmp = t_1;
} else if (t <= 2.9e-217) {
tmp = y * 5.0;
} else if (t <= 3.2e-134) {
tmp = t_1;
} else if (t <= 52000000000.0) {
tmp = x * (y * 2.0);
} else if (t <= 3.1e+62) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (t <= (-4d+97)) then
tmp = x * t
else if (t <= (-6d-254)) then
tmp = t_1
else if (t <= 2.9d-217) then
tmp = y * 5.0d0
else if (t <= 3.2d-134) then
tmp = t_1
else if (t <= 52000000000.0d0) then
tmp = x * (y * 2.0d0)
else if (t <= 3.1d+62) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -4e+97) {
tmp = x * t;
} else if (t <= -6e-254) {
tmp = t_1;
} else if (t <= 2.9e-217) {
tmp = y * 5.0;
} else if (t <= 3.2e-134) {
tmp = t_1;
} else if (t <= 52000000000.0) {
tmp = x * (y * 2.0);
} else if (t <= 3.1e+62) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if t <= -4e+97: tmp = x * t elif t <= -6e-254: tmp = t_1 elif t <= 2.9e-217: tmp = y * 5.0 elif t <= 3.2e-134: tmp = t_1 elif t <= 52000000000.0: tmp = x * (y * 2.0) elif t <= 3.1e+62: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (t <= -4e+97) tmp = Float64(x * t); elseif (t <= -6e-254) tmp = t_1; elseif (t <= 2.9e-217) tmp = Float64(y * 5.0); elseif (t <= 3.2e-134) tmp = t_1; elseif (t <= 52000000000.0) tmp = Float64(x * Float64(y * 2.0)); elseif (t <= 3.1e+62) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (t <= -4e+97) tmp = x * t; elseif (t <= -6e-254) tmp = t_1; elseif (t <= 2.9e-217) tmp = y * 5.0; elseif (t <= 3.2e-134) tmp = t_1; elseif (t <= 52000000000.0) tmp = x * (y * 2.0); elseif (t <= 3.1e+62) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4e+97], N[(x * t), $MachinePrecision], If[LessEqual[t, -6e-254], t$95$1, If[LessEqual[t, 2.9e-217], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 3.2e-134], t$95$1, If[LessEqual[t, 52000000000.0], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+62], t$95$1, N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;t \leq -4 \cdot 10^{+97}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -6 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 52000000000:\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -4.0000000000000003e97 or 3.10000000000000014e62 < t Initial program 100.0%
Taylor expanded in t around inf 69.1%
if -4.0000000000000003e97 < t < -6.00000000000000023e-254 or 2.89999999999999982e-217 < t < 3.2000000000000001e-134 or 5.2e10 < t < 3.10000000000000014e62Initial program 99.9%
Taylor expanded in z around inf 54.8%
if -6.00000000000000023e-254 < t < 2.89999999999999982e-217Initial program 99.9%
Taylor expanded in x around 0 45.6%
Simplified45.6%
if 3.2000000000000001e-134 < t < 5.2e10Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around 0 92.5%
Taylor expanded in x around inf 71.4%
*-commutative71.4%
*-commutative71.4%
associate-*r*71.4%
Simplified71.4%
Taylor expanded in y around inf 49.1%
associate-*r*49.1%
Simplified49.1%
Final simplification58.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* (+ y z) 2.0))))
(if (<= t -5.8e+115)
(* x t)
(if (<= t 9.5e-246)
t_1
(if (<= t 2.9e-217) (* y 5.0) (if (<= t 2.65e+70) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (t <= -5.8e+115) {
tmp = x * t;
} else if (t <= 9.5e-246) {
tmp = t_1;
} else if (t <= 2.9e-217) {
tmp = y * 5.0;
} else if (t <= 2.65e+70) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((y + z) * 2.0d0)
if (t <= (-5.8d+115)) then
tmp = x * t
else if (t <= 9.5d-246) then
tmp = t_1
else if (t <= 2.9d-217) then
tmp = y * 5.0d0
else if (t <= 2.65d+70) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (t <= -5.8e+115) {
tmp = x * t;
} else if (t <= 9.5e-246) {
tmp = t_1;
} else if (t <= 2.9e-217) {
tmp = y * 5.0;
} else if (t <= 2.65e+70) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + z) * 2.0) tmp = 0 if t <= -5.8e+115: tmp = x * t elif t <= 9.5e-246: tmp = t_1 elif t <= 2.9e-217: tmp = y * 5.0 elif t <= 2.65e+70: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) tmp = 0.0 if (t <= -5.8e+115) tmp = Float64(x * t); elseif (t <= 9.5e-246) tmp = t_1; elseif (t <= 2.9e-217) tmp = Float64(y * 5.0); elseif (t <= 2.65e+70) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + z) * 2.0); tmp = 0.0; if (t <= -5.8e+115) tmp = x * t; elseif (t <= 9.5e-246) tmp = t_1; elseif (t <= 2.9e-217) tmp = y * 5.0; elseif (t <= 2.65e+70) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.8e+115], N[(x * t), $MachinePrecision], If[LessEqual[t, 9.5e-246], t$95$1, If[LessEqual[t, 2.9e-217], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 2.65e+70], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;t \leq -5.8 \cdot 10^{+115}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-246}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -5.80000000000000009e115 or 2.65e70 < t Initial program 100.0%
Taylor expanded in t around inf 70.8%
if -5.80000000000000009e115 < t < 9.5000000000000002e-246 or 2.89999999999999982e-217 < t < 2.65e70Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 73.2%
Taylor expanded in t around 0 65.7%
associate-*r*65.7%
*-commutative65.7%
Simplified65.7%
if 9.5000000000000002e-246 < t < 2.89999999999999982e-217Initial program 100.0%
Taylor expanded in x around 0 84.2%
Simplified84.2%
Final simplification68.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* (+ y z) 2.0))))
(if (<= t -6.5e+115)
(* x t)
(if (<= t -4.9e-254)
t_1
(if (<= t 1.05e-205)
(* y (+ 5.0 (* x 2.0)))
(if (<= t 2.65e+67) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (t <= -6.5e+115) {
tmp = x * t;
} else if (t <= -4.9e-254) {
tmp = t_1;
} else if (t <= 1.05e-205) {
tmp = y * (5.0 + (x * 2.0));
} else if (t <= 2.65e+67) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * ((y + z) * 2.0d0)
if (t <= (-6.5d+115)) then
tmp = x * t
else if (t <= (-4.9d-254)) then
tmp = t_1
else if (t <= 1.05d-205) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if (t <= 2.65d+67) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double tmp;
if (t <= -6.5e+115) {
tmp = x * t;
} else if (t <= -4.9e-254) {
tmp = t_1;
} else if (t <= 1.05e-205) {
tmp = y * (5.0 + (x * 2.0));
} else if (t <= 2.65e+67) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + z) * 2.0) tmp = 0 if t <= -6.5e+115: tmp = x * t elif t <= -4.9e-254: tmp = t_1 elif t <= 1.05e-205: tmp = y * (5.0 + (x * 2.0)) elif t <= 2.65e+67: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) tmp = 0.0 if (t <= -6.5e+115) tmp = Float64(x * t); elseif (t <= -4.9e-254) tmp = t_1; elseif (t <= 1.05e-205) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif (t <= 2.65e+67) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + z) * 2.0); tmp = 0.0; if (t <= -6.5e+115) tmp = x * t; elseif (t <= -4.9e-254) tmp = t_1; elseif (t <= 1.05e-205) tmp = y * (5.0 + (x * 2.0)); elseif (t <= 2.65e+67) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e+115], N[(x * t), $MachinePrecision], If[LessEqual[t, -4.9e-254], t$95$1, If[LessEqual[t, 1.05e-205], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.65e+67], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{+115}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{-205}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -6.49999999999999966e115 or 2.65e67 < t Initial program 100.0%
Taylor expanded in t around inf 70.8%
if -6.49999999999999966e115 < t < -4.8999999999999998e-254 or 1.04999999999999991e-205 < t < 2.65e67Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 75.3%
Taylor expanded in t around 0 65.7%
associate-*r*65.7%
*-commutative65.7%
Simplified65.7%
if -4.8999999999999998e-254 < t < 1.04999999999999991e-205Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 73.6%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* (+ y z) 2.0))) (t_2 (* x (+ t (* y 2.0)))))
(if (<= t -7.5e+97)
t_2
(if (<= t -4.9e-254)
t_1
(if (<= t 4e-205)
(* y (+ 5.0 (* x 2.0)))
(if (<= t 2.05e+61) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double t_2 = x * (t + (y * 2.0));
double tmp;
if (t <= -7.5e+97) {
tmp = t_2;
} else if (t <= -4.9e-254) {
tmp = t_1;
} else if (t <= 4e-205) {
tmp = y * (5.0 + (x * 2.0));
} else if (t <= 2.05e+61) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y + z) * 2.0d0)
t_2 = x * (t + (y * 2.0d0))
if (t <= (-7.5d+97)) then
tmp = t_2
else if (t <= (-4.9d-254)) then
tmp = t_1
else if (t <= 4d-205) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if (t <= 2.05d+61) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y + z) * 2.0);
double t_2 = x * (t + (y * 2.0));
double tmp;
if (t <= -7.5e+97) {
tmp = t_2;
} else if (t <= -4.9e-254) {
tmp = t_1;
} else if (t <= 4e-205) {
tmp = y * (5.0 + (x * 2.0));
} else if (t <= 2.05e+61) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + z) * 2.0) t_2 = x * (t + (y * 2.0)) tmp = 0 if t <= -7.5e+97: tmp = t_2 elif t <= -4.9e-254: tmp = t_1 elif t <= 4e-205: tmp = y * (5.0 + (x * 2.0)) elif t <= 2.05e+61: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + z) * 2.0)) t_2 = Float64(x * Float64(t + Float64(y * 2.0))) tmp = 0.0 if (t <= -7.5e+97) tmp = t_2; elseif (t <= -4.9e-254) tmp = t_1; elseif (t <= 4e-205) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif (t <= 2.05e+61) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + z) * 2.0); t_2 = x * (t + (y * 2.0)); tmp = 0.0; if (t <= -7.5e+97) tmp = t_2; elseif (t <= -4.9e-254) tmp = t_1; elseif (t <= 4e-205) tmp = y * (5.0 + (x * 2.0)); elseif (t <= 2.05e+61) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e+97], t$95$2, If[LessEqual[t, -4.9e-254], t$95$1, If[LessEqual[t, 4e-205], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.05e+61], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\left(y + z\right) \cdot 2\right)\\
t_2 := x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+97}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -4.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-205}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -7.5000000000000004e97 or 2.04999999999999986e61 < t Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 89.7%
Taylor expanded in x around inf 74.6%
if -7.5000000000000004e97 < t < -4.8999999999999998e-254 or 4e-205 < t < 2.04999999999999986e61Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 76.1%
Taylor expanded in t around 0 67.0%
associate-*r*67.0%
*-commutative67.0%
Simplified67.0%
if -4.8999999999999998e-254 < t < 4e-205Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 73.6%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.25e+15) (not (<= y 8e+21))) (+ (* y 5.0) (* 2.0 (* x (+ y z)))) (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.25e+15) || !(y <= 8e+21)) {
tmp = (y * 5.0) + (2.0 * (x * (y + z)));
} else {
tmp = x * (t + ((y + z) * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2.25d+15)) .or. (.not. (y <= 8d+21))) then
tmp = (y * 5.0d0) + (2.0d0 * (x * (y + z)))
else
tmp = x * (t + ((y + z) * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.25e+15) || !(y <= 8e+21)) {
tmp = (y * 5.0) + (2.0 * (x * (y + z)));
} else {
tmp = x * (t + ((y + z) * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.25e+15) or not (y <= 8e+21): tmp = (y * 5.0) + (2.0 * (x * (y + z))) else: tmp = x * (t + ((y + z) * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.25e+15) || !(y <= 8e+21)) tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * Float64(y + z)))); else tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.25e+15) || ~((y <= 8e+21))) tmp = (y * 5.0) + (2.0 * (x * (y + z))); else tmp = x * (t + ((y + z) * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.25e+15], N[Not[LessEqual[y, 8e+21]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{+15} \lor \neg \left(y \leq 8 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\end{array}
\end{array}
if y < -2.25e15 or 8e21 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in t around 0 93.6%
if -2.25e15 < y < 8e21Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 91.5%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * 5.0d0) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= t -2.7e+97)
(* x t)
(if (<= t -3.9e-254)
t_1
(if (<= t 3.1e-217) (* y 5.0) (if (<= t 1.8e+69) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -2.7e+97) {
tmp = x * t;
} else if (t <= -3.9e-254) {
tmp = t_1;
} else if (t <= 3.1e-217) {
tmp = y * 5.0;
} else if (t <= 1.8e+69) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (t <= (-2.7d+97)) then
tmp = x * t
else if (t <= (-3.9d-254)) then
tmp = t_1
else if (t <= 3.1d-217) then
tmp = y * 5.0d0
else if (t <= 1.8d+69) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (t <= -2.7e+97) {
tmp = x * t;
} else if (t <= -3.9e-254) {
tmp = t_1;
} else if (t <= 3.1e-217) {
tmp = y * 5.0;
} else if (t <= 1.8e+69) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if t <= -2.7e+97: tmp = x * t elif t <= -3.9e-254: tmp = t_1 elif t <= 3.1e-217: tmp = y * 5.0 elif t <= 1.8e+69: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (t <= -2.7e+97) tmp = Float64(x * t); elseif (t <= -3.9e-254) tmp = t_1; elseif (t <= 3.1e-217) tmp = Float64(y * 5.0); elseif (t <= 1.8e+69) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (t <= -2.7e+97) tmp = x * t; elseif (t <= -3.9e-254) tmp = t_1; elseif (t <= 3.1e-217) tmp = y * 5.0; elseif (t <= 1.8e+69) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.7e+97], N[(x * t), $MachinePrecision], If[LessEqual[t, -3.9e-254], t$95$1, If[LessEqual[t, 3.1e-217], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 1.8e+69], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{+97}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq -3.9 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-217}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -2.69999999999999993e97 or 1.8000000000000001e69 < t Initial program 100.0%
Taylor expanded in t around inf 69.1%
if -2.69999999999999993e97 < t < -3.9e-254 or 3.0999999999999999e-217 < t < 1.8000000000000001e69Initial program 99.9%
Taylor expanded in z around inf 49.2%
if -3.9e-254 < t < 3.0999999999999999e-217Initial program 99.9%
Taylor expanded in x around 0 45.6%
Simplified45.6%
Final simplification56.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.4e+47) (not (<= y 1.4e+60))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.4e+47) || !(y <= 1.4e+60)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + ((y + z) * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4.4d+47)) .or. (.not. (y <= 1.4d+60))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + ((y + z) * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.4e+47) || !(y <= 1.4e+60)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + ((y + z) * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.4e+47) or not (y <= 1.4e+60): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + ((y + z) * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.4e+47) || !(y <= 1.4e+60)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.4e+47) || ~((y <= 1.4e+60))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + ((y + z) * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.4e+47], N[Not[LessEqual[y, 1.4e+60]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+47} \lor \neg \left(y \leq 1.4 \cdot 10^{+60}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\end{array}
\end{array}
if y < -4.3999999999999999e47 or 1.4e60 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 84.5%
if -4.3999999999999999e47 < y < 1.4e60Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 90.5%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.2e+47) (not (<= y 6.5e+48))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+47) || !(y <= 6.5e+48)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.2d+47)) .or. (.not. (y <= 6.5d+48))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.2e+47) || !(y <= 6.5e+48)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.2e+47) or not (y <= 6.5e+48): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.2e+47) || !(y <= 6.5e+48)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.2e+47) || ~((y <= 6.5e+48))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.2e+47], N[Not[LessEqual[y, 6.5e+48]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+47} \lor \neg \left(y \leq 6.5 \cdot 10^{+48}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -7.20000000000000015e47 or 6.49999999999999972e48 < y Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 84.1%
if -7.20000000000000015e47 < y < 6.49999999999999972e48Initial program 100.0%
Taylor expanded in y around 0 86.6%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2e-36) (* x t) (if (<= t 1.8e+17) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e-36) {
tmp = x * t;
} else if (t <= 1.8e+17) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2d-36)) then
tmp = x * t
else if (t <= 1.8d+17) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2e-36) {
tmp = x * t;
} else if (t <= 1.8e+17) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2e-36: tmp = x * t elif t <= 1.8e+17: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2e-36) tmp = Float64(x * t); elseif (t <= 1.8e+17) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2e-36) tmp = x * t; elseif (t <= 1.8e+17) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2e-36], N[(x * t), $MachinePrecision], If[LessEqual[t, 1.8e+17], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{-36}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+17}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -1.9999999999999999e-36 or 1.8e17 < t Initial program 100.0%
Taylor expanded in t around inf 57.9%
if -1.9999999999999999e-36 < t < 1.8e17Initial program 99.9%
Taylor expanded in x around 0 34.8%
Simplified34.8%
Final simplification46.9%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 32.6%
Final simplification32.6%
herbie shell --seed 2023181
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))