
(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 (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+62.1%
associate-*r/55.6%
fma-neg59.0%
associate-+l+59.0%
+-commutative59.0%
count-259.0%
associate-+l+59.0%
+-commutative59.0%
count-259.0%
fma-neg55.6%
associate-+l+55.6%
+-commutative55.6%
count-255.6%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.04e-23)
(* x t)
(if (<= x 3.5e-75)
(* y 5.0)
(if (or (<= x 4.2e+122) (and (not (<= x 1.18e+185)) (<= x 4.2e+252)))
(* x t)
(* 2.0 (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.04e-23) {
tmp = x * t;
} else if (x <= 3.5e-75) {
tmp = y * 5.0;
} else if ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252))) {
tmp = x * t;
} else {
tmp = 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 <= (-1.04d-23)) then
tmp = x * t
else if (x <= 3.5d-75) then
tmp = y * 5.0d0
else if ((x <= 4.2d+122) .or. (.not. (x <= 1.18d+185)) .and. (x <= 4.2d+252)) then
tmp = x * t
else
tmp = 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 <= -1.04e-23) {
tmp = x * t;
} else if (x <= 3.5e-75) {
tmp = y * 5.0;
} else if ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252))) {
tmp = x * t;
} else {
tmp = 2.0 * (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.04e-23: tmp = x * t elif x <= 3.5e-75: tmp = y * 5.0 elif (x <= 4.2e+122) or (not (x <= 1.18e+185) and (x <= 4.2e+252)): tmp = x * t else: tmp = 2.0 * (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.04e-23) tmp = Float64(x * t); elseif (x <= 3.5e-75) tmp = Float64(y * 5.0); elseif ((x <= 4.2e+122) || (!(x <= 1.18e+185) && (x <= 4.2e+252))) tmp = Float64(x * t); else tmp = Float64(2.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.04e-23) tmp = x * t; elseif (x <= 3.5e-75) tmp = y * 5.0; elseif ((x <= 4.2e+122) || (~((x <= 1.18e+185)) && (x <= 4.2e+252))) tmp = x * t; else tmp = 2.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.04e-23], N[(x * t), $MachinePrecision], If[LessEqual[x, 3.5e-75], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 4.2e+122], And[N[Not[LessEqual[x, 1.18e+185]], $MachinePrecision], LessEqual[x, 4.2e+252]]], N[(x * t), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.04 \cdot 10^{-23}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-75}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+122} \lor \neg \left(x \leq 1.18 \cdot 10^{+185}\right) \land x \leq 4.2 \cdot 10^{+252}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.04e-23 or 3.49999999999999985e-75 < x < 4.20000000000000032e122 or 1.18e185 < x < 4.2000000000000003e252Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+70.3%
associate-*r/57.3%
fma-neg64.2%
count-264.2%
+-commutative64.2%
associate-+l+64.2%
count-264.2%
+-commutative64.2%
associate-+l+64.2%
fma-neg57.3%
count-257.3%
+-commutative57.3%
associate-+l+57.3%
Applied egg-rr93.3%
Taylor expanded in t around inf 44.7%
*-commutative44.7%
Simplified44.7%
if -1.04e-23 < x < 3.49999999999999985e-75Initial program 100.0%
Taylor expanded in x around 0 65.6%
Simplified65.6%
if 4.20000000000000032e122 < x < 1.18e185 or 4.2000000000000003e252 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+88.6%
associate-*r/85.9%
fma-neg85.9%
count-285.9%
+-commutative85.9%
associate-+l+85.9%
count-285.9%
+-commutative85.9%
associate-+l+85.9%
fma-neg85.9%
count-285.9%
+-commutative85.9%
associate-+l+85.9%
Applied egg-rr97.1%
Taylor expanded in z around inf 48.6%
Final simplification53.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ (* y 5.0) (* x t))) (t_2 (* x (+ t (* (+ y z) 2.0)))))
(if (<= x -1.15)
t_2
(if (<= x 3.8e-150)
t_1
(if (<= x 4e-62)
(+ (* y 5.0) (* z (* x 2.0)))
(if (<= x 1.65e-21) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (x * t);
double t_2 = x * (t + ((y + z) * 2.0));
double tmp;
if (x <= -1.15) {
tmp = t_2;
} else if (x <= 3.8e-150) {
tmp = t_1;
} else if (x <= 4e-62) {
tmp = (y * 5.0) + (z * (x * 2.0));
} else if (x <= 1.65e-21) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y * 5.0d0) + (x * t)
t_2 = x * (t + ((y + z) * 2.0d0))
if (x <= (-1.15d0)) then
tmp = t_2
else if (x <= 3.8d-150) then
tmp = t_1
else if (x <= 4d-62) then
tmp = (y * 5.0d0) + (z * (x * 2.0d0))
else if (x <= 1.65d-21) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * 5.0) + (x * t);
double t_2 = x * (t + ((y + z) * 2.0));
double tmp;
if (x <= -1.15) {
tmp = t_2;
} else if (x <= 3.8e-150) {
tmp = t_1;
} else if (x <= 4e-62) {
tmp = (y * 5.0) + (z * (x * 2.0));
} else if (x <= 1.65e-21) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 5.0) + (x * t) t_2 = x * (t + ((y + z) * 2.0)) tmp = 0 if x <= -1.15: tmp = t_2 elif x <= 3.8e-150: tmp = t_1 elif x <= 4e-62: tmp = (y * 5.0) + (z * (x * 2.0)) elif x <= 1.65e-21: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 5.0) + Float64(x * t)) t_2 = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))) tmp = 0.0 if (x <= -1.15) tmp = t_2; elseif (x <= 3.8e-150) tmp = t_1; elseif (x <= 4e-62) tmp = Float64(Float64(y * 5.0) + Float64(z * Float64(x * 2.0))); elseif (x <= 1.65e-21) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 5.0) + (x * t); t_2 = x * (t + ((y + z) * 2.0)); tmp = 0.0; if (x <= -1.15) tmp = t_2; elseif (x <= 3.8e-150) tmp = t_1; elseif (x <= 4e-62) tmp = (y * 5.0) + (z * (x * 2.0)); elseif (x <= 1.65e-21) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15], t$95$2, If[LessEqual[x, 3.8e-150], t$95$1, If[LessEqual[x, 4e-62], N[(N[(y * 5.0), $MachinePrecision] + N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e-21], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot 5 + x \cdot t\\
t_2 := x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{if}\;x \leq -1.15:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-150}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-62}:\\
\;\;\;\;y \cdot 5 + z \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.1499999999999999 or 1.65000000000000004e-21 < 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 98.5%
if -1.1499999999999999 < x < 3.7999999999999998e-150 or 4.0000000000000002e-62 < x < 1.65000000000000004e-21Initial program 100.0%
Taylor expanded in t around inf 87.4%
Simplified87.4%
if 3.7999999999999998e-150 < x < 4.0000000000000002e-62Initial program 100.0%
Taylor expanded in z around inf 94.4%
Simplified94.4%
Final simplification93.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -4.8e-25)
(* x t)
(if (<= x 6.6e-6)
(* y 5.0)
(if (or (<= x 1.06e+122) (not (<= x 5e+226)))
(* x (* y 2.0))
(* 2.0 (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-25) {
tmp = x * t;
} else if (x <= 6.6e-6) {
tmp = y * 5.0;
} else if ((x <= 1.06e+122) || !(x <= 5e+226)) {
tmp = x * (y * 2.0);
} else {
tmp = 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 <= (-4.8d-25)) then
tmp = x * t
else if (x <= 6.6d-6) then
tmp = y * 5.0d0
else if ((x <= 1.06d+122) .or. (.not. (x <= 5d+226))) then
tmp = x * (y * 2.0d0)
else
tmp = 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 <= -4.8e-25) {
tmp = x * t;
} else if (x <= 6.6e-6) {
tmp = y * 5.0;
} else if ((x <= 1.06e+122) || !(x <= 5e+226)) {
tmp = x * (y * 2.0);
} else {
tmp = 2.0 * (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.8e-25: tmp = x * t elif x <= 6.6e-6: tmp = y * 5.0 elif (x <= 1.06e+122) or not (x <= 5e+226): tmp = x * (y * 2.0) else: tmp = 2.0 * (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.8e-25) tmp = Float64(x * t); elseif (x <= 6.6e-6) tmp = Float64(y * 5.0); elseif ((x <= 1.06e+122) || !(x <= 5e+226)) tmp = Float64(x * Float64(y * 2.0)); else tmp = Float64(2.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.8e-25) tmp = x * t; elseif (x <= 6.6e-6) tmp = y * 5.0; elseif ((x <= 1.06e+122) || ~((x <= 5e+226))) tmp = x * (y * 2.0); else tmp = 2.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e-25], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.6e-6], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.06e+122], N[Not[LessEqual[x, 5e+226]], $MachinePrecision]], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-25}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-6}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+122} \lor \neg \left(x \leq 5 \cdot 10^{+226}\right):\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -4.80000000000000018e-25Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+76.3%
associate-*r/57.9%
fma-neg66.6%
count-266.6%
+-commutative66.6%
associate-+l+66.6%
count-266.6%
+-commutative66.6%
associate-+l+66.6%
fma-neg57.9%
count-257.9%
+-commutative57.9%
associate-+l+57.9%
Applied egg-rr91.2%
Taylor expanded in t around inf 44.7%
*-commutative44.7%
Simplified44.7%
if -4.80000000000000018e-25 < x < 6.60000000000000034e-6Initial program 100.0%
Taylor expanded in x around 0 62.3%
Simplified62.3%
if 6.60000000000000034e-6 < x < 1.06000000000000002e122 or 5.0000000000000005e226 < 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 98.5%
distribute-lft-in93.9%
*-commutative93.9%
fma-define96.2%
Applied egg-rr96.2%
Taylor expanded in y around inf 50.7%
*-commutative50.7%
associate-*l*50.7%
*-commutative50.7%
Simplified50.7%
if 1.06000000000000002e122 < x < 5.0000000000000005e226Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+83.2%
associate-*r/76.9%
fma-neg80.3%
count-280.3%
+-commutative80.3%
associate-+l+80.3%
count-280.3%
+-commutative80.3%
associate-+l+80.3%
fma-neg76.9%
count-276.9%
+-commutative76.9%
associate-+l+76.9%
Applied egg-rr96.5%
Taylor expanded in z around inf 47.2%
Final simplification53.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0)))))
(if (<= z -2.4e+50)
t_1
(if (<= z 1.05e-101)
(* x (+ t (* y 2.0)))
(if (<= z 2.3e-53) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double tmp;
if (z <= -2.4e+50) {
tmp = t_1;
} else if (z <= 1.05e-101) {
tmp = x * (t + (y * 2.0));
} else if (z <= 2.3e-53) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t + (z * 2.0d0))
if (z <= (-2.4d+50)) then
tmp = t_1
else if (z <= 1.05d-101) then
tmp = x * (t + (y * 2.0d0))
else if (z <= 2.3d-53) then
tmp = y * 5.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double tmp;
if (z <= -2.4e+50) {
tmp = t_1;
} else if (z <= 1.05e-101) {
tmp = x * (t + (y * 2.0));
} else if (z <= 2.3e-53) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (z * 2.0)) tmp = 0 if z <= -2.4e+50: tmp = t_1 elif z <= 1.05e-101: tmp = x * (t + (y * 2.0)) elif z <= 2.3e-53: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(z * 2.0))) tmp = 0.0 if (z <= -2.4e+50) tmp = t_1; elseif (z <= 1.05e-101) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif (z <= 2.3e-53) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (z * 2.0)); tmp = 0.0; if (z <= -2.4e+50) tmp = t_1; elseif (z <= 1.05e-101) tmp = x * (t + (y * 2.0)); elseif (z <= 2.3e-53) tmp = y * 5.0; else tmp = t_1; 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[z, -2.4e+50], t$95$1, If[LessEqual[z, 1.05e-101], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e-53], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-101}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-53}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4000000000000002e50 or 2.3000000000000001e-53 < z Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+55.1%
associate-*r/49.9%
fma-neg55.0%
count-255.0%
+-commutative55.0%
associate-+l+55.0%
count-255.0%
+-commutative55.0%
associate-+l+55.0%
fma-neg49.9%
count-249.9%
+-commutative49.9%
associate-+l+49.9%
Applied egg-rr93.4%
Taylor expanded in y around 0 69.8%
+-commutative69.8%
*-commutative69.8%
associate-*r*69.8%
distribute-rgt-in75.5%
Simplified75.5%
if -2.4000000000000002e50 < z < 1.05000000000000008e-101Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 69.0%
Taylor expanded in z around 0 66.1%
if 1.05000000000000008e-101 < z < 2.3000000000000001e-53Initial program 100.0%
Taylor expanded in x around 0 85.7%
Simplified85.7%
Final simplification70.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -1.55e+69)
t_1
(if (<= y 5.8e-62)
(* x (+ t (* z 2.0)))
(if (<= y 4e+144) (+ (* 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.55e+69) {
tmp = t_1;
} else if (y <= 5.8e-62) {
tmp = x * (t + (z * 2.0));
} else if (y <= 4e+144) {
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.55d+69)) then
tmp = t_1
else if (y <= 5.8d-62) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 4d+144) 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.55e+69) {
tmp = t_1;
} else if (y <= 5.8e-62) {
tmp = x * (t + (z * 2.0));
} else if (y <= 4e+144) {
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.55e+69: tmp = t_1 elif y <= 5.8e-62: tmp = x * (t + (z * 2.0)) elif y <= 4e+144: 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.55e+69) tmp = t_1; elseif (y <= 5.8e-62) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 4e+144) 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.55e+69) tmp = t_1; elseif (y <= 5.8e-62) tmp = x * (t + (z * 2.0)); elseif (y <= 4e+144) 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.55e+69], t$95$1, If[LessEqual[y, 5.8e-62], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+144], 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.55 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-62}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+144}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.5499999999999999e69 or 4.00000000000000009e144 < y Initial program 100.0%
Taylor expanded in y around inf 89.5%
Simplified89.5%
if -1.5499999999999999e69 < y < 5.79999999999999971e-62Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+69.2%
associate-*r/62.7%
fma-neg64.6%
count-264.6%
+-commutative64.6%
associate-+l+64.6%
count-264.6%
+-commutative64.6%
associate-+l+64.6%
fma-neg62.7%
count-262.7%
+-commutative62.7%
associate-+l+62.7%
Applied egg-rr98.2%
Taylor expanded in y around 0 81.1%
+-commutative81.1%
*-commutative81.1%
associate-*r*81.1%
distribute-rgt-in82.9%
Simplified82.9%
if 5.79999999999999971e-62 < y < 4.00000000000000009e144Initial program 99.9%
Taylor expanded in t around inf 74.8%
Simplified74.8%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.15) (not (<= x 4.5e-21))) (* 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.15) || !(x <= 4.5e-21)) {
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.15d0)) .or. (.not. (x <= 4.5d-21))) 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.15) || !(x <= 4.5e-21)) {
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.15) or not (x <= 4.5e-21): 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.15) || !(x <= 4.5e-21)) 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.15) || ~((x <= 4.5e-21))) 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.15], N[Not[LessEqual[x, 4.5e-21]], $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.15 \lor \neg \left(x \leq 4.5 \cdot 10^{-21}\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.1499999999999999 or 4.49999999999999968e-21 < 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 98.5%
if -1.1499999999999999 < x < 4.49999999999999968e-21Initial program 100.0%
Taylor expanded in t around inf 84.1%
Simplified84.1%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.5e-25) (not (<= x 5e-67))) (* x (+ t (* y 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.5e-25) || !(x <= 5e-67)) {
tmp = x * (t + (y * 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 <= (-5.5d-25)) .or. (.not. (x <= 5d-67))) then
tmp = x * (t + (y * 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 <= -5.5e-25) || !(x <= 5e-67)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.5e-25) or not (x <= 5e-67): tmp = x * (t + (y * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.5e-25) || !(x <= 5e-67)) tmp = Float64(x * Float64(t + Float64(y * 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 <= -5.5e-25) || ~((x <= 5e-67))) tmp = x * (t + (y * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.5e-25], N[Not[LessEqual[x, 5e-67]], $MachinePrecision]], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-25} \lor \neg \left(x \leq 5 \cdot 10^{-67}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.50000000000000004e-25 or 4.9999999999999999e-67 < 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.7%
Taylor expanded in z around 0 70.8%
if -5.50000000000000004e-25 < x < 4.9999999999999999e-67Initial program 100.0%
Taylor expanded in x around 0 65.6%
Simplified65.6%
Final simplification68.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.2e+68) (not (<= y 7e+57))) (* 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 <= -3.2e+68) || !(y <= 7e+57)) {
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 <= (-3.2d+68)) .or. (.not. (y <= 7d+57))) 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 <= -3.2e+68) || !(y <= 7e+57)) {
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 <= -3.2e+68) or not (y <= 7e+57): 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 <= -3.2e+68) || !(y <= 7e+57)) 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 <= -3.2e+68) || ~((y <= 7e+57))) 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, -3.2e+68], N[Not[LessEqual[y, 7e+57]], $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 -3.2 \cdot 10^{+68} \lor \neg \left(y \leq 7 \cdot 10^{+57}\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 < -3.19999999999999994e68 or 6.9999999999999995e57 < y Initial program 100.0%
Taylor expanded in y around inf 83.3%
Simplified83.3%
if -3.19999999999999994e68 < y < 6.9999999999999995e57Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+70.9%
associate-*r/63.7%
fma-neg65.3%
count-265.3%
+-commutative65.3%
associate-+l+65.3%
count-265.3%
+-commutative65.3%
associate-+l+65.3%
fma-neg63.7%
count-263.7%
+-commutative63.7%
associate-+l+63.7%
Applied egg-rr98.5%
Taylor expanded in y around 0 76.4%
+-commutative76.4%
*-commutative76.4%
associate-*r*76.4%
distribute-rgt-in77.8%
Simplified77.8%
Final simplification80.3%
(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 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e-25) (not (<= x 1.15e-64))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e-25) || !(x <= 1.15e-64)) {
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 <= (-6.8d-25)) .or. (.not. (x <= 1.15d-64))) 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 <= -6.8e-25) || !(x <= 1.15e-64)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e-25) or not (x <= 1.15e-64): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e-25) || !(x <= 1.15e-64)) 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 <= -6.8e-25) || ~((x <= 1.15e-64))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e-25], N[Not[LessEqual[x, 1.15e-64]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-25} \lor \neg \left(x \leq 1.15 \cdot 10^{-64}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -6.80000000000000003e-25 or 1.1500000000000001e-64 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+74.3%
associate-*r/63.6%
fma-neg69.0%
count-269.0%
+-commutative69.0%
associate-+l+69.0%
count-269.0%
+-commutative69.0%
associate-+l+69.0%
fma-neg63.6%
count-263.6%
+-commutative63.6%
associate-+l+63.6%
Applied egg-rr94.1%
Taylor expanded in t around inf 39.8%
*-commutative39.8%
Simplified39.8%
if -6.80000000000000003e-25 < x < 1.1500000000000001e-64Initial program 100.0%
Taylor expanded in x around 0 65.6%
Simplified65.6%
Final simplification50.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 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
flip-+62.1%
associate-*r/55.6%
fma-neg59.0%
count-259.0%
+-commutative59.0%
associate-+l+59.0%
count-259.0%
+-commutative59.0%
associate-+l+59.0%
fma-neg55.6%
count-255.6%
+-commutative55.6%
associate-+l+55.6%
Applied egg-rr96.4%
Taylor expanded in t around inf 32.3%
*-commutative32.3%
Simplified32.3%
Final simplification32.3%
herbie shell --seed 2024052
(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)))