
(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 y 5.0 (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * (t + ((y + z) * 2.0))));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(y + z\right) \cdot 2\right)\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define99.6%
*-un-lft-identity99.6%
*-un-lft-identity99.6%
associate-+l+99.6%
*-un-lft-identity99.6%
+-commutative99.6%
*-un-lft-identity99.6%
distribute-rgt-out99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.1e-25)
(* x t)
(if (<= x 3.1e-13)
(* y 5.0)
(if (or (<= x 5.4e+50) (and (not (<= x 2.5e+88)) (<= x 1.35e+211)))
(* x (* z 2.0))
(* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-25) {
tmp = x * t;
} else if (x <= 3.1e-13) {
tmp = y * 5.0;
} else if ((x <= 5.4e+50) || (!(x <= 2.5e+88) && (x <= 1.35e+211))) {
tmp = x * (z * 2.0);
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.1d-25)) then
tmp = x * t
else if (x <= 3.1d-13) then
tmp = y * 5.0d0
else if ((x <= 5.4d+50) .or. (.not. (x <= 2.5d+88)) .and. (x <= 1.35d+211)) then
tmp = x * (z * 2.0d0)
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-25) {
tmp = x * t;
} else if (x <= 3.1e-13) {
tmp = y * 5.0;
} else if ((x <= 5.4e+50) || (!(x <= 2.5e+88) && (x <= 1.35e+211))) {
tmp = x * (z * 2.0);
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.1e-25: tmp = x * t elif x <= 3.1e-13: tmp = y * 5.0 elif (x <= 5.4e+50) or (not (x <= 2.5e+88) and (x <= 1.35e+211)): tmp = x * (z * 2.0) else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.1e-25) tmp = Float64(x * t); elseif (x <= 3.1e-13) tmp = Float64(y * 5.0); elseif ((x <= 5.4e+50) || (!(x <= 2.5e+88) && (x <= 1.35e+211))) tmp = Float64(x * Float64(z * 2.0)); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.1e-25) tmp = x * t; elseif (x <= 3.1e-13) tmp = y * 5.0; elseif ((x <= 5.4e+50) || (~((x <= 2.5e+88)) && (x <= 1.35e+211))) tmp = x * (z * 2.0); else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.1e-25], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.1e-13], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 5.4e+50], And[N[Not[LessEqual[x, 2.5e+88]], $MachinePrecision], LessEqual[x, 1.35e+211]]], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision], N[(x * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-25}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-13}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+50} \lor \neg \left(x \leq 2.5 \cdot 10^{+88}\right) \land x \leq 1.35 \cdot 10^{+211}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -3.09999999999999995e-25 or 5.4e50 < x < 2.49999999999999999e88 or 1.35e211 < x Initial program 98.9%
Taylor expanded in y around 0 91.9%
Taylor expanded in t around inf 52.2%
*-commutative52.2%
Simplified52.2%
if -3.09999999999999995e-25 < x < 3.0999999999999999e-13Initial program 99.9%
Taylor expanded in x around 0 62.1%
Simplified62.1%
if 3.0999999999999999e-13 < x < 5.4e50 or 2.49999999999999999e88 < x < 1.35e211Initial program 99.9%
Taylor expanded in y around 0 97.5%
Taylor expanded in z around inf 57.6%
*-commutative57.6%
associate-*l*57.6%
*-commutative57.6%
Simplified57.6%
Final simplification58.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0)))))
(if (<= x -3.1e-25)
t_1
(if (<= x 1.25e-111)
(* y 5.0)
(if (or (<= x 2.9e+49) (not (<= x 8.8e+86)))
t_1
(* x (+ t (* y 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double tmp;
if (x <= -3.1e-25) {
tmp = t_1;
} else if (x <= 1.25e-111) {
tmp = y * 5.0;
} else if ((x <= 2.9e+49) || !(x <= 8.8e+86)) {
tmp = t_1;
} else {
tmp = x * (t + (y * 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) :: t_1
real(8) :: tmp
t_1 = x * (t + (z * 2.0d0))
if (x <= (-3.1d-25)) then
tmp = t_1
else if (x <= 1.25d-111) then
tmp = y * 5.0d0
else if ((x <= 2.9d+49) .or. (.not. (x <= 8.8d+86))) then
tmp = t_1
else
tmp = x * (t + (y * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double tmp;
if (x <= -3.1e-25) {
tmp = t_1;
} else if (x <= 1.25e-111) {
tmp = y * 5.0;
} else if ((x <= 2.9e+49) || !(x <= 8.8e+86)) {
tmp = t_1;
} else {
tmp = x * (t + (y * 2.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (z * 2.0)) tmp = 0 if x <= -3.1e-25: tmp = t_1 elif x <= 1.25e-111: tmp = y * 5.0 elif (x <= 2.9e+49) or not (x <= 8.8e+86): tmp = t_1 else: tmp = x * (t + (y * 2.0)) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(z * 2.0))) tmp = 0.0 if (x <= -3.1e-25) tmp = t_1; elseif (x <= 1.25e-111) tmp = Float64(y * 5.0); elseif ((x <= 2.9e+49) || !(x <= 8.8e+86)) tmp = t_1; else tmp = Float64(x * Float64(t + Float64(y * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (z * 2.0)); tmp = 0.0; if (x <= -3.1e-25) tmp = t_1; elseif (x <= 1.25e-111) tmp = y * 5.0; elseif ((x <= 2.9e+49) || ~((x <= 8.8e+86))) tmp = t_1; else tmp = x * (t + (y * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.1e-25], t$95$1, If[LessEqual[x, 1.25e-111], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 2.9e+49], N[Not[LessEqual[x, 8.8e+86]], $MachinePrecision]], t$95$1, N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-111}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+49} \lor \neg \left(x \leq 8.8 \cdot 10^{+86}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\end{array}
\end{array}
if x < -3.09999999999999995e-25 or 1.2500000000000001e-111 < x < 2.9e49 or 8.80000000000000013e86 < x Initial program 99.3%
Taylor expanded in x around inf 96.8%
Taylor expanded in y around 0 75.9%
if -3.09999999999999995e-25 < x < 1.2500000000000001e-111Initial program 99.9%
Taylor expanded in x around 0 65.9%
Simplified65.9%
if 2.9e49 < x < 8.80000000000000013e86Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 100.0%
distribute-lft-in100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification73.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.65)
t_1
(if (<= y 2.6e-92)
(* x (+ t (* z 2.0)))
(if (<= y 6e+61) (+ (* y 5.0) (* x t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.65) {
tmp = t_1;
} else if (y <= 2.6e-92) {
tmp = x * (t + (z * 2.0));
} else if (y <= 6e+61) {
tmp = (y * 5.0) + (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 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-1.65d0)) then
tmp = t_1
else if (y <= 2.6d-92) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 6d+61) then
tmp = (y * 5.0d0) + (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 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -1.65) {
tmp = t_1;
} else if (y <= 2.6e-92) {
tmp = x * (t + (z * 2.0));
} else if (y <= 6e+61) {
tmp = (y * 5.0) + (x * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -1.65: tmp = t_1 elif y <= 2.6e-92: tmp = x * (t + (z * 2.0)) elif y <= 6e+61: tmp = (y * 5.0) + (x * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -1.65) tmp = t_1; elseif (y <= 2.6e-92) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 6e+61) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -1.65) tmp = t_1; elseif (y <= 2.6e-92) tmp = x * (t + (z * 2.0)); elseif (y <= 6e+61) tmp = (y * 5.0) + (x * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.65], t$95$1, If[LessEqual[y, 2.6e-92], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+61], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -1.65:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-92}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+61}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.6499999999999999 or 6e61 < y Initial program 99.0%
Taylor expanded in y around inf 79.2%
Simplified79.2%
if -1.6499999999999999 < y < 2.6e-92Initial program 99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in y around 0 84.2%
if 2.6e-92 < y < 6e61Initial program 99.9%
Taylor expanded in t around inf 82.3%
Final simplification81.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ y z) 2.0)))
(if (or (<= x -3e-25) (not (<= x 6.2)))
(* x (+ t t_1))
(+ (* y 5.0) (* x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y + z) * 2.0;
double tmp;
if ((x <= -3e-25) || !(x <= 6.2)) {
tmp = x * (t + t_1);
} else {
tmp = (y * 5.0) + (x * t_1);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y + z) * 2.0d0
if ((x <= (-3d-25)) .or. (.not. (x <= 6.2d0))) then
tmp = x * (t + t_1)
else
tmp = (y * 5.0d0) + (x * t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y + z) * 2.0;
double tmp;
if ((x <= -3e-25) || !(x <= 6.2)) {
tmp = x * (t + t_1);
} else {
tmp = (y * 5.0) + (x * t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y + z) * 2.0 tmp = 0 if (x <= -3e-25) or not (x <= 6.2): tmp = x * (t + t_1) else: tmp = (y * 5.0) + (x * t_1) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y + z) * 2.0) tmp = 0.0 if ((x <= -3e-25) || !(x <= 6.2)) tmp = Float64(x * Float64(t + t_1)); else tmp = Float64(Float64(y * 5.0) + Float64(x * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y + z) * 2.0; tmp = 0.0; if ((x <= -3e-25) || ~((x <= 6.2))) tmp = x * (t + t_1); else tmp = (y * 5.0) + (x * t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]}, If[Or[LessEqual[x, -3e-25], N[Not[LessEqual[x, 6.2]], $MachinePrecision]], N[(x * N[(t + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + z\right) \cdot 2\\
\mathbf{if}\;x \leq -3 \cdot 10^{-25} \lor \neg \left(x \leq 6.2\right):\\
\;\;\;\;x \cdot \left(t + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\_1\\
\end{array}
\end{array}
if x < -2.9999999999999998e-25 or 6.20000000000000018 < x Initial program 99.2%
Taylor expanded in x around inf 99.2%
Taylor expanded in x around inf 97.7%
distribute-lft-in97.7%
Simplified97.7%
if -2.9999999999999998e-25 < x < 6.20000000000000018Initial program 99.9%
associate-+l+99.9%
*-un-lft-identity99.9%
+-commutative99.9%
*-un-lft-identity99.9%
distribute-rgt-out99.9%
metadata-eval99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 83.5%
*-commutative83.5%
associate-*r*83.5%
*-commutative83.5%
Simplified83.5%
Final simplification90.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.9e+32) (not (<= x 2.5))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x (+ t (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.9e+32) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.9d+32)) .or. (.not. (x <= 2.5d0))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * (t + (z * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.9e+32) || !(x <= 2.5)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.9e+32) or not (x <= 2.5): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * (t + (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.9e+32) || !(x <= 2.5)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.9e+32) || ~((x <= 2.5))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * (t + (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.9e+32], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{+32} \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if x < -3.8999999999999999e32 or 2.5 < x Initial program 100.0%
Taylor expanded in x around inf 100.0%
Taylor expanded in x around inf 99.2%
distribute-lft-in99.2%
Simplified99.2%
if -3.8999999999999999e32 < x < 2.5Initial program 99.2%
Taylor expanded in y around 0 98.7%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.2e-23) (not (<= x 1.15e-12))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.2e-23) || !(x <= 1.15e-12)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.2d-23)) .or. (.not. (x <= 1.15d-12))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.2e-23) || !(x <= 1.15e-12)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.2e-23) or not (x <= 1.15e-12): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.2e-23) || !(x <= 1.15e-12)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.2e-23) || ~((x <= 1.15e-12))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.2e-23], N[Not[LessEqual[x, 1.15e-12]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-23} \lor \neg \left(x \leq 1.15 \cdot 10^{-12}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -1.19999999999999998e-23 or 1.14999999999999995e-12 < x Initial program 99.2%
Taylor expanded in x around inf 99.2%
Taylor expanded in x around inf 97.1%
distribute-lft-in97.1%
Simplified97.1%
if -1.19999999999999998e-23 < x < 1.14999999999999995e-12Initial program 99.9%
Taylor expanded in t around inf 78.5%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-25) (not (<= x 1.0))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-25) || !(x <= 1.0)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * 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 ((x <= (-3.2d-25)) .or. (.not. (x <= 1.0d0))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (2.0d0 * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-25) || !(x <= 1.0)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-25) or not (x <= 1.0): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-25) || !(x <= 1.0)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.2e-25) || ~((x <= 1.0))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-25], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-25} \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -3.2000000000000001e-25 or 1 < x Initial program 99.2%
Taylor expanded in x around inf 99.2%
Taylor expanded in x around inf 97.7%
distribute-lft-in97.7%
Simplified97.7%
if -3.2000000000000001e-25 < x < 1Initial program 99.9%
Taylor expanded in z around inf 82.7%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.8e-25) (not (<= x 1.16e-110))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.8e-25) || !(x <= 1.16e-110)) {
tmp = x * (t + (z * 2.0));
} 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 <= (-2.8d-25)) .or. (.not. (x <= 1.16d-110))) then
tmp = x * (t + (z * 2.0d0))
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 <= -2.8e-25) || !(x <= 1.16e-110)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.8e-25) or not (x <= 1.16e-110): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.8e-25) || !(x <= 1.16e-110)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.8e-25) || ~((x <= 1.16e-110))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.8e-25], N[Not[LessEqual[x, 1.16e-110]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-25} \lor \neg \left(x \leq 1.16 \cdot 10^{-110}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.79999999999999988e-25 or 1.16000000000000001e-110 < x Initial program 99.3%
Taylor expanded in x around inf 97.0%
Taylor expanded in y around 0 73.8%
if -2.79999999999999988e-25 < x < 1.16000000000000001e-110Initial program 99.9%
Taylor expanded in x around 0 65.9%
Simplified65.9%
Final simplification70.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4800000.0) (not (<= y 3.65e+53))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4800000.0) || !(y <= 3.65e+53)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4800000.0d0)) .or. (.not. (y <= 3.65d+53))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4800000.0) || !(y <= 3.65e+53)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4800000.0) or not (y <= 3.65e+53): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4800000.0) || !(y <= 3.65e+53)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4800000.0) || ~((y <= 3.65e+53))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4800000.0], N[Not[LessEqual[y, 3.65e+53]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4800000 \lor \neg \left(y \leq 3.65 \cdot 10^{+53}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -4.8e6 or 3.65000000000000008e53 < y Initial program 99.1%
Taylor expanded in y around inf 78.9%
Simplified78.9%
if -4.8e6 < y < 3.65000000000000008e53Initial program 99.9%
Taylor expanded in x around inf 99.8%
Taylor expanded in y around 0 80.9%
Final simplification80.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-25) (not (<= x 1.0))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-25) || !(x <= 1.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 <= (-3.2d-25)) .or. (.not. (x <= 1.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 <= -3.2e-25) || !(x <= 1.0)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-25) or not (x <= 1.0): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-25) || !(x <= 1.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 <= -3.2e-25) || ~((x <= 1.0))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-25], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-25} \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -3.2000000000000001e-25 or 1 < x Initial program 99.2%
Taylor expanded in y around 0 93.5%
Taylor expanded in t around inf 46.7%
*-commutative46.7%
Simplified46.7%
if -3.2000000000000001e-25 < x < 1Initial program 99.9%
Taylor expanded in x around 0 60.0%
Simplified60.0%
Final simplification53.5%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (* (+ y z) 2.0)))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + ((y + z) * 2.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) + (x * (t + ((y + z) * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + ((y + z) * 2.0)));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + ((y + z) * 2.0)))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(Float64(y + z) * 2.0)))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + ((y + z) * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + z\right) \cdot 2\right)
\end{array}
Initial program 99.5%
associate-+l+99.5%
*-un-lft-identity99.5%
+-commutative99.5%
*-un-lft-identity99.5%
distribute-rgt-out99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(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%
Taylor expanded in t around inf 32.1%
*-commutative32.1%
Simplified32.1%
Final simplification32.1%
herbie shell --seed 2024095
(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)))