
(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 x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Initial program 99.5%
fma-def99.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 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
(if (<= x -1e+91)
t_2
(if (<= x -1.3e-146)
t_1
(if (<= x 2.4e-24) (* y 5.0) (if (<= x 7e+91) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -1e+91) {
tmp = t_2;
} else if (x <= -1.3e-146) {
tmp = t_1;
} else if (x <= 2.4e-24) {
tmp = y * 5.0;
} else if (x <= 7e+91) {
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 = x * (t + (2.0d0 * y))
t_2 = x * (2.0d0 * (y + z))
if (x <= (-1d+91)) then
tmp = t_2
else if (x <= (-1.3d-146)) then
tmp = t_1
else if (x <= 2.4d-24) then
tmp = y * 5.0d0
else if (x <= 7d+91) 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 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -1e+91) {
tmp = t_2;
} else if (x <= -1.3e-146) {
tmp = t_1;
} else if (x <= 2.4e-24) {
tmp = y * 5.0;
} else if (x <= 7e+91) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) t_2 = x * (2.0 * (y + z)) tmp = 0 if x <= -1e+91: tmp = t_2 elif x <= -1.3e-146: tmp = t_1 elif x <= 2.4e-24: tmp = y * 5.0 elif x <= 7e+91: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) t_2 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -1e+91) tmp = t_2; elseif (x <= -1.3e-146) tmp = t_1; elseif (x <= 2.4e-24) tmp = Float64(y * 5.0); elseif (x <= 7e+91) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * y)); t_2 = x * (2.0 * (y + z)); tmp = 0.0; if (x <= -1e+91) tmp = t_2; elseif (x <= -1.3e-146) tmp = t_1; elseif (x <= 2.4e-24) tmp = y * 5.0; elseif (x <= 7e+91) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+91], t$95$2, If[LessEqual[x, -1.3e-146], t$95$1, If[LessEqual[x, 2.4e-24], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 7e+91], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+91}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-24}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+91}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.00000000000000008e91 or 2.3999999999999998e-24 < x < 7.00000000000000001e91Initial program 100.0%
Taylor expanded in t around 0 84.1%
Simplified84.1%
fma-udef84.1%
*-commutative84.1%
Applied egg-rr84.1%
Taylor expanded in x around inf 82.8%
*-commutative82.8%
+-commutative82.8%
associate-*r*82.8%
*-commutative82.8%
+-commutative82.8%
Simplified82.8%
if -1.00000000000000008e91 < x < -1.29999999999999993e-146 or 7.00000000000000001e91 < x Initial program 98.9%
fma-def98.9%
associate-+l+98.9%
+-commutative98.9%
count-298.9%
Simplified98.9%
Taylor expanded in x around inf 88.3%
Taylor expanded in z around 0 71.5%
+-commutative71.5%
*-commutative71.5%
Simplified71.5%
if -1.29999999999999993e-146 < x < 2.3999999999999998e-24Initial program 99.9%
Taylor expanded in x around 0 66.8%
Simplified66.8%
Final simplification72.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
(if (<= x -3e+90)
t_2
(if (<= x -1.3e-146)
t_1
(if (<= x 4.2e-25)
(* y (+ 5.0 (* x 2.0)))
(if (<= x 1.1e+90) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -3e+90) {
tmp = t_2;
} else if (x <= -1.3e-146) {
tmp = t_1;
} else if (x <= 4.2e-25) {
tmp = y * (5.0 + (x * 2.0));
} else if (x <= 1.1e+90) {
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 = x * (t + (2.0d0 * y))
t_2 = x * (2.0d0 * (y + z))
if (x <= (-3d+90)) then
tmp = t_2
else if (x <= (-1.3d-146)) then
tmp = t_1
else if (x <= 4.2d-25) then
tmp = y * (5.0d0 + (x * 2.0d0))
else if (x <= 1.1d+90) 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 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -3e+90) {
tmp = t_2;
} else if (x <= -1.3e-146) {
tmp = t_1;
} else if (x <= 4.2e-25) {
tmp = y * (5.0 + (x * 2.0));
} else if (x <= 1.1e+90) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) t_2 = x * (2.0 * (y + z)) tmp = 0 if x <= -3e+90: tmp = t_2 elif x <= -1.3e-146: tmp = t_1 elif x <= 4.2e-25: tmp = y * (5.0 + (x * 2.0)) elif x <= 1.1e+90: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) t_2 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -3e+90) tmp = t_2; elseif (x <= -1.3e-146) tmp = t_1; elseif (x <= 4.2e-25) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); elseif (x <= 1.1e+90) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * y)); t_2 = x * (2.0 * (y + z)); tmp = 0.0; if (x <= -3e+90) tmp = t_2; elseif (x <= -1.3e-146) tmp = t_1; elseif (x <= 4.2e-25) tmp = y * (5.0 + (x * 2.0)); elseif (x <= 1.1e+90) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+90], t$95$2, If[LessEqual[x, -1.3e-146], t$95$1, If[LessEqual[x, 4.2e-25], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e+90], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{+90}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-25}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+90}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.99999999999999979e90 or 4.20000000000000005e-25 < x < 1.09999999999999995e90Initial program 100.0%
Taylor expanded in t around 0 84.1%
Simplified84.1%
fma-udef84.1%
*-commutative84.1%
Applied egg-rr84.1%
Taylor expanded in x around inf 82.8%
*-commutative82.8%
+-commutative82.8%
associate-*r*82.8%
*-commutative82.8%
+-commutative82.8%
Simplified82.8%
if -2.99999999999999979e90 < x < -1.29999999999999993e-146 or 1.09999999999999995e90 < x Initial program 98.9%
fma-def98.9%
associate-+l+98.9%
+-commutative98.9%
count-298.9%
Simplified98.9%
Taylor expanded in x around inf 88.3%
Taylor expanded in z around 0 71.5%
+-commutative71.5%
*-commutative71.5%
Simplified71.5%
if -1.29999999999999993e-146 < x < 4.20000000000000005e-25Initial program 99.9%
Taylor expanded in y around inf 66.8%
Simplified66.8%
Final simplification72.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 y)))) (t_2 (* x (* 2.0 (+ y z)))))
(if (<= x -4e+90)
t_2
(if (<= x -2.5)
t_1
(if (<= x 1.1e+21)
(+ (* y 5.0) (* x t))
(if (<= x 1.65e+91) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -4e+90) {
tmp = t_2;
} else if (x <= -2.5) {
tmp = t_1;
} else if (x <= 1.1e+21) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 1.65e+91) {
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 = x * (t + (2.0d0 * y))
t_2 = x * (2.0d0 * (y + z))
if (x <= (-4d+90)) then
tmp = t_2
else if (x <= (-2.5d0)) then
tmp = t_1
else if (x <= 1.1d+21) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 1.65d+91) 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 = x * (t + (2.0 * y));
double t_2 = x * (2.0 * (y + z));
double tmp;
if (x <= -4e+90) {
tmp = t_2;
} else if (x <= -2.5) {
tmp = t_1;
} else if (x <= 1.1e+21) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 1.65e+91) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * y)) t_2 = x * (2.0 * (y + z)) tmp = 0 if x <= -4e+90: tmp = t_2 elif x <= -2.5: tmp = t_1 elif x <= 1.1e+21: tmp = (y * 5.0) + (x * t) elif x <= 1.65e+91: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * y))) t_2 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -4e+90) tmp = t_2; elseif (x <= -2.5) tmp = t_1; elseif (x <= 1.1e+21) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 1.65e+91) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * y)); t_2 = x * (2.0 * (y + z)); tmp = 0.0; if (x <= -4e+90) tmp = t_2; elseif (x <= -2.5) tmp = t_1; elseif (x <= 1.1e+21) tmp = (y * 5.0) + (x * t); elseif (x <= 1.65e+91) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+90], t$95$2, If[LessEqual[x, -2.5], t$95$1, If[LessEqual[x, 1.1e+21], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e+91], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot y\right)\\
t_2 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{+90}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.5:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+21}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+91}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.99999999999999987e90 or 1.1e21 < x < 1.65000000000000009e91Initial program 100.0%
Taylor expanded in t around 0 86.9%
Simplified86.9%
fma-udef86.9%
*-commutative86.9%
Applied egg-rr86.9%
Taylor expanded in x around inf 86.9%
*-commutative86.9%
+-commutative86.9%
associate-*r*86.9%
*-commutative86.9%
+-commutative86.9%
Simplified86.9%
if -3.99999999999999987e90 < x < -2.5 or 1.65000000000000009e91 < x Initial program 98.5%
fma-def98.5%
associate-+l+98.5%
+-commutative98.5%
count-298.5%
Simplified98.5%
Taylor expanded in x around inf 98.4%
Taylor expanded in z around 0 82.7%
+-commutative82.7%
*-commutative82.7%
Simplified82.7%
if -2.5 < x < 1.1e21Initial program 99.9%
Taylor expanded in t around inf 80.7%
Simplified80.7%
Final simplification82.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))))
(if (<= t -3.3e+62)
(+ (* y 5.0) (* x t))
(if (<= t 7.2e+131) (+ (* y 5.0) (* x t_1)) (* x (+ t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -3.3e+62) {
tmp = (y * 5.0) + (x * t);
} else if (t <= 7.2e+131) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + 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 * (y + z)
if (t <= (-3.3d+62)) then
tmp = (y * 5.0d0) + (x * t)
else if (t <= 7.2d+131) then
tmp = (y * 5.0d0) + (x * t_1)
else
tmp = x * (t_1 + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (t <= -3.3e+62) {
tmp = (y * 5.0) + (x * t);
} else if (t <= 7.2e+131) {
tmp = (y * 5.0) + (x * t_1);
} else {
tmp = x * (t_1 + t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) tmp = 0 if t <= -3.3e+62: tmp = (y * 5.0) + (x * t) elif t <= 7.2e+131: tmp = (y * 5.0) + (x * t_1) else: tmp = x * (t_1 + t) return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) tmp = 0.0 if (t <= -3.3e+62) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (t <= 7.2e+131) tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); else tmp = Float64(x * Float64(t_1 + t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); tmp = 0.0; if (t <= -3.3e+62) tmp = (y * 5.0) + (x * t); elseif (t <= 7.2e+131) tmp = (y * 5.0) + (x * t_1); else tmp = x * (t_1 + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.3e+62], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+131], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+62}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+131}:\\
\;\;\;\;y \cdot 5 + x \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t_1 + t\right)\\
\end{array}
\end{array}
if t < -3.3e62Initial program 98.2%
Taylor expanded in t around inf 89.7%
Simplified89.7%
if -3.3e62 < t < 7.20000000000000063e131Initial program 99.9%
Taylor expanded in t around 0 94.7%
Simplified94.7%
if 7.20000000000000063e131 < t Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 86.8%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ y (* 2.0 z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * 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 + (y + (2.0d0 * z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (y + (2.0 * z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(y + Float64(2.0 * z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (y + (2.0 * z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(y + 2 \cdot z\right)\right)\right)
\end{array}
Initial program 99.5%
Taylor expanded in y around 0 99.5%
Final simplification99.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.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 z))))
(if (<= x -4e+86)
t_1
(if (<= x -1.15e-146)
(* x t)
(if (<= x 1.05e-24) (* y 5.0) (if (<= x 1.5e+99) t_1 (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * z);
double tmp;
if (x <= -4e+86) {
tmp = t_1;
} else if (x <= -1.15e-146) {
tmp = x * t;
} else if (x <= 1.05e-24) {
tmp = y * 5.0;
} else if (x <= 1.5e+99) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (2.0d0 * z)
if (x <= (-4d+86)) then
tmp = t_1
else if (x <= (-1.15d-146)) then
tmp = x * t
else if (x <= 1.05d-24) then
tmp = y * 5.0d0
else if (x <= 1.5d+99) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * z);
double tmp;
if (x <= -4e+86) {
tmp = t_1;
} else if (x <= -1.15e-146) {
tmp = x * t;
} else if (x <= 1.05e-24) {
tmp = y * 5.0;
} else if (x <= 1.5e+99) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * z) tmp = 0 if x <= -4e+86: tmp = t_1 elif x <= -1.15e-146: tmp = x * t elif x <= 1.05e-24: tmp = y * 5.0 elif x <= 1.5e+99: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * z)) tmp = 0.0 if (x <= -4e+86) tmp = t_1; elseif (x <= -1.15e-146) tmp = Float64(x * t); elseif (x <= 1.05e-24) tmp = Float64(y * 5.0); elseif (x <= 1.5e+99) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (2.0 * z); tmp = 0.0; if (x <= -4e+86) tmp = t_1; elseif (x <= -1.15e-146) tmp = x * t; elseif (x <= 1.05e-24) tmp = y * 5.0; elseif (x <= 1.5e+99) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e+86], t$95$1, If[LessEqual[x, -1.15e-146], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.05e-24], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.5e+99], t$95$1, N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot z\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-146}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-24}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -4.0000000000000001e86 or 1.05e-24 < x < 1.50000000000000007e99Initial program 100.0%
Taylor expanded in y around 0 91.3%
Simplified94.2%
Taylor expanded in z around inf 49.6%
associate-*r*49.6%
*-commutative49.6%
associate-*r*49.6%
Simplified49.6%
if -4.0000000000000001e86 < x < -1.15e-146 or 1.50000000000000007e99 < x Initial program 98.9%
Taylor expanded in y around 0 97.8%
Simplified100.0%
Taylor expanded in t around inf 44.7%
*-commutative44.7%
Simplified44.7%
if -1.15e-146 < x < 1.05e-24Initial program 99.9%
Taylor expanded in x around 0 66.8%
Simplified66.8%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.02) (not (<= x 9e-25))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.02) || !(x <= 9e-25)) {
tmp = x * ((2.0 * (y + z)) + t);
} 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 <= (-0.02d0)) .or. (.not. (x <= 9d-25))) then
tmp = x * ((2.0d0 * (y + z)) + t)
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 <= -0.02) || !(x <= 9e-25)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.02) or not (x <= 9e-25): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.02) || !(x <= 9e-25)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); 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 <= -0.02) || ~((x <= 9e-25))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.02], N[Not[LessEqual[x, 9e-25]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.02 \lor \neg \left(x \leq 9 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -0.0200000000000000004 or 9.0000000000000002e-25 < x Initial program 99.2%
fma-def99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 98.5%
if -0.0200000000000000004 < x < 9.0000000000000002e-25Initial program 99.9%
Taylor expanded in t around inf 82.5%
Simplified82.5%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (<= x -4.3e+88) (* x (* 2.0 z)) (if (<= x -1.3e-146) (* x t) (if (<= x 2.5) (* y 5.0) (* y (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.3e+88) {
tmp = x * (2.0 * z);
} else if (x <= -1.3e-146) {
tmp = x * t;
} else if (x <= 2.5) {
tmp = y * 5.0;
} else {
tmp = y * (x * 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 (x <= (-4.3d+88)) then
tmp = x * (2.0d0 * z)
else if (x <= (-1.3d-146)) then
tmp = x * t
else if (x <= 2.5d0) then
tmp = y * 5.0d0
else
tmp = y * (x * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.3e+88) {
tmp = x * (2.0 * z);
} else if (x <= -1.3e-146) {
tmp = x * t;
} else if (x <= 2.5) {
tmp = y * 5.0;
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.3e+88: tmp = x * (2.0 * z) elif x <= -1.3e-146: tmp = x * t elif x <= 2.5: tmp = y * 5.0 else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.3e+88) tmp = Float64(x * Float64(2.0 * z)); elseif (x <= -1.3e-146) tmp = Float64(x * t); elseif (x <= 2.5) tmp = Float64(y * 5.0); else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.3e+88) tmp = x * (2.0 * z); elseif (x <= -1.3e-146) tmp = x * t; elseif (x <= 2.5) tmp = y * 5.0; else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.3e+88], N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-146], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.5], N[(y * 5.0), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \left(2 \cdot z\right)\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-146}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if x < -4.29999999999999974e88Initial program 100.0%
Taylor expanded in y around 0 87.7%
Simplified91.8%
Taylor expanded in z around inf 51.0%
associate-*r*51.0%
*-commutative51.0%
associate-*r*51.0%
Simplified51.0%
if -4.29999999999999974e88 < x < -1.29999999999999993e-146Initial program 97.5%
Taylor expanded in y around 0 100.0%
Simplified100.0%
Taylor expanded in t around inf 43.7%
*-commutative43.7%
Simplified43.7%
if -1.29999999999999993e-146 < x < 2.5Initial program 99.9%
Taylor expanded in x around 0 65.9%
Simplified65.9%
if 2.5 < x Initial program 100.0%
Taylor expanded in y around inf 44.3%
Simplified44.3%
Taylor expanded in x around inf 44.3%
*-commutative44.3%
*-commutative44.3%
associate-*r*44.3%
Simplified44.3%
Final simplification53.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.0165) (not (<= x 5e-25))) (* x (* 2.0 (+ y z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.0165) || !(x <= 5e-25)) {
tmp = x * (2.0 * (y + z));
} 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 <= (-0.0165d0)) .or. (.not. (x <= 5d-25))) then
tmp = x * (2.0d0 * (y + z))
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 <= -0.0165) || !(x <= 5e-25)) {
tmp = x * (2.0 * (y + z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.0165) or not (x <= 5e-25): tmp = x * (2.0 * (y + z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.0165) || !(x <= 5e-25)) tmp = Float64(x * Float64(2.0 * Float64(y + z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.0165) || ~((x <= 5e-25))) tmp = x * (2.0 * (y + z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.0165], N[Not[LessEqual[x, 5e-25]], $MachinePrecision]], N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0165 \lor \neg \left(x \leq 5 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -0.016500000000000001 or 4.99999999999999962e-25 < x Initial program 99.2%
Taylor expanded in t around 0 73.0%
Simplified73.7%
fma-udef73.0%
*-commutative73.0%
Applied egg-rr73.0%
Taylor expanded in x around inf 72.3%
*-commutative72.3%
+-commutative72.3%
associate-*r*72.3%
*-commutative72.3%
+-commutative72.3%
Simplified72.3%
if -0.016500000000000001 < x < 4.99999999999999962e-25Initial program 99.9%
Taylor expanded in x around 0 59.7%
Simplified59.7%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.3e-146) (not (<= x 1720.0))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.3e-146) || !(x <= 1720.0)) {
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.3d-146)) .or. (.not. (x <= 1720.0d0))) 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.3e-146) || !(x <= 1720.0)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.3e-146) or not (x <= 1720.0): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.3e-146) || !(x <= 1720.0)) 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.3e-146) || ~((x <= 1720.0))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.3e-146], N[Not[LessEqual[x, 1720.0]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-146} \lor \neg \left(x \leq 1720\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.29999999999999993e-146 or 1720 < x Initial program 99.3%
Taylor expanded in y around 0 94.9%
Simplified97.4%
Taylor expanded in t around inf 37.1%
*-commutative37.1%
Simplified37.1%
if -1.29999999999999993e-146 < x < 1720Initial program 99.9%
Taylor expanded in x around 0 65.3%
Simplified65.3%
Final simplification48.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 99.5%
Taylor expanded in y around 0 96.8%
Simplified98.4%
Taylor expanded in t around inf 30.3%
*-commutative30.3%
Simplified30.3%
Final simplification30.3%
herbie shell --seed 2023336
(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)))