
(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-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* 2.0 z)))) (t_2 (* x (+ t (* 2.0 y)))))
(if (<= x -3.9e+117)
t_2
(if (<= x -1.4e+17)
t_1
(if (<= x -5.1e-14)
t_2
(if (<= x 3e-97)
(* y 5.0)
(if (or (<= x 6e+26) (not (<= x 1.7e+109))) 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 (x <= -3.9e+117) {
tmp = t_2;
} else if (x <= -1.4e+17) {
tmp = t_1;
} else if (x <= -5.1e-14) {
tmp = t_2;
} else if (x <= 3e-97) {
tmp = y * 5.0;
} else if ((x <= 6e+26) || !(x <= 1.7e+109)) {
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 (x <= (-3.9d+117)) then
tmp = t_2
else if (x <= (-1.4d+17)) then
tmp = t_1
else if (x <= (-5.1d-14)) then
tmp = t_2
else if (x <= 3d-97) then
tmp = y * 5.0d0
else if ((x <= 6d+26) .or. (.not. (x <= 1.7d+109))) 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 (x <= -3.9e+117) {
tmp = t_2;
} else if (x <= -1.4e+17) {
tmp = t_1;
} else if (x <= -5.1e-14) {
tmp = t_2;
} else if (x <= 3e-97) {
tmp = y * 5.0;
} else if ((x <= 6e+26) || !(x <= 1.7e+109)) {
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 x <= -3.9e+117: tmp = t_2 elif x <= -1.4e+17: tmp = t_1 elif x <= -5.1e-14: tmp = t_2 elif x <= 3e-97: tmp = y * 5.0 elif (x <= 6e+26) or not (x <= 1.7e+109): 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 (x <= -3.9e+117) tmp = t_2; elseif (x <= -1.4e+17) tmp = t_1; elseif (x <= -5.1e-14) tmp = t_2; elseif (x <= 3e-97) tmp = Float64(y * 5.0); elseif ((x <= 6e+26) || !(x <= 1.7e+109)) 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 (x <= -3.9e+117) tmp = t_2; elseif (x <= -1.4e+17) tmp = t_1; elseif (x <= -5.1e-14) tmp = t_2; elseif (x <= 3e-97) tmp = y * 5.0; elseif ((x <= 6e+26) || ~((x <= 1.7e+109))) 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[x, -3.9e+117], t$95$2, If[LessEqual[x, -1.4e+17], t$95$1, If[LessEqual[x, -5.1e-14], t$95$2, If[LessEqual[x, 3e-97], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 6e+26], N[Not[LessEqual[x, 1.7e+109]], $MachinePrecision]], 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}\;x \leq -3.9 \cdot 10^{+117}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -5.1 \cdot 10^{-14}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-97}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+26} \lor \neg \left(x \leq 1.7 \cdot 10^{+109}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -3.8999999999999999e117 or -1.4e17 < x < -5.0999999999999997e-14 or 5.99999999999999994e26 < x < 1.70000000000000003e109Initial program 100.0%
Taylor expanded in y around inf 74.3%
Taylor expanded in x around inf 71.7%
if -3.8999999999999999e117 < x < -1.4e17 or 3.00000000000000024e-97 < x < 5.99999999999999994e26 or 1.70000000000000003e109 < x Initial program 100.0%
Taylor expanded in y around 0 77.6%
if -5.0999999999999997e-14 < x < 3.00000000000000024e-97Initial program 99.8%
Taylor expanded in x around 0 73.7%
Final simplification74.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -2.15e+268)
(* x t)
(if (<= x -4.7e+141)
t_1
(if (<= x -2.25e+57)
(* x t)
(if (<= x -6.5e-9)
t_1
(if (<= x 4.1e-97) (* y 5.0) (if (<= x 5e+48) (* x t) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -2.15e+268) {
tmp = x * t;
} else if (x <= -4.7e+141) {
tmp = t_1;
} else if (x <= -2.25e+57) {
tmp = x * t;
} else if (x <= -6.5e-9) {
tmp = t_1;
} else if (x <= 4.1e-97) {
tmp = y * 5.0;
} else if (x <= 5e+48) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (x <= (-2.15d+268)) then
tmp = x * t
else if (x <= (-4.7d+141)) then
tmp = t_1
else if (x <= (-2.25d+57)) then
tmp = x * t
else if (x <= (-6.5d-9)) then
tmp = t_1
else if (x <= 4.1d-97) then
tmp = y * 5.0d0
else if (x <= 5d+48) then
tmp = x * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -2.15e+268) {
tmp = x * t;
} else if (x <= -4.7e+141) {
tmp = t_1;
} else if (x <= -2.25e+57) {
tmp = x * t;
} else if (x <= -6.5e-9) {
tmp = t_1;
} else if (x <= 4.1e-97) {
tmp = y * 5.0;
} else if (x <= 5e+48) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -2.15e+268: tmp = x * t elif x <= -4.7e+141: tmp = t_1 elif x <= -2.25e+57: tmp = x * t elif x <= -6.5e-9: tmp = t_1 elif x <= 4.1e-97: tmp = y * 5.0 elif x <= 5e+48: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -2.15e+268) tmp = Float64(x * t); elseif (x <= -4.7e+141) tmp = t_1; elseif (x <= -2.25e+57) tmp = Float64(x * t); elseif (x <= -6.5e-9) tmp = t_1; elseif (x <= 4.1e-97) tmp = Float64(y * 5.0); elseif (x <= 5e+48) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -2.15e+268) tmp = x * t; elseif (x <= -4.7e+141) tmp = t_1; elseif (x <= -2.25e+57) tmp = x * t; elseif (x <= -6.5e-9) tmp = t_1; elseif (x <= 4.1e-97) tmp = y * 5.0; elseif (x <= 5e+48) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.15e+268], N[(x * t), $MachinePrecision], If[LessEqual[x, -4.7e+141], t$95$1, If[LessEqual[x, -2.25e+57], N[(x * t), $MachinePrecision], If[LessEqual[x, -6.5e-9], t$95$1, If[LessEqual[x, 4.1e-97], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 5e+48], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -2.15 \cdot 10^{+268}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -4.7 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.25 \cdot 10^{+57}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-97}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+48}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.14999999999999985e268 or -4.69999999999999979e141 < x < -2.24999999999999998e57 or 4.09999999999999993e-97 < x < 4.99999999999999973e48Initial program 100.0%
Taylor expanded in t around inf 54.0%
Simplified54.0%
if -2.14999999999999985e268 < x < -4.69999999999999979e141 or -2.24999999999999998e57 < x < -6.5000000000000003e-9 or 4.99999999999999973e48 < x Initial program 100.0%
Taylor expanded in z around inf 47.4%
if -6.5000000000000003e-9 < x < 4.09999999999999993e-97Initial program 99.8%
Taylor expanded in x around 0 73.0%
Final simplification60.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))) (t_2 (* y (* x 2.0))))
(if (<= x -2.5e+117)
t_2
(if (<= x -2.05e+55)
(* x t)
(if (<= x -4e+34)
t_2
(if (<= x -3.2e-8)
t_1
(if (<= x 1.15e-97) (* y 5.0) (if (<= x 5e+48) (* x t) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = y * (x * 2.0);
double tmp;
if (x <= -2.5e+117) {
tmp = t_2;
} else if (x <= -2.05e+55) {
tmp = x * t;
} else if (x <= -4e+34) {
tmp = t_2;
} else if (x <= -3.2e-8) {
tmp = t_1;
} else if (x <= 1.15e-97) {
tmp = y * 5.0;
} else if (x <= 5e+48) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
t_2 = y * (x * 2.0d0)
if (x <= (-2.5d+117)) then
tmp = t_2
else if (x <= (-2.05d+55)) then
tmp = x * t
else if (x <= (-4d+34)) then
tmp = t_2
else if (x <= (-3.2d-8)) then
tmp = t_1
else if (x <= 1.15d-97) then
tmp = y * 5.0d0
else if (x <= 5d+48) then
tmp = x * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double t_2 = y * (x * 2.0);
double tmp;
if (x <= -2.5e+117) {
tmp = t_2;
} else if (x <= -2.05e+55) {
tmp = x * t;
} else if (x <= -4e+34) {
tmp = t_2;
} else if (x <= -3.2e-8) {
tmp = t_1;
} else if (x <= 1.15e-97) {
tmp = y * 5.0;
} else if (x <= 5e+48) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) t_2 = y * (x * 2.0) tmp = 0 if x <= -2.5e+117: tmp = t_2 elif x <= -2.05e+55: tmp = x * t elif x <= -4e+34: tmp = t_2 elif x <= -3.2e-8: tmp = t_1 elif x <= 1.15e-97: tmp = y * 5.0 elif x <= 5e+48: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) t_2 = Float64(y * Float64(x * 2.0)) tmp = 0.0 if (x <= -2.5e+117) tmp = t_2; elseif (x <= -2.05e+55) tmp = Float64(x * t); elseif (x <= -4e+34) tmp = t_2; elseif (x <= -3.2e-8) tmp = t_1; elseif (x <= 1.15e-97) tmp = Float64(y * 5.0); elseif (x <= 5e+48) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); t_2 = y * (x * 2.0); tmp = 0.0; if (x <= -2.5e+117) tmp = t_2; elseif (x <= -2.05e+55) tmp = x * t; elseif (x <= -4e+34) tmp = t_2; elseif (x <= -3.2e-8) tmp = t_1; elseif (x <= 1.15e-97) tmp = y * 5.0; elseif (x <= 5e+48) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e+117], t$95$2, If[LessEqual[x, -2.05e+55], N[(x * t), $MachinePrecision], If[LessEqual[x, -4e+34], t$95$2, If[LessEqual[x, -3.2e-8], t$95$1, If[LessEqual[x, 1.15e-97], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 5e+48], N[(x * t), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
t_2 := y \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+117}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -2.05 \cdot 10^{+55}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -4 \cdot 10^{+34}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-97}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+48}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.49999999999999992e117 or -2.04999999999999991e55 < x < -3.99999999999999978e34Initial program 100.0%
Taylor expanded in y around inf 74.4%
Taylor expanded in x around inf 74.4%
Taylor expanded in t around 0 53.3%
associate-*r*53.3%
*-commutative53.3%
Simplified53.3%
if -2.49999999999999992e117 < x < -2.04999999999999991e55 or 1.14999999999999997e-97 < x < 4.99999999999999973e48Initial program 99.9%
Taylor expanded in t around inf 53.0%
Simplified53.0%
if -3.99999999999999978e34 < x < -3.2000000000000002e-8 or 4.99999999999999973e48 < x Initial program 99.9%
Taylor expanded in z around inf 46.9%
if -3.2000000000000002e-8 < x < 1.14999999999999997e-97Initial program 99.8%
Taylor expanded in x around 0 73.0%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.92) (not (<= x 3.3e-97))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x (+ t (+ y y))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.92) || !(x <= 3.3e-97)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (y + y))) + (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.92d0)) .or. (.not. (x <= 3.3d-97))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * (t + (y + y))) + (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.92) || !(x <= 3.3e-97)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (y + y))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.92) or not (x <= 3.3e-97): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * (t + (y + y))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.92) || !(x <= 3.3e-97)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * Float64(t + Float64(y + y))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.92) || ~((x <= 3.3e-97))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * (t + (y + y))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.92], N[Not[LessEqual[x, 3.3e-97]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.92 \lor \neg \left(x \leq 3.3 \cdot 10^{-97}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -1.9199999999999999 or 3.3000000000000001e-97 < 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 97.8%
if -1.9199999999999999 < x < 3.3000000000000001e-97Initial program 99.8%
Taylor expanded in y around inf 90.1%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+44) (not (<= z 1.12e-27))) (+ (* (+ y z) (* x 2.0)) (* y 5.0)) (+ (* x (+ t (+ y y))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+44) || !(z <= 1.12e-27)) {
tmp = ((y + z) * (x * 2.0)) + (y * 5.0);
} else {
tmp = (x * (t + (y + y))) + (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 ((z <= (-1.2d+44)) .or. (.not. (z <= 1.12d-27))) then
tmp = ((y + z) * (x * 2.0d0)) + (y * 5.0d0)
else
tmp = (x * (t + (y + y))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+44) || !(z <= 1.12e-27)) {
tmp = ((y + z) * (x * 2.0)) + (y * 5.0);
} else {
tmp = (x * (t + (y + y))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+44) or not (z <= 1.12e-27): tmp = ((y + z) * (x * 2.0)) + (y * 5.0) else: tmp = (x * (t + (y + y))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+44) || !(z <= 1.12e-27)) tmp = Float64(Float64(Float64(y + z) * Float64(x * 2.0)) + Float64(y * 5.0)); else tmp = Float64(Float64(x * Float64(t + Float64(y + y))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.2e+44) || ~((z <= 1.12e-27))) tmp = ((y + z) * (x * 2.0)) + (y * 5.0); else tmp = (x * (t + (y + y))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+44], N[Not[LessEqual[z, 1.12e-27]], $MachinePrecision]], N[(N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+44} \lor \neg \left(z \leq 1.12 \cdot 10^{-27}\right):\\
\;\;\;\;\left(y + z\right) \cdot \left(x \cdot 2\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + \left(y + y\right)\right) + y \cdot 5\\
\end{array}
\end{array}
if z < -1.20000000000000007e44 or 1.1199999999999999e-27 < z Initial program 99.9%
Taylor expanded in t around 0 91.6%
Simplified91.6%
if -1.20000000000000007e44 < z < 1.1199999999999999e-27Initial program 99.9%
Taylor expanded in y around inf 97.7%
Final simplification94.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-7) (not (<= x 4.1e-97))) (* 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 <= -4.5e-7) || !(x <= 4.1e-97)) {
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 <= (-4.5d-7)) .or. (.not. (x <= 4.1d-97))) 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 <= -4.5e-7) || !(x <= 4.1e-97)) {
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 <= -4.5e-7) or not (x <= 4.1e-97): 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 <= -4.5e-7) || !(x <= 4.1e-97)) 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 <= -4.5e-7) || ~((x <= 4.1e-97))) 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, -4.5e-7], N[Not[LessEqual[x, 4.1e-97]], $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 -4.5 \cdot 10^{-7} \lor \neg \left(x \leq 4.1 \cdot 10^{-97}\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 < -4.4999999999999998e-7 or 4.09999999999999993e-97 < 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 97.2%
if -4.4999999999999998e-7 < x < 4.09999999999999993e-97Initial program 99.8%
fma-define99.8%
associate-+l+99.8%
+-commutative99.8%
count-299.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 90.8%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.1e-13) (not (<= x 4.1e-97))) (* x (+ t (* 2.0 y))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.1e-13) || !(x <= 4.1e-97)) {
tmp = x * (t + (2.0 * y));
} 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 <= (-7.1d-13)) .or. (.not. (x <= 4.1d-97))) then
tmp = x * (t + (2.0d0 * y))
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 <= -7.1e-13) || !(x <= 4.1e-97)) {
tmp = x * (t + (2.0 * y));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.1e-13) or not (x <= 4.1e-97): tmp = x * (t + (2.0 * y)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.1e-13) || !(x <= 4.1e-97)) tmp = Float64(x * Float64(t + Float64(2.0 * y))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.1e-13) || ~((x <= 4.1e-97))) tmp = x * (t + (2.0 * y)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.1e-13], N[Not[LessEqual[x, 4.1e-97]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-13} \lor \neg \left(x \leq 4.1 \cdot 10^{-97}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.1e-13 or 4.09999999999999993e-97 < x Initial program 100.0%
Taylor expanded in y around inf 68.4%
Taylor expanded in x around inf 65.7%
if -7.1e-13 < x < 4.09999999999999993e-97Initial program 99.8%
Taylor expanded in x around 0 73.7%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.8e-6) (not (<= y 7.8e+50))) (* 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 <= -8.8e-6) || !(y <= 7.8e+50)) {
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 <= (-8.8d-6)) .or. (.not. (y <= 7.8d+50))) 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 <= -8.8e-6) || !(y <= 7.8e+50)) {
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 <= -8.8e-6) or not (y <= 7.8e+50): 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 <= -8.8e-6) || !(y <= 7.8e+50)) 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 <= -8.8e-6) || ~((y <= 7.8e+50))) 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, -8.8e-6], N[Not[LessEqual[y, 7.8e+50]], $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 -8.8 \cdot 10^{-6} \lor \neg \left(y \leq 7.8 \cdot 10^{+50}\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 < -8.8000000000000004e-6 or 7.79999999999999935e50 < y Initial program 99.8%
Taylor expanded in y around inf 84.6%
Simplified84.6%
if -8.8000000000000004e-6 < y < 7.79999999999999935e50Initial program 99.9%
Taylor expanded in y around 0 80.8%
Final simplification82.7%
(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 (if (or (<= x -7e-13) (not (<= x 2.9e-99))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7e-13) || !(x <= 2.9e-99)) {
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 <= (-7d-13)) .or. (.not. (x <= 2.9d-99))) 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 <= -7e-13) || !(x <= 2.9e-99)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7e-13) or not (x <= 2.9e-99): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7e-13) || !(x <= 2.9e-99)) 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 <= -7e-13) || ~((x <= 2.9e-99))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7e-13], N[Not[LessEqual[x, 2.9e-99]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-13} \lor \neg \left(x \leq 2.9 \cdot 10^{-99}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.0000000000000005e-13 or 2.89999999999999985e-99 < x Initial program 100.0%
Taylor expanded in t around inf 34.9%
Simplified34.9%
if -7.0000000000000005e-13 < x < 2.89999999999999985e-99Initial program 99.8%
Taylor expanded in x around 0 73.7%
Final simplification51.3%
(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 33.0%
Final simplification33.0%
herbie shell --seed 2024045
(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)))