
(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-def100.0%
distribute-rgt-in95.7%
associate-+l+95.7%
+-commutative95.7%
count-295.7%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))) (t_2 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -7.5e+111)
t_2
(if (<= y -2.9e-88)
(* x t)
(if (<= y -2.6e-205)
t_1
(if (<= y -3.9e-277) (* x t) (if (<= y 4e-13) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -7.5e+111) {
tmp = t_2;
} else if (y <= -2.9e-88) {
tmp = x * t;
} else if (y <= -2.6e-205) {
tmp = t_1;
} else if (y <= -3.9e-277) {
tmp = x * t;
} else if (y <= 4e-13) {
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 = 2.0d0 * (x * z)
t_2 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-7.5d+111)) then
tmp = t_2
else if (y <= (-2.9d-88)) then
tmp = x * t
else if (y <= (-2.6d-205)) then
tmp = t_1
else if (y <= (-3.9d-277)) then
tmp = x * t
else if (y <= 4d-13) 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 = 2.0 * (x * z);
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -7.5e+111) {
tmp = t_2;
} else if (y <= -2.9e-88) {
tmp = x * t;
} else if (y <= -2.6e-205) {
tmp = t_1;
} else if (y <= -3.9e-277) {
tmp = x * t;
} else if (y <= 4e-13) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) t_2 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -7.5e+111: tmp = t_2 elif y <= -2.9e-88: tmp = x * t elif y <= -2.6e-205: tmp = t_1 elif y <= -3.9e-277: tmp = x * t elif y <= 4e-13: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -7.5e+111) tmp = t_2; elseif (y <= -2.9e-88) tmp = Float64(x * t); elseif (y <= -2.6e-205) tmp = t_1; elseif (y <= -3.9e-277) tmp = Float64(x * t); elseif (y <= 4e-13) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); t_2 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -7.5e+111) tmp = t_2; elseif (y <= -2.9e-88) tmp = x * t; elseif (y <= -2.6e-205) tmp = t_1; elseif (y <= -3.9e-277) tmp = x * t; elseif (y <= 4e-13) tmp = t_1; else tmp = t_2; 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[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.5e+111], t$95$2, If[LessEqual[y, -2.9e-88], N[(x * t), $MachinePrecision], If[LessEqual[y, -2.6e-205], t$95$1, If[LessEqual[y, -3.9e-277], N[(x * t), $MachinePrecision], If[LessEqual[y, 4e-13], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{+111}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-88}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-205}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{-277}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -7.49999999999999948e111 or 4.0000000000000001e-13 < 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 80.4%
if -7.49999999999999948e111 < y < -2.9000000000000001e-88 or -2.5999999999999998e-205 < y < -3.89999999999999987e-277Initial program 99.9%
Taylor expanded in t around inf 55.8%
if -2.9000000000000001e-88 < y < -2.5999999999999998e-205 or -3.89999999999999987e-277 < y < 4.0000000000000001e-13Initial program 100.0%
Taylor expanded in z around inf 59.6%
Final simplification66.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* y 5.0) (* 2.0 (* x z)))) (t_2 (* x (+ t (* (+ y z) 2.0)))))
(if (<= x -2.5e-34)
t_2
(if (<= x 8.5e-149)
t_1
(if (<= x 3.2e-67)
(+ (* y 5.0) (* x t))
(if (<= x 2.8e-40) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (2.0 * (x * z));
double t_2 = x * (t + ((y + z) * 2.0));
double tmp;
if (x <= -2.5e-34) {
tmp = t_2;
} else if (x <= 8.5e-149) {
tmp = t_1;
} else if (x <= 3.2e-67) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 2.8e-40) {
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 = (y * 5.0d0) + (2.0d0 * (x * z))
t_2 = x * (t + ((y + z) * 2.0d0))
if (x <= (-2.5d-34)) then
tmp = t_2
else if (x <= 8.5d-149) then
tmp = t_1
else if (x <= 3.2d-67) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 2.8d-40) 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 = (y * 5.0) + (2.0 * (x * z));
double t_2 = x * (t + ((y + z) * 2.0));
double tmp;
if (x <= -2.5e-34) {
tmp = t_2;
} else if (x <= 8.5e-149) {
tmp = t_1;
} else if (x <= 3.2e-67) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 2.8e-40) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 5.0) + (2.0 * (x * z)) t_2 = x * (t + ((y + z) * 2.0)) tmp = 0 if x <= -2.5e-34: tmp = t_2 elif x <= 8.5e-149: tmp = t_1 elif x <= 3.2e-67: tmp = (y * 5.0) + (x * t) elif x <= 2.8e-40: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))) t_2 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))) tmp = 0.0 if (x <= -2.5e-34) tmp = t_2; elseif (x <= 8.5e-149) tmp = t_1; elseif (x <= 3.2e-67) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 2.8e-40) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 5.0) + (2.0 * (x * z)); t_2 = x * (t + ((y + z) * 2.0)); tmp = 0.0; if (x <= -2.5e-34) tmp = t_2; elseif (x <= 8.5e-149) tmp = t_1; elseif (x <= 3.2e-67) tmp = (y * 5.0) + (x * t); elseif (x <= 2.8e-40) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e-34], t$95$2, If[LessEqual[x, 8.5e-149], t$95$1, If[LessEqual[x, 3.2e-67], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e-40], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-67}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-40}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -2.5000000000000001e-34 or 2.8e-40 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.9%
if -2.5000000000000001e-34 < x < 8.5000000000000006e-149 or 3.20000000000000021e-67 < x < 2.8e-40Initial program 99.9%
Taylor expanded in y around 0 99.9%
Simplified99.9%
Taylor expanded in t around 0 92.7%
if 8.5000000000000006e-149 < x < 3.20000000000000021e-67Initial program 100.0%
Taylor expanded in y around 0 100.0%
Simplified100.0%
Taylor expanded in z around 0 92.5%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -1e+224)
t_1
(if (<= x -3.8e+183)
(* x t)
(if (<= x -2.3e+137)
t_1
(if (<= x -1.7e+66)
(* x t)
(if (<= x -2e-68) t_1 (if (<= x 5.8e-41) (* y 5.0) (* x t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1e+224) {
tmp = t_1;
} else if (x <= -3.8e+183) {
tmp = x * t;
} else if (x <= -2.3e+137) {
tmp = t_1;
} else if (x <= -1.7e+66) {
tmp = x * t;
} else if (x <= -2e-68) {
tmp = t_1;
} else if (x <= 5.8e-41) {
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) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (x <= (-1d+224)) then
tmp = t_1
else if (x <= (-3.8d+183)) then
tmp = x * t
else if (x <= (-2.3d+137)) then
tmp = t_1
else if (x <= (-1.7d+66)) then
tmp = x * t
else if (x <= (-2d-68)) then
tmp = t_1
else if (x <= 5.8d-41) 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 t_1 = 2.0 * (x * z);
double tmp;
if (x <= -1e+224) {
tmp = t_1;
} else if (x <= -3.8e+183) {
tmp = x * t;
} else if (x <= -2.3e+137) {
tmp = t_1;
} else if (x <= -1.7e+66) {
tmp = x * t;
} else if (x <= -2e-68) {
tmp = t_1;
} else if (x <= 5.8e-41) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -1e+224: tmp = t_1 elif x <= -3.8e+183: tmp = x * t elif x <= -2.3e+137: tmp = t_1 elif x <= -1.7e+66: tmp = x * t elif x <= -2e-68: tmp = t_1 elif x <= 5.8e-41: tmp = y * 5.0 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 <= -1e+224) tmp = t_1; elseif (x <= -3.8e+183) tmp = Float64(x * t); elseif (x <= -2.3e+137) tmp = t_1; elseif (x <= -1.7e+66) tmp = Float64(x * t); elseif (x <= -2e-68) tmp = t_1; elseif (x <= 5.8e-41) tmp = Float64(y * 5.0); 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 <= -1e+224) tmp = t_1; elseif (x <= -3.8e+183) tmp = x * t; elseif (x <= -2.3e+137) tmp = t_1; elseif (x <= -1.7e+66) tmp = x * t; elseif (x <= -2e-68) tmp = t_1; elseif (x <= 5.8e-41) tmp = y * 5.0; 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, -1e+224], t$95$1, If[LessEqual[x, -3.8e+183], N[(x * t), $MachinePrecision], If[LessEqual[x, -2.3e+137], t$95$1, If[LessEqual[x, -1.7e+66], N[(x * t), $MachinePrecision], If[LessEqual[x, -2e-68], t$95$1, If[LessEqual[x, 5.8e-41], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{+183}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{+66}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-41}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -9.9999999999999997e223 or -3.80000000000000001e183 < x < -2.29999999999999999e137 or -1.70000000000000015e66 < x < -2.00000000000000013e-68Initial program 100.0%
Taylor expanded in z around inf 60.5%
if -9.9999999999999997e223 < x < -3.80000000000000001e183 or -2.29999999999999999e137 < x < -1.70000000000000015e66 or 5.79999999999999955e-41 < x Initial program 100.0%
Taylor expanded in t around inf 51.1%
if -2.00000000000000013e-68 < x < 5.79999999999999955e-41Initial program 99.9%
Taylor expanded in x around 0 68.2%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e+35) (not (<= x 2.5))) (* x (+ t (* (+ y z) 2.0))) (+ (* x (+ t (+ z z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e+35) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z + z))) + (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 <= (-5d+35)) .or. (.not. (x <= 2.5d0))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (x * (t + (z + z))) + (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 <= -5e+35) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z + z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e+35) or not (x <= 2.5): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (x * (t + (z + z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e+35) || !(x <= 2.5)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(x * Float64(t + Float64(z + z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5e+35) || ~((x <= 2.5))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (x * (t + (z + z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e+35], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+35} \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(z + z\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -5.00000000000000021e35 or 2.5 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.1%
if -5.00000000000000021e35 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.7%
Simplified99.7%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (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 * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* y 2.0)))))
(if (<= x -4.5e+65)
t_1
(if (<= x -2.6e-68)
(* 2.0 (* x z))
(if (<= x 1300.0) (* y (+ 5.0 (* x 2.0))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y * 2.0));
double tmp;
if (x <= -4.5e+65) {
tmp = t_1;
} else if (x <= -2.6e-68) {
tmp = 2.0 * (x * z);
} else if (x <= 1300.0) {
tmp = y * (5.0 + (x * 2.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 = x * (t + (y * 2.0d0))
if (x <= (-4.5d+65)) then
tmp = t_1
else if (x <= (-2.6d-68)) then
tmp = 2.0d0 * (x * z)
else if (x <= 1300.0d0) then
tmp = y * (5.0d0 + (x * 2.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 = x * (t + (y * 2.0));
double tmp;
if (x <= -4.5e+65) {
tmp = t_1;
} else if (x <= -2.6e-68) {
tmp = 2.0 * (x * z);
} else if (x <= 1300.0) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y * 2.0)) tmp = 0 if x <= -4.5e+65: tmp = t_1 elif x <= -2.6e-68: tmp = 2.0 * (x * z) elif x <= 1300.0: tmp = y * (5.0 + (x * 2.0)) 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 <= -4.5e+65) tmp = t_1; elseif (x <= -2.6e-68) tmp = Float64(2.0 * Float64(x * z)); elseif (x <= 1300.0) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); 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 <= -4.5e+65) tmp = t_1; elseif (x <= -2.6e-68) tmp = 2.0 * (x * z); elseif (x <= 1300.0) tmp = y * (5.0 + (x * 2.0)); 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, -4.5e+65], t$95$1, If[LessEqual[x, -2.6e-68], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1300.0], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $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 -4.5 \cdot 10^{+65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-68}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 1300:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -4.5e65 or 1300 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in z around 0 71.3%
Taylor expanded in x around inf 70.9%
if -4.5e65 < x < -2.5999999999999998e-68Initial program 99.9%
Taylor expanded in z around inf 66.5%
if -2.5999999999999998e-68 < x < 1300Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 66.5%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.2e-70) (not (<= x 1.52e-52))) (* 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.2e-70) || !(x <= 1.52e-52)) {
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.2d-70)) .or. (.not. (x <= 1.52d-52))) 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.2e-70) || !(x <= 1.52e-52)) {
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.2e-70) or not (x <= 1.52e-52): 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.2e-70) || !(x <= 1.52e-52)) 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.2e-70) || ~((x <= 1.52e-52))) 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.2e-70], N[Not[LessEqual[x, 1.52e-52]], $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.2 \cdot 10^{-70} \lor \neg \left(x \leq 1.52 \cdot 10^{-52}\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.20000000000000004e-70 or 1.5199999999999999e-52 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 94.5%
if -5.20000000000000004e-70 < x < 1.5199999999999999e-52Initial program 99.9%
Taylor expanded in y around 0 99.9%
Simplified99.9%
Taylor expanded in z around 0 81.5%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e+115) (not (<= y 3.1e-11))) (* 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 <= -4.8e+115) || !(y <= 3.1e-11)) {
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 <= (-4.8d+115)) .or. (.not. (y <= 3.1d-11))) 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 <= -4.8e+115) || !(y <= 3.1e-11)) {
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 <= -4.8e+115) or not (y <= 3.1e-11): 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 <= -4.8e+115) || !(y <= 3.1e-11)) 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 <= -4.8e+115) || ~((y <= 3.1e-11))) 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, -4.8e+115], N[Not[LessEqual[y, 3.1e-11]], $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.8 \cdot 10^{+115} \lor \neg \left(y \leq 3.1 \cdot 10^{-11}\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 < -4.8000000000000001e115 or 3.10000000000000028e-11 < 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 80.4%
if -4.8000000000000001e115 < y < 3.10000000000000028e-11Initial program 100.0%
Taylor expanded in y around 0 81.6%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.25e-67) (not (<= x 6.7e-49))) (* x (+ t (* z 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e-67) || !(x <= 6.7e-49)) {
tmp = x * (t + (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 <= (-1.25d-67)) .or. (.not. (x <= 6.7d-49))) then
tmp = x * (t + (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 <= -1.25e-67) || !(x <= 6.7e-49)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.25e-67) or not (x <= 6.7e-49): tmp = x * (t + (z * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.25e-67) || !(x <= 6.7e-49)) tmp = Float64(x * Float64(t + Float64(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 <= -1.25e-67) || ~((x <= 6.7e-49))) tmp = x * (t + (z * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.25e-67], N[Not[LessEqual[x, 6.7e-49]], $MachinePrecision]], N[(x * N[(t + N[(z * 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 -1.25 \cdot 10^{-67} \lor \neg \left(x \leq 6.7 \cdot 10^{-49}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -1.25e-67 or 6.7e-49 < x Initial program 100.0%
Taylor expanded in y around 0 78.3%
if -1.25e-67 < x < 6.7e-49Initial program 99.9%
Taylor expanded in y around 0 99.9%
Simplified99.9%
Taylor expanded in z around 0 81.5%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e-35) (* x t) (if (<= x 2.2e-41) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-35) {
tmp = x * t;
} else if (x <= 2.2e-41) {
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 <= (-2.8d-35)) then
tmp = x * t
else if (x <= 2.2d-41) 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 <= -2.8e-35) {
tmp = x * t;
} else if (x <= 2.2e-41) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e-35: tmp = x * t elif x <= 2.2e-41: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e-35) tmp = Float64(x * t); elseif (x <= 2.2e-41) 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 <= -2.8e-35) tmp = x * t; elseif (x <= 2.2e-41) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e-35], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.2e-41], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-35}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-41}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -2.8e-35 or 2.2e-41 < x Initial program 100.0%
Taylor expanded in t around inf 42.5%
if -2.8e-35 < x < 2.2e-41Initial program 99.9%
Taylor expanded in x around 0 63.7%
Final simplification51.6%
(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.9%
Taylor expanded in x around 0 29.4%
Final simplification29.4%
herbie shell --seed 2023171
(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)))