
(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 99.5%
+-commutative99.5%
fma-define99.6%
flip-+63.7%
associate-*r/59.2%
fma-neg59.9%
associate-+l+59.9%
+-commutative59.9%
count-259.9%
associate-+l+59.9%
+-commutative59.9%
count-259.9%
fma-neg59.2%
associate-+l+59.2%
+-commutative59.2%
count-259.2%
Applied egg-rr99.6%
Final simplification99.6%
(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 99.5%
fma-define99.5%
associate-+l+99.5%
+-commutative99.5%
count-299.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -2.05e+54)
t_1
(if (<= x -1.05e-53)
(* x t)
(if (<= x 4.1e-19)
(* y 5.0)
(if (or (<= x 8.5e+75) (not (<= x 6.8e+217))) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -2.05e+54) {
tmp = t_1;
} else if (x <= -1.05e-53) {
tmp = x * t;
} else if (x <= 4.1e-19) {
tmp = y * 5.0;
} else if ((x <= 8.5e+75) || !(x <= 6.8e+217)) {
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 (x <= (-2.05d+54)) then
tmp = t_1
else if (x <= (-1.05d-53)) then
tmp = x * t
else if (x <= 4.1d-19) then
tmp = y * 5.0d0
else if ((x <= 8.5d+75) .or. (.not. (x <= 6.8d+217))) 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 (x <= -2.05e+54) {
tmp = t_1;
} else if (x <= -1.05e-53) {
tmp = x * t;
} else if (x <= 4.1e-19) {
tmp = y * 5.0;
} else if ((x <= 8.5e+75) || !(x <= 6.8e+217)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -2.05e+54: tmp = t_1 elif x <= -1.05e-53: tmp = x * t elif x <= 4.1e-19: tmp = y * 5.0 elif (x <= 8.5e+75) or not (x <= 6.8e+217): 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 (x <= -2.05e+54) tmp = t_1; elseif (x <= -1.05e-53) tmp = Float64(x * t); elseif (x <= 4.1e-19) tmp = Float64(y * 5.0); elseif ((x <= 8.5e+75) || !(x <= 6.8e+217)) 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 (x <= -2.05e+54) tmp = t_1; elseif (x <= -1.05e-53) tmp = x * t; elseif (x <= 4.1e-19) tmp = y * 5.0; elseif ((x <= 8.5e+75) || ~((x <= 6.8e+217))) 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[x, -2.05e+54], t$95$1, If[LessEqual[x, -1.05e-53], N[(x * t), $MachinePrecision], If[LessEqual[x, 4.1e-19], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 8.5e+75], N[Not[LessEqual[x, 6.8e+217]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-53}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-19}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+75} \lor \neg \left(x \leq 6.8 \cdot 10^{+217}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -2.04999999999999984e54 or 4.09999999999999985e-19 < x < 8.4999999999999993e75 or 6.7999999999999998e217 < x Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+80.5%
associate-*r/70.1%
fma-neg70.1%
associate-+l+70.1%
+-commutative70.1%
count-270.1%
associate-+l+70.1%
+-commutative70.1%
count-270.1%
fma-neg70.1%
associate-+l+70.1%
+-commutative70.1%
count-270.1%
Applied egg-rr99.9%
fma-undefine99.9%
fma-define99.9%
distribute-lft-in94.9%
*-commutative94.9%
associate-+r+94.9%
*-commutative94.9%
associate-*l*94.9%
*-commutative94.9%
*-commutative94.9%
Applied egg-rr94.9%
Taylor expanded in z around inf 49.6%
if -2.04999999999999984e54 < x < -1.04999999999999989e-53 or 8.4999999999999993e75 < x < 6.7999999999999998e217Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+64.4%
associate-*r/62.4%
fma-neg65.0%
associate-+l+65.0%
+-commutative65.0%
count-265.0%
associate-+l+65.0%
+-commutative65.0%
count-265.0%
fma-neg62.4%
associate-+l+62.4%
+-commutative62.4%
count-262.4%
Applied egg-rr100.0%
fma-undefine100.0%
fma-define100.0%
distribute-lft-in100.0%
*-commutative100.0%
associate-+r+100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in t around inf 55.0%
if -1.04999999999999989e-53 < x < 4.09999999999999985e-19Initial program 98.9%
Taylor expanded in x around 0 62.8%
Final simplification56.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* y 2.0)))))
(if (<= x -1.8e-57)
t_1
(if (<= x 3.8e-25) (* y 5.0) (if (<= x 1.04e+74) (* 2.0 (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -1.8e-57) {
tmp = t_1;
} else if (x <= 3.8e-25) {
tmp = y * 5.0;
} else if (x <= 1.04e+74) {
tmp = 2.0 * (x * z);
} else {
tmp = t_1;
}
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 * (t + (y * 2.0d0))
if (x <= (-1.8d-57)) then
tmp = t_1
else if (x <= 3.8d-25) then
tmp = y * 5.0d0
else if (x <= 1.04d+74) then
tmp = 2.0d0 * (x * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -1.8e-57) {
tmp = t_1;
} else if (x <= 3.8e-25) {
tmp = y * 5.0;
} else if (x <= 1.04e+74) {
tmp = 2.0 * (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y * 2.0)) tmp = 0 if x <= -1.8e-57: tmp = t_1 elif x <= 3.8e-25: tmp = y * 5.0 elif x <= 1.04e+74: tmp = 2.0 * (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y * 2.0))) tmp = 0.0 if (x <= -1.8e-57) tmp = t_1; elseif (x <= 3.8e-25) tmp = Float64(y * 5.0); elseif (x <= 1.04e+74) tmp = Float64(2.0 * Float64(x * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (y * 2.0)); tmp = 0.0; if (x <= -1.8e-57) tmp = t_1; elseif (x <= 3.8e-25) tmp = y * 5.0; elseif (x <= 1.04e+74) tmp = 2.0 * (x * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e-57], t$95$1, If[LessEqual[x, 3.8e-25], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.04e+74], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + y \cdot 2\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-25}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.04 \cdot 10^{+74}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.8000000000000001e-57 or 1.04e74 < x Initial program 100.0%
Taylor expanded in y around inf 73.1%
Taylor expanded in x around inf 71.8%
if -1.8000000000000001e-57 < x < 3.7999999999999998e-25Initial program 98.9%
Taylor expanded in x around 0 62.8%
if 3.7999999999999998e-25 < x < 1.04e74Initial program 99.9%
+-commutative99.9%
fma-define99.9%
flip-+60.8%
associate-*r/56.4%
fma-neg56.4%
associate-+l+56.4%
+-commutative56.4%
count-256.4%
associate-+l+56.4%
+-commutative56.4%
count-256.4%
fma-neg56.4%
associate-+l+56.4%
+-commutative56.4%
count-256.4%
Applied egg-rr99.9%
fma-undefine99.9%
fma-define99.9%
distribute-lft-in95.4%
*-commutative95.4%
associate-+r+95.4%
*-commutative95.4%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
Applied egg-rr95.4%
Taylor expanded in z around inf 57.6%
Final simplification66.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -2.5e+17)
t_1
(if (<= y 2.35e-51)
(* x (+ t (* z 2.0)))
(if (<= y 7.5e+56) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -2.5e+17) {
tmp = t_1;
} else if (y <= 2.35e-51) {
tmp = x * (t + (z * 2.0));
} else if (y <= 7.5e+56) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
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 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-2.5d+17)) then
tmp = t_1
else if (y <= 2.35d-51) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 7.5d+56) then
tmp = (y * 5.0d0) + (x * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -2.5e+17) {
tmp = t_1;
} else if (y <= 2.35e-51) {
tmp = x * (t + (z * 2.0));
} else if (y <= 7.5e+56) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -2.5e+17: tmp = t_1 elif y <= 2.35e-51: tmp = x * (t + (z * 2.0)) elif y <= 7.5e+56: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -2.5e+17) tmp = t_1; elseif (y <= 2.35e-51) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 7.5e+56) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -2.5e+17) tmp = t_1; elseif (y <= 2.35e-51) tmp = x * (t + (z * 2.0)); elseif (y <= 7.5e+56) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.5e+17], t$95$1, If[LessEqual[y, 2.35e-51], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+56], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-51}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+56}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.5e17 or 7.4999999999999999e56 < y Initial program 99.9%
Taylor expanded in y around inf 80.9%
if -2.5e17 < y < 2.3499999999999999e-51Initial program 99.2%
Taylor expanded in y around 0 99.2%
Taylor expanded in y around 0 82.6%
if 2.3499999999999999e-51 < y < 7.4999999999999999e56Initial program 99.8%
Taylor expanded in t around inf 75.4%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3e+19) (not (<= x 6.6e-25))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x (+ t (+ y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3e+19) || !(x <= 6.6e-25)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
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 ((x <= (-3d+19)) .or. (.not. (x <= 6.6d-25))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3e+19) || !(x <= 6.6e-25)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3e+19) or not (x <= 6.6e-25): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3e+19) || !(x <= 6.6e-25)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3e+19) || ~((x <= 6.6e-25))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3e+19], N[Not[LessEqual[x, 6.6e-25]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+19} \lor \neg \left(x \leq 6.6 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if x < -3e19 or 6.5999999999999997e-25 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.7%
if -3e19 < x < 6.5999999999999997e-25Initial program 99.0%
Taylor expanded in y around inf 82.9%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.8e-35) (not (<= x 2.9e-22))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e-35) || !(x <= 2.9e-22)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (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 ((x <= (-3.8d-35)) .or. (.not. (x <= 2.9d-22))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e-35) || !(x <= 2.9e-22)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e-35) or not (x <= 2.9e-22): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.8e-35) || !(x <= 2.9e-22)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.8e-35) || ~((x <= 2.9e-22))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.8e-35], N[Not[LessEqual[x, 2.9e-22]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-35} \lor \neg \left(x \leq 2.9 \cdot 10^{-22}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -3.8000000000000001e-35 or 2.9000000000000002e-22 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.7%
if -3.8000000000000001e-35 < x < 2.9000000000000002e-22Initial program 99.0%
Taylor expanded in t around inf 82.4%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.4e+50) (not (<= z 2.1e-10))) (* x (+ t (* z 2.0))) (* x (+ t (* y 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e+50) || !(z <= 2.1e-10)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = x * (t + (y * 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 ((z <= (-2.4d+50)) .or. (.not. (z <= 2.1d-10))) then
tmp = x * (t + (z * 2.0d0))
else
tmp = x * (t + (y * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.4e+50) || !(z <= 2.1e-10)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = x * (t + (y * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.4e+50) or not (z <= 2.1e-10): tmp = x * (t + (z * 2.0)) else: tmp = x * (t + (y * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.4e+50) || !(z <= 2.1e-10)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(x * Float64(t + Float64(y * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.4e+50) || ~((z <= 2.1e-10))) tmp = x * (t + (z * 2.0)); else tmp = x * (t + (y * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.4e+50], N[Not[LessEqual[z, 2.1e-10]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+50} \lor \neg \left(z \leq 2.1 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if z < -2.4000000000000002e50 or 2.1e-10 < z Initial program 99.1%
Taylor expanded in y around 0 95.0%
Taylor expanded in y around 0 70.8%
if -2.4000000000000002e50 < z < 2.1e-10Initial program 99.9%
Taylor expanded in y around inf 96.5%
Taylor expanded in x around inf 64.5%
Final simplification67.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e+17) (not (<= y 2.4e-51))) (* 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 <= -4e+17) || !(y <= 2.4e-51)) {
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 <= (-4d+17)) .or. (.not. (y <= 2.4d-51))) 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 <= -4e+17) || !(y <= 2.4e-51)) {
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 <= -4e+17) or not (y <= 2.4e-51): 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 <= -4e+17) || !(y <= 2.4e-51)) 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 <= -4e+17) || ~((y <= 2.4e-51))) 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, -4e+17], N[Not[LessEqual[y, 2.4e-51]], $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 -4 \cdot 10^{+17} \lor \neg \left(y \leq 2.4 \cdot 10^{-51}\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 < -4e17 or 2.4e-51 < y Initial program 99.9%
Taylor expanded in y around inf 75.9%
if -4e17 < y < 2.4e-51Initial program 99.2%
Taylor expanded in y around 0 99.2%
Taylor expanded in y around 0 82.6%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.12e-54) (not (<= x 1.7e-5))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-54) || !(x <= 1.7e-5)) {
tmp = x * t;
} else {
tmp = y * 5.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 ((x <= (-1.12d-54)) .or. (.not. (x <= 1.7d-5))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.12e-54) || !(x <= 1.7e-5)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.12e-54) or not (x <= 1.7e-5): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.12e-54) || !(x <= 1.7e-5)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.12e-54) || ~((x <= 1.7e-5))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.12e-54], N[Not[LessEqual[x, 1.7e-5]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-54} \lor \neg \left(x \leq 1.7 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.11999999999999994e-54 or 1.7e-5 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+76.0%
associate-*r/68.2%
fma-neg69.1%
associate-+l+69.1%
+-commutative69.1%
count-269.1%
associate-+l+69.1%
+-commutative69.1%
count-269.1%
fma-neg68.2%
associate-+l+68.2%
+-commutative68.2%
count-268.2%
Applied egg-rr100.0%
fma-undefine100.0%
fma-define100.0%
distribute-lft-in96.5%
*-commutative96.5%
associate-+r+96.5%
*-commutative96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
Applied egg-rr96.5%
Taylor expanded in t around inf 37.4%
if -1.11999999999999994e-54 < x < 1.7e-5Initial program 99.0%
Taylor expanded in x around 0 61.6%
Final simplification48.0%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + ((y + z) * 2.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 = (y * 5.0d0) + (x * (t + ((y + z) * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + ((y + z) * 2.0)));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + ((y + z) * 2.0)))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + ((y + z) * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + z\right) \cdot 2\right)
\end{array}
Initial program 99.5%
associate-+l+99.5%
+-commutative99.5%
count-299.5%
*-commutative99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return 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 = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 28.5%
Final simplification28.5%
(FPCore (x y z t) :precision binary64 -1.0)
double code(double x, double y, double z, double t) {
return -1.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 = -1.0d0
end function
public static double code(double x, double y, double z, double t) {
return -1.0;
}
def code(x, y, z, t): return -1.0
function code(x, y, z, t) return -1.0 end
function tmp = code(x, y, z, t) tmp = -1.0; end
code[x_, y_, z_, t_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.6%
flip-+63.7%
associate-*r/59.2%
fma-neg59.9%
associate-+l+59.9%
+-commutative59.9%
count-259.9%
associate-+l+59.9%
+-commutative59.9%
count-259.9%
fma-neg59.2%
associate-+l+59.2%
+-commutative59.2%
count-259.2%
Applied egg-rr99.6%
fma-undefine99.5%
fma-define99.5%
distribute-lft-in97.6%
*-commutative97.6%
associate-+r+97.6%
*-commutative97.6%
associate-*l*98.0%
*-commutative98.0%
*-commutative98.0%
Applied egg-rr98.0%
Taylor expanded in y around 0 55.2%
Simplified2.8%
Final simplification2.8%
herbie shell --seed 2024034
(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)))