
(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 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.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))))
(if (<= x -3.4e+83)
t_1
(if (<= x -3e+36)
(* 2.0 (* x y))
(if (or (<= x -2.5e-88)
(and (not (<= x -3.8e-192))
(or (<= x -6e-238) (not (<= x 5.2e-142)))))
t_1
(* y 5.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double tmp;
if (x <= -3.4e+83) {
tmp = t_1;
} else if (x <= -3e+36) {
tmp = 2.0 * (x * y);
} else if ((x <= -2.5e-88) || (!(x <= -3.8e-192) && ((x <= -6e-238) || !(x <= 5.2e-142)))) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t + (2.0d0 * z))
if (x <= (-3.4d+83)) then
tmp = t_1
else if (x <= (-3d+36)) then
tmp = 2.0d0 * (x * y)
else if ((x <= (-2.5d-88)) .or. (.not. (x <= (-3.8d-192))) .and. (x <= (-6d-238)) .or. (.not. (x <= 5.2d-142))) then
tmp = t_1
else
tmp = y * 5.0d0
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 * z));
double tmp;
if (x <= -3.4e+83) {
tmp = t_1;
} else if (x <= -3e+36) {
tmp = 2.0 * (x * y);
} else if ((x <= -2.5e-88) || (!(x <= -3.8e-192) && ((x <= -6e-238) || !(x <= 5.2e-142)))) {
tmp = t_1;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) tmp = 0 if x <= -3.4e+83: tmp = t_1 elif x <= -3e+36: tmp = 2.0 * (x * y) elif (x <= -2.5e-88) or (not (x <= -3.8e-192) and ((x <= -6e-238) or not (x <= 5.2e-142))): tmp = t_1 else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * z))) tmp = 0.0 if (x <= -3.4e+83) tmp = t_1; elseif (x <= -3e+36) tmp = Float64(2.0 * Float64(x * y)); elseif ((x <= -2.5e-88) || (!(x <= -3.8e-192) && ((x <= -6e-238) || !(x <= 5.2e-142)))) tmp = t_1; else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * z)); tmp = 0.0; if (x <= -3.4e+83) tmp = t_1; elseif (x <= -3e+36) tmp = 2.0 * (x * y); elseif ((x <= -2.5e-88) || (~((x <= -3.8e-192)) && ((x <= -6e-238) || ~((x <= 5.2e-142))))) tmp = t_1; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e+83], t$95$1, If[LessEqual[x, -3e+36], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2.5e-88], And[N[Not[LessEqual[x, -3.8e-192]], $MachinePrecision], Or[LessEqual[x, -6e-238], N[Not[LessEqual[x, 5.2e-142]], $MachinePrecision]]]], t$95$1, N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3 \cdot 10^{+36}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-88} \lor \neg \left(x \leq -3.8 \cdot 10^{-192}\right) \land \left(x \leq -6 \cdot 10^{-238} \lor \neg \left(x \leq 5.2 \cdot 10^{-142}\right)\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -3.3999999999999998e83 or -3e36 < x < -2.50000000000000004e-88 or -3.8000000000000001e-192 < x < -5.9999999999999999e-238 or 5.1999999999999999e-142 < x Initial program 99.9%
Taylor expanded in y around 0 73.7%
if -3.3999999999999998e83 < x < -3e36Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in z around 0 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around 0 79.1%
if -2.50000000000000004e-88 < x < -3.8000000000000001e-192 or -5.9999999999999999e-238 < x < 5.1999999999999999e-142Initial program 99.9%
Taylor expanded in x around 0 73.3%
Final simplification73.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))) (t_2 (* x (+ t (* 2.0 y)))))
(if (<= y -1.05e+54)
t_2
(if (<= y 9800000000000.0)
t_1
(if (<= y 5.5e+57) (* y 5.0) (if (<= y 1.9e+93) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (2.0 * z));
double t_2 = x * (t + (2.0 * y));
double tmp;
if (y <= -1.05e+54) {
tmp = t_2;
} else if (y <= 9800000000000.0) {
tmp = t_1;
} else if (y <= 5.5e+57) {
tmp = y * 5.0;
} else if (y <= 1.9e+93) {
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 = x * (t + (2.0d0 * z))
t_2 = x * (t + (2.0d0 * y))
if (y <= (-1.05d+54)) then
tmp = t_2
else if (y <= 9800000000000.0d0) then
tmp = t_1
else if (y <= 5.5d+57) then
tmp = y * 5.0d0
else if (y <= 1.9d+93) 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 = x * (t + (2.0 * z));
double t_2 = x * (t + (2.0 * y));
double tmp;
if (y <= -1.05e+54) {
tmp = t_2;
} else if (y <= 9800000000000.0) {
tmp = t_1;
} else if (y <= 5.5e+57) {
tmp = y * 5.0;
} else if (y <= 1.9e+93) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (2.0 * z)) t_2 = x * (t + (2.0 * y)) tmp = 0 if y <= -1.05e+54: tmp = t_2 elif y <= 9800000000000.0: tmp = t_1 elif y <= 5.5e+57: tmp = y * 5.0 elif y <= 1.9e+93: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(2.0 * z))) t_2 = Float64(x * Float64(t + Float64(2.0 * y))) tmp = 0.0 if (y <= -1.05e+54) tmp = t_2; elseif (y <= 9800000000000.0) tmp = t_1; elseif (y <= 5.5e+57) tmp = Float64(y * 5.0); elseif (y <= 1.9e+93) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (2.0 * z)); t_2 = x * (t + (2.0 * y)); tmp = 0.0; if (y <= -1.05e+54) tmp = t_2; elseif (y <= 9800000000000.0) tmp = t_1; elseif (y <= 5.5e+57) tmp = y * 5.0; elseif (y <= 1.9e+93) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e+54], t$95$2, If[LessEqual[y, 9800000000000.0], t$95$1, If[LessEqual[y, 5.5e+57], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 1.9e+93], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + 2 \cdot z\right)\\
t_2 := x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{+54}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 9800000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+57}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.04999999999999993e54 or 1.8999999999999999e93 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 64.8%
Taylor expanded in z around 0 60.8%
*-commutative60.8%
Simplified60.8%
if -1.04999999999999993e54 < y < 9.8e12 or 5.5000000000000002e57 < y < 1.8999999999999999e93Initial program 99.9%
Taylor expanded in y around 0 82.3%
if 9.8e12 < y < 5.5000000000000002e57Initial program 100.0%
Taylor expanded in x around 0 67.8%
Final simplification73.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= z -6e+89)
t_1
(if (<= z 7.5e-263)
(* x t)
(if (<= z 1.7e-202) (* 2.0 (* x y)) (if (<= z 19.0) (* 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 <= -6e+89) {
tmp = t_1;
} else if (z <= 7.5e-263) {
tmp = x * t;
} else if (z <= 1.7e-202) {
tmp = 2.0 * (x * y);
} else if (z <= 19.0) {
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 <= (-6d+89)) then
tmp = t_1
else if (z <= 7.5d-263) then
tmp = x * t
else if (z <= 1.7d-202) then
tmp = 2.0d0 * (x * y)
else if (z <= 19.0d0) 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 <= -6e+89) {
tmp = t_1;
} else if (z <= 7.5e-263) {
tmp = x * t;
} else if (z <= 1.7e-202) {
tmp = 2.0 * (x * y);
} else if (z <= 19.0) {
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 <= -6e+89: tmp = t_1 elif z <= 7.5e-263: tmp = x * t elif z <= 1.7e-202: tmp = 2.0 * (x * y) elif z <= 19.0: 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 <= -6e+89) tmp = t_1; elseif (z <= 7.5e-263) tmp = Float64(x * t); elseif (z <= 1.7e-202) tmp = Float64(2.0 * Float64(x * y)); elseif (z <= 19.0) 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 <= -6e+89) tmp = t_1; elseif (z <= 7.5e-263) tmp = x * t; elseif (z <= 1.7e-202) tmp = 2.0 * (x * y); elseif (z <= 19.0) 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, -6e+89], t$95$1, If[LessEqual[z, 7.5e-263], N[(x * t), $MachinePrecision], If[LessEqual[z, 1.7e-202], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 19.0], 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 -6 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-263}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-202}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;z \leq 19:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.00000000000000025e89 or 19 < z Initial program 100.0%
Taylor expanded in z around inf 54.6%
if -6.00000000000000025e89 < z < 7.50000000000000044e-263 or 1.70000000000000006e-202 < z < 19Initial program 99.9%
Taylor expanded in t around inf 51.4%
Simplified51.4%
if 7.50000000000000044e-263 < z < 1.70000000000000006e-202Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 72.6%
Taylor expanded in z around 0 72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in t around 0 72.6%
Final simplification53.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.05e-6) (not (<= x 0.00355))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (+ y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e-6) || !(x <= 0.00355)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.05d-6)) .or. (.not. (x <= 0.00355d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e-6) || !(x <= 0.00355)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.05e-6) or not (x <= 0.00355): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.05e-6) || !(x <= 0.00355)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.05e-6) || ~((x <= 0.00355))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.05e-6], N[Not[LessEqual[x, 0.00355]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-6} \lor \neg \left(x \leq 0.00355\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if x < -1.0499999999999999e-6 or 0.0035500000000000002 < 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 99.7%
if -1.0499999999999999e-6 < x < 0.0035500000000000002Initial program 99.9%
Taylor expanded in y around inf 83.8%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (<= t -2.05e+117) (* x t) (if (<= t 1.1e-213) (* y 5.0) (if (<= t 1.2e+72) (* 2.0 (* x y)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.05e+117) {
tmp = x * t;
} else if (t <= 1.1e-213) {
tmp = y * 5.0;
} else if (t <= 1.2e+72) {
tmp = 2.0 * (x * y);
} 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 (t <= (-2.05d+117)) then
tmp = x * t
else if (t <= 1.1d-213) then
tmp = y * 5.0d0
else if (t <= 1.2d+72) then
tmp = 2.0d0 * (x * y)
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 (t <= -2.05e+117) {
tmp = x * t;
} else if (t <= 1.1e-213) {
tmp = y * 5.0;
} else if (t <= 1.2e+72) {
tmp = 2.0 * (x * y);
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.05e+117: tmp = x * t elif t <= 1.1e-213: tmp = y * 5.0 elif t <= 1.2e+72: tmp = 2.0 * (x * y) else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.05e+117) tmp = Float64(x * t); elseif (t <= 1.1e-213) tmp = Float64(y * 5.0); elseif (t <= 1.2e+72) tmp = Float64(2.0 * Float64(x * y)); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.05e+117) tmp = x * t; elseif (t <= 1.1e-213) tmp = y * 5.0; elseif (t <= 1.2e+72) tmp = 2.0 * (x * y); else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.05e+117], N[(x * t), $MachinePrecision], If[LessEqual[t, 1.1e-213], N[(y * 5.0), $MachinePrecision], If[LessEqual[t, 1.2e+72], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{+117}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{-213}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -2.05e117 or 1.20000000000000005e72 < t Initial program 100.0%
Taylor expanded in t around inf 71.6%
Simplified71.6%
if -2.05e117 < t < 1.10000000000000005e-213Initial program 99.9%
Taylor expanded in x around 0 40.1%
if 1.10000000000000005e-213 < t < 1.20000000000000005e72Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 75.7%
Taylor expanded in z around 0 51.7%
*-commutative51.7%
Simplified51.7%
Taylor expanded in t around 0 37.4%
Final simplification51.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.05e+85) (not (<= y 9800000000000.0))) (* y (+ 5.0 (* x 2.0))) (* x (+ (* 2.0 (+ y z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e+85) || !(y <= 9800000000000.0)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * ((2.0 * (y + z)) + 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 ((y <= (-1.05d+85)) .or. (.not. (y <= 9800000000000.0d0))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * ((2.0d0 * (y + z)) + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e+85) || !(y <= 9800000000000.0)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * ((2.0 * (y + z)) + t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.05e+85) or not (y <= 9800000000000.0): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * ((2.0 * (y + z)) + t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.05e+85) || !(y <= 9800000000000.0)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.05e+85) || ~((y <= 9800000000000.0))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * ((2.0 * (y + z)) + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.05e+85], N[Not[LessEqual[y, 9800000000000.0]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+85} \lor \neg \left(y \leq 9800000000000\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\end{array}
\end{array}
if y < -1.05000000000000005e85 or 9.8e12 < y Initial program 99.9%
Taylor expanded in y around inf 83.8%
Simplified83.8%
if -1.05000000000000005e85 < y < 9.8e12Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 87.8%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.05e-16) (not (<= x 4.2e-132))) (* 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 <= -3.05e-16) || !(x <= 4.2e-132)) {
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 <= (-3.05d-16)) .or. (.not. (x <= 4.2d-132))) 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 <= -3.05e-16) || !(x <= 4.2e-132)) {
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 <= -3.05e-16) or not (x <= 4.2e-132): 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 <= -3.05e-16) || !(x <= 4.2e-132)) 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 <= -3.05e-16) || ~((x <= 4.2e-132))) 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, -3.05e-16], N[Not[LessEqual[x, 4.2e-132]], $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 -3.05 \cdot 10^{-16} \lor \neg \left(x \leq 4.2 \cdot 10^{-132}\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 < -3.04999999999999976e-16 or 4.2000000000000002e-132 < 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 95.5%
if -3.04999999999999976e-16 < x < 4.2000000000000002e-132Initial program 99.9%
Taylor expanded in z around 0 87.3%
Simplified87.4%
fma-undefine87.3%
*-commutative87.3%
*-commutative87.3%
count-287.3%
+-commutative87.3%
+-commutative87.3%
distribute-lft-in87.3%
count-287.3%
*-commutative87.3%
+-commutative87.3%
associate-+l+87.3%
*-commutative87.3%
count-287.3%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified87.3%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.45e+84) (not (<= y 82000000000.0))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.45e+84) || !(y <= 82000000000.0)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
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 <= (-3.45d+84)) .or. (.not. (y <= 82000000000.0d0))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.45e+84) || !(y <= 82000000000.0)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.45e+84) or not (y <= 82000000000.0): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.45e+84) || !(y <= 82000000000.0)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.45e+84) || ~((y <= 82000000000.0))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.45e+84], N[Not[LessEqual[y, 82000000000.0]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.45 \cdot 10^{+84} \lor \neg \left(y \leq 82000000000\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -3.4499999999999998e84 or 8.2e10 < y Initial program 99.9%
Taylor expanded in y around inf 83.8%
Simplified83.8%
if -3.4499999999999998e84 < y < 8.2e10Initial program 99.9%
Taylor expanded in y around 0 81.6%
Final simplification82.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.05e+117) (not (<= t 5.4e+60))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.05e+117) || !(t <= 5.4e+60)) {
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 ((t <= (-2.05d+117)) .or. (.not. (t <= 5.4d+60))) 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 ((t <= -2.05e+117) || !(t <= 5.4e+60)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.05e+117) or not (t <= 5.4e+60): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.05e+117) || !(t <= 5.4e+60)) 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 ((t <= -2.05e+117) || ~((t <= 5.4e+60))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.05e+117], N[Not[LessEqual[t, 5.4e+60]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{+117} \lor \neg \left(t \leq 5.4 \cdot 10^{+60}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if t < -2.05e117 or 5.3999999999999999e60 < t Initial program 100.0%
Taylor expanded in t around inf 70.5%
Simplified70.5%
if -2.05e117 < t < 5.3999999999999999e60Initial program 99.9%
Taylor expanded in x around 0 35.4%
Final simplification48.8%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ (* 2.0 (+ y z)) t))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * ((2.0 * (y + z)) + 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 = (y * 5.0d0) + (x * ((2.0d0 * (y + z)) + t))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * ((2.0 * (y + z)) + t));
}
def code(x, y, z, t): return (y * 5.0) + (x * ((2.0 * (y + z)) + t))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * ((2.0 * (y + z)) + t)); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(2 \cdot \left(y + z\right) + t\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(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 26.4%
Final simplification26.4%
herbie shell --seed 2024039
(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)))