
(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 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 99.9%
+-commutative99.9%
fma-define100.0%
flip-+55.4%
associate-*r/52.5%
fmm-def55.8%
associate-+l+55.8%
+-commutative55.8%
count-255.8%
associate-+l+55.8%
+-commutative55.8%
count-255.8%
fmm-def52.5%
associate-+l+52.5%
+-commutative52.5%
count-252.5%
Applied egg-rr100.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 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 (if (or (<= x -1.5e-10) (not (<= x 3.6e-47))) (* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x))))) (+ (* y 5.0) (+ (* x (* z 2.0)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-10) || !(x <= 3.6e-47)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + ((x * (z * 2.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.5d-10)) .or. (.not. (x <= 3.6d-47))) then
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
else
tmp = (y * 5.0d0) + ((x * (z * 2.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.5e-10) || !(x <= 3.6e-47)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.5e-10) or not (x <= 3.6e-47): tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.5e-10) || !(x <= 3.6e-47)) tmp = Float64(x * Float64(t + Float64(Float64(Float64(y + z) * 2.0) + Float64(5.0 * Float64(y / x))))); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(x * Float64(z * 2.0)) + Float64(x * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.5e-10) || ~((x <= 3.6e-47))) tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); else tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.5e-10], N[Not[LessEqual[x, 3.6e-47]], $MachinePrecision]], N[(x * N[(t + N[(N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision] + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-10} \lor \neg \left(x \leq 3.6 \cdot 10^{-47}\right):\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(x \cdot \left(z \cdot 2\right) + x \cdot t\right)\\
\end{array}
\end{array}
if x < -1.5e-10 or 3.59999999999999991e-47 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1.5e-10 < x < 3.59999999999999991e-47Initial program 99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.5e+14) (not (<= x 0.0029))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (+ (* x (* z 2.0)) (* x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.5e+14) || !(x <= 0.0029)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + ((x * (z * 2.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 <= (-8.5d+14)) .or. (.not. (x <= 0.0029d0))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + ((x * (z * 2.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 <= -8.5e+14) || !(x <= 0.0029)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.5e+14) or not (x <= 0.0029): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.5e+14) || !(x <= 0.0029)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(x * Float64(z * 2.0)) + Float64(x * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -8.5e+14) || ~((x <= 0.0029))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + ((x * (z * 2.0)) + (x * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.5e+14], N[Not[LessEqual[x, 0.0029]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{+14} \lor \neg \left(x \leq 0.0029\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(x \cdot \left(z \cdot 2\right) + x \cdot t\right)\\
\end{array}
\end{array}
if x < -8.5e14 or 0.0029 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.5%
if -8.5e14 < x < 0.0029Initial program 99.9%
distribute-lft-in99.9%
*-commutative99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 98.6%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.1e-20) (not (<= x 2.35e-29))) (* 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 <= -5.1e-20) || !(x <= 2.35e-29)) {
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 <= (-5.1d-20)) .or. (.not. (x <= 2.35d-29))) 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 <= -5.1e-20) || !(x <= 2.35e-29)) {
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 <= -5.1e-20) or not (x <= 2.35e-29): 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 <= -5.1e-20) || !(x <= 2.35e-29)) 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 <= -5.1e-20) || ~((x <= 2.35e-29))) 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, -5.1e-20], N[Not[LessEqual[x, 2.35e-29]], $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 -5.1 \cdot 10^{-20} \lor \neg \left(x \leq 2.35 \cdot 10^{-29}\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 < -5.10000000000000019e-20 or 2.3499999999999999e-29 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
if -5.10000000000000019e-20 < x < 2.3499999999999999e-29Initial program 99.9%
Taylor expanded in z around inf 84.8%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.000225) (not (<= x 3.9e-61))) (* 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 <= -0.000225) || !(x <= 3.9e-61)) {
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 <= (-0.000225d0)) .or. (.not. (x <= 3.9d-61))) 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 <= -0.000225) || !(x <= 3.9e-61)) {
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 <= -0.000225) or not (x <= 3.9e-61): 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 <= -0.000225) || !(x <= 3.9e-61)) 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 <= -0.000225) || ~((x <= 3.9e-61))) 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, -0.000225], N[Not[LessEqual[x, 3.9e-61]], $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 -0.000225 \lor \neg \left(x \leq 3.9 \cdot 10^{-61}\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 < -2.2499999999999999e-4 or 3.90000000000000033e-61 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.6%
if -2.2499999999999999e-4 < x < 3.90000000000000033e-61Initial program 99.9%
Taylor expanded in t around inf 77.4%
Final simplification88.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.9e+27) (not (<= y 2.4e+68))) (* 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 <= -1.9e+27) || !(y <= 2.4e+68)) {
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 <= (-1.9d+27)) .or. (.not. (y <= 2.4d+68))) 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 <= -1.9e+27) || !(y <= 2.4e+68)) {
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 <= -1.9e+27) or not (y <= 2.4e+68): 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 <= -1.9e+27) || !(y <= 2.4e+68)) 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 <= -1.9e+27) || ~((y <= 2.4e+68))) 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, -1.9e+27], N[Not[LessEqual[y, 2.4e+68]], $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 -1.9 \cdot 10^{+27} \lor \neg \left(y \leq 2.4 \cdot 10^{+68}\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 < -1.90000000000000011e27 or 2.40000000000000008e68 < y Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in y around inf 80.7%
if -1.90000000000000011e27 < y < 2.40000000000000008e68Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+63.6%
associate-*r/60.9%
fmm-def63.7%
associate-+l+63.7%
+-commutative63.7%
count-263.7%
associate-+l+63.7%
+-commutative63.7%
count-263.7%
fmm-def60.9%
associate-+l+60.9%
+-commutative60.9%
count-260.9%
Applied egg-rr100.0%
Taylor expanded in y around 0 82.4%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.75e-19) (not (<= x 6.2e-30))) (* x (+ t (* y 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.75e-19) || !(x <= 6.2e-30)) {
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 <= (-2.75d-19)) .or. (.not. (x <= 6.2d-30))) 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 <= -2.75e-19) || !(x <= 6.2e-30)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.75e-19) or not (x <= 6.2e-30): tmp = x * (t + (y * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.75e-19) || !(x <= 6.2e-30)) 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 <= -2.75e-19) || ~((x <= 6.2e-30))) 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, -2.75e-19], N[Not[LessEqual[x, 6.2e-30]], $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 -2.75 \cdot 10^{-19} \lor \neg \left(x \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.7499999999999998e-19 or 6.19999999999999982e-30 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
Taylor expanded in y around inf 72.6%
if -2.7499999999999998e-19 < x < 6.19999999999999982e-30Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+36.6%
associate-*r/36.6%
fmm-def36.8%
associate-+l+36.8%
+-commutative36.8%
count-236.8%
associate-+l+36.8%
+-commutative36.8%
count-236.8%
fmm-def36.6%
associate-+l+36.6%
+-commutative36.6%
count-236.6%
Applied egg-rr100.0%
Taylor expanded in x around 0 61.8%
*-commutative61.8%
Simplified61.8%
Final simplification68.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.7e+26) (* x (+ t (* y 2.0))) (if (<= y 6e+73) (* x (+ t (* z 2.0))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.7e+26) {
tmp = x * (t + (y * 2.0));
} else if (y <= 6e+73) {
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 (y <= (-1.7d+26)) then
tmp = x * (t + (y * 2.0d0))
else if (y <= 6d+73) 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 (y <= -1.7e+26) {
tmp = x * (t + (y * 2.0));
} else if (y <= 6e+73) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.7e+26: tmp = x * (t + (y * 2.0)) elif y <= 6e+73: tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.7e+26) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif (y <= 6e+73) 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 (y <= -1.7e+26) tmp = x * (t + (y * 2.0)); elseif (y <= 6e+73) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.7e+26], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+73], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+26}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -1.7000000000000001e26Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 64.8%
Taylor expanded in y around inf 56.9%
if -1.7000000000000001e26 < y < 6.00000000000000021e73Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+63.8%
associate-*r/61.2%
fmm-def64.0%
associate-+l+64.0%
+-commutative64.0%
count-264.0%
associate-+l+64.0%
+-commutative64.0%
count-264.0%
fmm-def61.2%
associate-+l+61.2%
+-commutative61.2%
count-261.2%
Applied egg-rr100.0%
Taylor expanded in y around 0 81.8%
if 6.00000000000000021e73 < y Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+33.3%
associate-*r/29.7%
fmm-def32.4%
associate-+l+32.4%
+-commutative32.4%
count-232.4%
associate-+l+32.4%
+-commutative32.4%
count-232.4%
fmm-def29.7%
associate-+l+29.7%
+-commutative29.7%
count-229.7%
Applied egg-rr100.0%
Taylor expanded in x around 0 56.6%
*-commutative56.6%
Simplified56.6%
Final simplification70.9%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * 5.0d0) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.55e-19) (not (<= x 5.5e-32))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e-19) || !(x <= 5.5e-32)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.55d-19)) .or. (.not. (x <= 5.5d-32))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e-19) || !(x <= 5.5e-32)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.55e-19) or not (x <= 5.5e-32): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.55e-19) || !(x <= 5.5e-32)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.55e-19) || ~((x <= 5.5e-32))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.55e-19], N[Not[LessEqual[x, 5.5e-32]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-19} \lor \neg \left(x \leq 5.5 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.5499999999999999e-19 or 5.50000000000000024e-32 < x Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+68.8%
associate-*r/63.7%
fmm-def69.3%
associate-+l+69.3%
+-commutative69.3%
count-269.3%
associate-+l+69.3%
+-commutative69.3%
count-269.3%
fmm-def63.7%
associate-+l+63.7%
+-commutative63.7%
count-263.7%
Applied egg-rr100.0%
Taylor expanded in t around inf 45.5%
*-commutative45.5%
Simplified45.5%
if -1.5499999999999999e-19 < x < 5.50000000000000024e-32Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+36.6%
associate-*r/36.6%
fmm-def36.8%
associate-+l+36.8%
+-commutative36.8%
count-236.8%
associate-+l+36.8%
+-commutative36.8%
count-236.8%
fmm-def36.6%
associate-+l+36.6%
+-commutative36.6%
count-236.6%
Applied egg-rr100.0%
Taylor expanded in x around 0 61.8%
*-commutative61.8%
Simplified61.8%
Final simplification52.2%
(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.9%
+-commutative99.9%
fma-define100.0%
flip-+55.4%
associate-*r/52.5%
fmm-def55.8%
associate-+l+55.8%
+-commutative55.8%
count-255.8%
associate-+l+55.8%
+-commutative55.8%
count-255.8%
fmm-def52.5%
associate-+l+52.5%
+-commutative52.5%
count-252.5%
Applied egg-rr100.0%
Taylor expanded in t around inf 33.5%
*-commutative33.5%
Simplified33.5%
herbie shell --seed 2024181
(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)))