
(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 10 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 98.9%
+-commutative98.9%
fma-def99.3%
distribute-rgt-in96.5%
associate-+l+96.5%
+-commutative96.5%
count-296.5%
distribute-rgt-in99.3%
*-commutative99.3%
fma-def99.3%
Applied egg-rr99.3%
Final simplification99.3%
(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 98.9%
fma-def98.9%
associate-+l+98.9%
+-commutative98.9%
count-298.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= z -2.6e+103)
t_1
(if (<= z -6.5e-5)
(* x t)
(if (<= z -2e-209)
(* y 5.0)
(if (<= z -1.16e-270)
(* x t)
(if (<= z 1e-247)
(* y (* x 2.0))
(if (<= z 4.5e+51) (* x t) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (z <= -2.6e+103) {
tmp = t_1;
} else if (z <= -6.5e-5) {
tmp = x * t;
} else if (z <= -2e-209) {
tmp = y * 5.0;
} else if (z <= -1.16e-270) {
tmp = x * t;
} else if (z <= 1e-247) {
tmp = y * (x * 2.0);
} else if (z <= 4.5e+51) {
tmp = 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 = 2.0d0 * (x * z)
if (z <= (-2.6d+103)) then
tmp = t_1
else if (z <= (-6.5d-5)) then
tmp = x * t
else if (z <= (-2d-209)) then
tmp = y * 5.0d0
else if (z <= (-1.16d-270)) then
tmp = x * t
else if (z <= 1d-247) then
tmp = y * (x * 2.0d0)
else if (z <= 4.5d+51) then
tmp = 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 = 2.0 * (x * z);
double tmp;
if (z <= -2.6e+103) {
tmp = t_1;
} else if (z <= -6.5e-5) {
tmp = x * t;
} else if (z <= -2e-209) {
tmp = y * 5.0;
} else if (z <= -1.16e-270) {
tmp = x * t;
} else if (z <= 1e-247) {
tmp = y * (x * 2.0);
} else if (z <= 4.5e+51) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if z <= -2.6e+103: tmp = t_1 elif z <= -6.5e-5: tmp = x * t elif z <= -2e-209: tmp = y * 5.0 elif z <= -1.16e-270: tmp = x * t elif z <= 1e-247: tmp = y * (x * 2.0) elif z <= 4.5e+51: tmp = x * t 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 <= -2.6e+103) tmp = t_1; elseif (z <= -6.5e-5) tmp = Float64(x * t); elseif (z <= -2e-209) tmp = Float64(y * 5.0); elseif (z <= -1.16e-270) tmp = Float64(x * t); elseif (z <= 1e-247) tmp = Float64(y * Float64(x * 2.0)); elseif (z <= 4.5e+51) tmp = Float64(x * t); 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 <= -2.6e+103) tmp = t_1; elseif (z <= -6.5e-5) tmp = x * t; elseif (z <= -2e-209) tmp = y * 5.0; elseif (z <= -1.16e-270) tmp = x * t; elseif (z <= 1e-247) tmp = y * (x * 2.0); elseif (z <= 4.5e+51) tmp = x * t; 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, -2.6e+103], t$95$1, If[LessEqual[z, -6.5e-5], N[(x * t), $MachinePrecision], If[LessEqual[z, -2e-209], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, -1.16e-270], N[(x * t), $MachinePrecision], If[LessEqual[z, 1e-247], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+51], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -2.6 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-5}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-209}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-270}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 10^{-247}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+51}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.6000000000000002e103 or 4.5e51 < z Initial program 99.0%
Taylor expanded in z around inf 84.6%
Taylor expanded in z around inf 68.5%
if -2.6000000000000002e103 < z < -6.49999999999999943e-5 or -2.0000000000000001e-209 < z < -1.16000000000000006e-270 or 1e-247 < z < 4.5e51Initial program 98.0%
Taylor expanded in t around inf 77.0%
+-commutative77.0%
fma-def77.0%
*-commutative77.0%
Applied egg-rr77.0%
Taylor expanded in y around 0 55.8%
*-commutative55.8%
Simplified55.8%
if -6.49999999999999943e-5 < z < -2.0000000000000001e-209Initial program 100.0%
Taylor expanded in x around 0 43.2%
Simplified43.2%
if -1.16000000000000006e-270 < z < 1e-247Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 73.7%
*-commutative73.7%
distribute-rgt-in73.7%
*-commutative73.7%
*-commutative73.7%
Applied egg-rr73.7%
Taylor expanded in x around inf 48.8%
associate-*r*48.8%
*-commutative48.8%
associate-*r*48.8%
Simplified48.8%
Final simplification57.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))) (t_2 (+ (* y 5.0) (* x t))))
(if (<= z -8.2e+108)
t_1
(if (<= z -4.2e-35)
t_2
(if (<= z 4.6e-248)
(* y (+ 5.0 (* x 2.0)))
(if (<= z 3e+183) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = (y * 5.0) + (x * t);
double tmp;
if (z <= -8.2e+108) {
tmp = t_1;
} else if (z <= -4.2e-35) {
tmp = t_2;
} else if (z <= 4.6e-248) {
tmp = y * (5.0 + (x * 2.0));
} else if (z <= 3e+183) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
t_2 = (y * 5.0d0) + (x * t)
if (z <= (-8.2d+108)) then
tmp = t_1
else if (z <= (-4.2d-35)) then
tmp = t_2
else if (z <= 4.6d-248) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if (z <= 3d+183) then
tmp = t_2
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 t_2 = (y * 5.0) + (x * t);
double tmp;
if (z <= -8.2e+108) {
tmp = t_1;
} else if (z <= -4.2e-35) {
tmp = t_2;
} else if (z <= 4.6e-248) {
tmp = y * (5.0 + (x * 2.0));
} else if (z <= 3e+183) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) t_2 = (y * 5.0) + (x * t) tmp = 0 if z <= -8.2e+108: tmp = t_1 elif z <= -4.2e-35: tmp = t_2 elif z <= 4.6e-248: tmp = y * (5.0 + (x * 2.0)) elif z <= 3e+183: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) t_2 = Float64(Float64(y * 5.0) + Float64(x * t)) tmp = 0.0 if (z <= -8.2e+108) tmp = t_1; elseif (z <= -4.2e-35) tmp = t_2; elseif (z <= 4.6e-248) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif (z <= 3e+183) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); t_2 = (y * 5.0) + (x * t); tmp = 0.0; if (z <= -8.2e+108) tmp = t_1; elseif (z <= -4.2e-35) tmp = t_2; elseif (z <= 4.6e-248) tmp = y * (5.0 + (x * 2.0)); elseif (z <= 3e+183) tmp = t_2; 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]}, Block[{t$95$2 = N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+108], t$95$1, If[LessEqual[z, -4.2e-35], t$95$2, If[LessEqual[z, 4.6e-248], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+183], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
t_2 := y \cdot 5 + x \cdot t\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-35}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-248}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+183}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -8.1999999999999998e108 or 2.99999999999999996e183 < z Initial program 98.7%
Taylor expanded in z around inf 88.9%
Taylor expanded in z around inf 77.5%
if -8.1999999999999998e108 < z < -4.2e-35 or 4.6e-248 < z < 2.99999999999999996e183Initial program 98.4%
Taylor expanded in t around inf 73.6%
if -4.2e-35 < z < 4.6e-248Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in y around inf 71.3%
Final simplification74.1%
(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 98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= z -3.7e+103)
t_1
(if (<= z -7.2e-6)
(* x t)
(if (<= z -2.4e-209) (* y 5.0) (if (<= z 2.4e+48) (* x t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (z <= -3.7e+103) {
tmp = t_1;
} else if (z <= -7.2e-6) {
tmp = x * t;
} else if (z <= -2.4e-209) {
tmp = y * 5.0;
} else if (z <= 2.4e+48) {
tmp = 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 = 2.0d0 * (x * z)
if (z <= (-3.7d+103)) then
tmp = t_1
else if (z <= (-7.2d-6)) then
tmp = x * t
else if (z <= (-2.4d-209)) then
tmp = y * 5.0d0
else if (z <= 2.4d+48) then
tmp = 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 = 2.0 * (x * z);
double tmp;
if (z <= -3.7e+103) {
tmp = t_1;
} else if (z <= -7.2e-6) {
tmp = x * t;
} else if (z <= -2.4e-209) {
tmp = y * 5.0;
} else if (z <= 2.4e+48) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if z <= -3.7e+103: tmp = t_1 elif z <= -7.2e-6: tmp = x * t elif z <= -2.4e-209: tmp = y * 5.0 elif z <= 2.4e+48: tmp = x * t 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 <= -3.7e+103) tmp = t_1; elseif (z <= -7.2e-6) tmp = Float64(x * t); elseif (z <= -2.4e-209) tmp = Float64(y * 5.0); elseif (z <= 2.4e+48) tmp = Float64(x * t); 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 <= -3.7e+103) tmp = t_1; elseif (z <= -7.2e-6) tmp = x * t; elseif (z <= -2.4e-209) tmp = y * 5.0; elseif (z <= 2.4e+48) tmp = x * t; 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, -3.7e+103], t$95$1, If[LessEqual[z, -7.2e-6], N[(x * t), $MachinePrecision], If[LessEqual[z, -2.4e-209], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 2.4e+48], N[(x * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-6}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-209}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+48}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.70000000000000033e103 or 2.4000000000000001e48 < z Initial program 99.0%
Taylor expanded in z around inf 84.6%
Taylor expanded in z around inf 68.5%
if -3.70000000000000033e103 < z < -7.19999999999999967e-6 or -2.4000000000000001e-209 < z < 2.4000000000000001e48Initial program 98.4%
Taylor expanded in t around inf 72.1%
+-commutative72.1%
fma-def72.1%
*-commutative72.1%
Applied egg-rr72.1%
Taylor expanded in y around 0 50.7%
*-commutative50.7%
Simplified50.7%
if -7.19999999999999967e-6 < z < -2.4000000000000001e-209Initial program 100.0%
Taylor expanded in x around 0 43.2%
Simplified43.2%
Final simplification56.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.7e+73)
t_1
(if (<= y 1.1e-284) (* x t) (if (<= y 1.65e-110) (* 2.0 (* x z)) 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 <= -1.7e+73) {
tmp = t_1;
} else if (y <= 1.1e-284) {
tmp = x * t;
} else if (y <= 1.65e-110) {
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 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-1.7d+73)) then
tmp = t_1
else if (y <= 1.1d-284) then
tmp = x * t
else if (y <= 1.65d-110) 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 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.7e+73) {
tmp = t_1;
} else if (y <= 1.1e-284) {
tmp = x * t;
} else if (y <= 1.65e-110) {
tmp = 2.0 * (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.7e+73: tmp = t_1 elif y <= 1.1e-284: tmp = x * t elif y <= 1.65e-110: tmp = 2.0 * (x * z) 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 <= -1.7e+73) tmp = t_1; elseif (y <= 1.1e-284) tmp = Float64(x * t); elseif (y <= 1.65e-110) 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 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -1.7e+73) tmp = t_1; elseif (y <= 1.1e-284) tmp = x * t; elseif (y <= 1.65e-110) tmp = 2.0 * (x * z); 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, -1.7e+73], t$95$1, If[LessEqual[y, 1.1e-284], N[(x * t), $MachinePrecision], If[LessEqual[y, 1.65e-110], N[(2.0 * N[(x * z), $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 -1.7 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-284}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-110}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.7000000000000001e73 or 1.65e-110 < y Initial program 98.4%
fma-def98.4%
associate-+l+98.4%
+-commutative98.4%
count-298.4%
Simplified98.4%
Taylor expanded in y around inf 74.9%
if -1.7000000000000001e73 < y < 1.1e-284Initial program 99.1%
Taylor expanded in t around inf 66.4%
+-commutative66.4%
fma-def66.4%
*-commutative66.4%
Applied egg-rr66.4%
Taylor expanded in y around 0 59.9%
*-commutative59.9%
Simplified59.9%
if 1.1e-284 < y < 1.65e-110Initial program 100.0%
Taylor expanded in z around inf 60.6%
Taylor expanded in z around inf 50.1%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9e-45) (not (<= x 2.05e-10))) (* 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 <= -9e-45) || !(x <= 2.05e-10)) {
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 <= (-9d-45)) .or. (.not. (x <= 2.05d-10))) 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 <= -9e-45) || !(x <= 2.05e-10)) {
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 <= -9e-45) or not (x <= 2.05e-10): 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 <= -9e-45) || !(x <= 2.05e-10)) 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 <= -9e-45) || ~((x <= 2.05e-10))) 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, -9e-45], N[Not[LessEqual[x, 2.05e-10]], $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 -9 \cdot 10^{-45} \lor \neg \left(x \leq 2.05 \cdot 10^{-10}\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 < -8.9999999999999997e-45 or 2.0499999999999999e-10 < x Initial program 98.8%
fma-def98.8%
associate-+l+98.8%
+-commutative98.8%
count-298.8%
Simplified98.8%
Taylor expanded in x around inf 97.2%
if -8.9999999999999997e-45 < x < 2.0499999999999999e-10Initial program 98.9%
Taylor expanded in t around inf 81.7%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1.1e-95) (* x t) (if (<= x 17000.0) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e-95) {
tmp = x * t;
} else if (x <= 17000.0) {
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 (x <= (-1.1d-95)) then
tmp = x * t
else if (x <= 17000.0d0) 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 (x <= -1.1e-95) {
tmp = x * t;
} else if (x <= 17000.0) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.1e-95: tmp = x * t elif x <= 17000.0: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.1e-95) tmp = Float64(x * t); elseif (x <= 17000.0) 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 (x <= -1.1e-95) tmp = x * t; elseif (x <= 17000.0) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.1e-95], N[(x * t), $MachinePrecision], If[LessEqual[x, 17000.0], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-95}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 17000:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.0999999999999999e-95 or 17000 < x Initial program 99.4%
Taylor expanded in t around inf 43.4%
+-commutative43.4%
fma-def43.4%
*-commutative43.4%
Applied egg-rr43.4%
Taylor expanded in y around 0 40.5%
*-commutative40.5%
Simplified40.5%
if -1.0999999999999999e-95 < x < 17000Initial program 98.0%
Taylor expanded in x around 0 58.2%
Simplified58.2%
Final simplification47.1%
(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 98.9%
Taylor expanded in t around inf 56.0%
+-commutative56.0%
fma-def56.0%
*-commutative56.0%
Applied egg-rr56.0%
Taylor expanded in y around 0 33.8%
*-commutative33.8%
Simplified33.8%
Final simplification33.8%
herbie shell --seed 2023196
(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)))