
(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 12 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.9%
+-commutative99.9%
fma-define100.0%
flip-+63.2%
associate-*r/58.9%
fmm-def60.7%
associate-+l+60.7%
+-commutative60.7%
count-260.7%
associate-+l+60.7%
+-commutative60.7%
count-260.7%
fmm-def58.9%
associate-+l+58.9%
+-commutative58.9%
count-258.9%
Applied egg-rr100.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 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8e+234) (not (<= y 1.15e+163))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e+234) || !(y <= 1.15e+163)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
}
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 <= (-8d+234)) .or. (.not. (y <= 1.15d+163))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e+234) || !(y <= 1.15e+163)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8e+234) or not (y <= 1.15e+163): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8e+234) || !(y <= 1.15e+163)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(Float64(Float64(y + z) * 2.0) + Float64(5.0 * Float64(y / x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8e+234) || ~((y <= 1.15e+163))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8e+234], N[Not[LessEqual[y, 1.15e+163]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+234} \lor \neg \left(y \leq 1.15 \cdot 10^{+163}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if y < -8.00000000000000014e234 or 1.15000000000000001e163 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 95.1%
if -8.00000000000000014e234 < y < 1.15000000000000001e163Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 97.7%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* (+ y z) 2.0)))))
(if (<= x -6e-120)
t_1
(if (<= x 7.5e-251)
(+ (* y 5.0) (* x t))
(if (<= x 0.55) (+ (* y 5.0) (* 2.0 (* x z))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + ((y + z) * 2.0));
double tmp;
if (x <= -6e-120) {
tmp = t_1;
} else if (x <= 7.5e-251) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 0.55) {
tmp = (y * 5.0) + (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 + z) * 2.0d0))
if (x <= (-6d-120)) then
tmp = t_1
else if (x <= 7.5d-251) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 0.55d0) then
tmp = (y * 5.0d0) + (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 + z) * 2.0));
double tmp;
if (x <= -6e-120) {
tmp = t_1;
} else if (x <= 7.5e-251) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 0.55) {
tmp = (y * 5.0) + (2.0 * (x * z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + ((y + z) * 2.0)) tmp = 0 if x <= -6e-120: tmp = t_1 elif x <= 7.5e-251: tmp = (y * 5.0) + (x * t) elif x <= 0.55: tmp = (y * 5.0) + (2.0 * (x * z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))) tmp = 0.0 if (x <= -6e-120) tmp = t_1; elseif (x <= 7.5e-251) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 0.55) tmp = Float64(Float64(y * 5.0) + 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 + z) * 2.0)); tmp = 0.0; if (x <= -6e-120) tmp = t_1; elseif (x <= 7.5e-251) tmp = (y * 5.0) + (x * t); elseif (x <= 0.55) tmp = (y * 5.0) + (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[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e-120], t$95$1, If[LessEqual[x, 7.5e-251], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.55], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{-120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-251}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 0.55:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.00000000000000022e-120 or 0.55000000000000004 < 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 96.4%
if -6.00000000000000022e-120 < x < 7.5000000000000004e-251Initial program 99.8%
Taylor expanded in t around inf 85.4%
if 7.5000000000000004e-251 < x < 0.55000000000000004Initial program 99.9%
Taylor expanded in z around inf 84.4%
Final simplification91.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= z -7.4e+90)
t_1
(if (<= z 2.3e-52)
(* x (+ t (* y 2.0)))
(if (<= z 2e+38) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (z <= -7.4e+90) {
tmp = t_1;
} else if (z <= 2.3e-52) {
tmp = x * (t + (y * 2.0));
} else if (z <= 2e+38) {
tmp = y * 5.0;
} 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 = 2.0d0 * (x * z)
if (z <= (-7.4d+90)) then
tmp = t_1
else if (z <= 2.3d-52) then
tmp = x * (t + (y * 2.0d0))
else if (z <= 2d+38) then
tmp = y * 5.0d0
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 = 2.0 * (x * z);
double tmp;
if (z <= -7.4e+90) {
tmp = t_1;
} else if (z <= 2.3e-52) {
tmp = x * (t + (y * 2.0));
} else if (z <= 2e+38) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if z <= -7.4e+90: tmp = t_1 elif z <= 2.3e-52: tmp = x * (t + (y * 2.0)) elif z <= 2e+38: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (z <= -7.4e+90) tmp = t_1; elseif (z <= 2.3e-52) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif (z <= 2e+38) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (z <= -7.4e+90) tmp = t_1; elseif (z <= 2.3e-52) tmp = x * (t + (y * 2.0)); elseif (z <= 2e+38) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.4e+90], t$95$1, If[LessEqual[z, 2.3e-52], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+38], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -7.4 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-52}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.4e90 or 1.99999999999999995e38 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+45.5%
associate-*r/42.1%
fmm-def44.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
fmm-def42.1%
associate-+l+42.1%
+-commutative42.1%
count-242.1%
Applied egg-rr100.0%
Taylor expanded in z around inf 65.0%
if -7.4e90 < z < 2.29999999999999994e-52Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 74.8%
Taylor expanded in y around inf 69.3%
if 2.29999999999999994e-52 < z < 1.99999999999999995e38Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+67.8%
associate-*r/67.7%
fmm-def72.2%
associate-+l+72.2%
+-commutative72.2%
count-272.2%
associate-+l+72.2%
+-commutative72.2%
count-272.2%
fmm-def67.7%
associate-+l+67.7%
+-commutative67.7%
count-267.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 58.6%
*-commutative58.6%
Simplified58.6%
Final simplification66.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= z -6e+90)
t_1
(if (<= z 1.6e-63) (* x t) (if (<= z 2.4e+37) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (z <= -6e+90) {
tmp = t_1;
} else if (z <= 1.6e-63) {
tmp = x * t;
} else if (z <= 2.4e+37) {
tmp = y * 5.0;
} 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 = 2.0d0 * (x * z)
if (z <= (-6d+90)) then
tmp = t_1
else if (z <= 1.6d-63) then
tmp = x * t
else if (z <= 2.4d+37) then
tmp = y * 5.0d0
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 = 2.0 * (x * z);
double tmp;
if (z <= -6e+90) {
tmp = t_1;
} else if (z <= 1.6e-63) {
tmp = x * t;
} else if (z <= 2.4e+37) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if z <= -6e+90: tmp = t_1 elif z <= 1.6e-63: tmp = x * t elif z <= 2.4e+37: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (z <= -6e+90) tmp = t_1; elseif (z <= 1.6e-63) tmp = Float64(x * t); elseif (z <= 2.4e+37) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (z <= -6e+90) tmp = t_1; elseif (z <= 1.6e-63) tmp = x * t; elseif (z <= 2.4e+37) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+90], t$95$1, If[LessEqual[z, 1.6e-63], N[(x * t), $MachinePrecision], If[LessEqual[z, 2.4e+37], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-63}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+37}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.99999999999999957e90 or 2.4e37 < z Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+45.5%
associate-*r/42.1%
fmm-def44.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
associate-+l+44.5%
+-commutative44.5%
count-244.5%
fmm-def42.1%
associate-+l+42.1%
+-commutative42.1%
count-242.1%
Applied egg-rr100.0%
Taylor expanded in z around inf 65.0%
if -5.99999999999999957e90 < z < 1.59999999999999994e-63Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+76.5%
associate-*r/70.7%
fmm-def71.5%
associate-+l+71.5%
+-commutative71.5%
count-271.5%
associate-+l+71.5%
+-commutative71.5%
count-271.5%
fmm-def70.7%
associate-+l+70.7%
+-commutative70.7%
count-270.7%
Applied egg-rr100.0%
Taylor expanded in t around inf 48.6%
*-commutative48.6%
Simplified48.6%
if 1.59999999999999994e-63 < z < 2.4e37Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+67.8%
associate-*r/67.7%
fmm-def72.2%
associate-+l+72.2%
+-commutative72.2%
count-272.2%
associate-+l+72.2%
+-commutative72.2%
count-272.2%
fmm-def67.7%
associate-+l+67.7%
+-commutative67.7%
count-267.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 58.6%
*-commutative58.6%
Simplified58.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.7e-120) (not (<= x 5.1e-28))) (* 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 <= -5.7e-120) || !(x <= 5.1e-28)) {
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 <= (-5.7d-120)) .or. (.not. (x <= 5.1d-28))) 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 <= -5.7e-120) || !(x <= 5.1e-28)) {
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 <= -5.7e-120) or not (x <= 5.1e-28): 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 <= -5.7e-120) || !(x <= 5.1e-28)) 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 <= -5.7e-120) || ~((x <= 5.1e-28))) 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, -5.7e-120], N[Not[LessEqual[x, 5.1e-28]], $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 -5.7 \cdot 10^{-120} \lor \neg \left(x \leq 5.1 \cdot 10^{-28}\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 < -5.70000000000000031e-120 or 5.10000000000000009e-28 < 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 94.9%
if -5.70000000000000031e-120 < x < 5.10000000000000009e-28Initial program 99.9%
Taylor expanded in t around inf 80.3%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.8e+96) (not (<= y 6.2e+16))) (* 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 <= -6.8e+96) || !(y <= 6.2e+16)) {
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 <= (-6.8d+96)) .or. (.not. (y <= 6.2d+16))) 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 <= -6.8e+96) || !(y <= 6.2e+16)) {
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 <= -6.8e+96) or not (y <= 6.2e+16): 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 <= -6.8e+96) || !(y <= 6.2e+16)) 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 <= -6.8e+96) || ~((y <= 6.2e+16))) 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, -6.8e+96], N[Not[LessEqual[y, 6.2e+16]], $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 -6.8 \cdot 10^{+96} \lor \neg \left(y \leq 6.2 \cdot 10^{+16}\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 < -6.8000000000000002e96 or 6.2e16 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 80.8%
if -6.8000000000000002e96 < y < 6.2e16Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+70.5%
associate-*r/67.2%
fmm-def67.5%
associate-+l+67.5%
+-commutative67.5%
count-267.5%
associate-+l+67.5%
+-commutative67.5%
count-267.5%
fmm-def67.2%
associate-+l+67.2%
+-commutative67.2%
count-267.2%
Applied egg-rr100.0%
Taylor expanded in y around 0 79.8%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1e+14) (* x (+ t (* y 2.0))) (if (<= y 4.6e+121) (* x (+ t (* z 2.0))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+14) {
tmp = x * (t + (y * 2.0));
} else if (y <= 4.6e+121) {
tmp = x * (t + (z * 2.0));
} 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 (y <= (-1d+14)) then
tmp = x * (t + (y * 2.0d0))
else if (y <= 4.6d+121) then
tmp = x * (t + (z * 2.0d0))
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 (y <= -1e+14) {
tmp = x * (t + (y * 2.0));
} else if (y <= 4.6e+121) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1e+14: tmp = x * (t + (y * 2.0)) elif y <= 4.6e+121: tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1e+14) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif (y <= 4.6e+121) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1e+14) tmp = x * (t + (y * 2.0)); elseif (y <= 4.6e+121) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1e+14], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e+121], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+121}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -1e14Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 66.9%
Taylor expanded in y around inf 62.1%
if -1e14 < y < 4.5999999999999997e121Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+70.4%
associate-*r/65.9%
fmm-def66.2%
associate-+l+66.2%
+-commutative66.2%
count-266.2%
associate-+l+66.2%
+-commutative66.2%
count-266.2%
fmm-def65.9%
associate-+l+65.9%
+-commutative65.9%
count-265.9%
Applied egg-rr100.0%
Taylor expanded in y around 0 75.0%
if 4.5999999999999997e121 < y Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+27.5%
associate-*r/24.1%
fmm-def27.9%
associate-+l+27.9%
+-commutative27.9%
count-227.9%
associate-+l+27.9%
+-commutative27.9%
count-227.9%
fmm-def24.1%
associate-+l+24.1%
+-commutative24.1%
count-224.1%
Applied egg-rr100.0%
Taylor expanded in x around 0 62.5%
*-commutative62.5%
Simplified62.5%
Final simplification71.5%
(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 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.62e-102) (not (<= x 2e+31))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.62e-102) || !(x <= 2e+31)) {
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.62d-102)) .or. (.not. (x <= 2d+31))) 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.62e-102) || !(x <= 2e+31)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.62e-102) or not (x <= 2e+31): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.62e-102) || !(x <= 2e+31)) 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.62e-102) || ~((x <= 2e+31))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.62e-102], N[Not[LessEqual[x, 2e+31]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.62 \cdot 10^{-102} \lor \neg \left(x \leq 2 \cdot 10^{+31}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.61999999999999996e-102 or 1.9999999999999999e31 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+74.8%
associate-*r/66.9%
fmm-def70.0%
associate-+l+70.0%
+-commutative70.0%
count-270.0%
associate-+l+70.0%
+-commutative70.0%
count-270.0%
fmm-def66.9%
associate-+l+66.9%
+-commutative66.9%
count-266.9%
Applied egg-rr100.0%
Taylor expanded in t around inf 42.3%
*-commutative42.3%
Simplified42.3%
if -1.61999999999999996e-102 < x < 1.9999999999999999e31Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+49.5%
associate-*r/49.4%
fmm-def49.7%
associate-+l+49.7%
+-commutative49.7%
count-249.7%
associate-+l+49.7%
+-commutative49.7%
count-249.7%
fmm-def49.4%
associate-+l+49.4%
+-commutative49.4%
count-249.4%
Applied egg-rr100.0%
Taylor expanded in x around 0 54.3%
*-commutative54.3%
Simplified54.3%
Final simplification47.8%
(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 99.9%
+-commutative99.9%
fma-define100.0%
flip-+63.2%
associate-*r/58.9%
fmm-def60.7%
associate-+l+60.7%
+-commutative60.7%
count-260.7%
associate-+l+60.7%
+-commutative60.7%
count-260.7%
fmm-def58.9%
associate-+l+58.9%
+-commutative58.9%
count-258.9%
Applied egg-rr100.0%
Taylor expanded in t around inf 32.2%
*-commutative32.2%
Simplified32.2%
herbie shell --seed 2024157
(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)))