
(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 15 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-+63.0%
associate-*r/59.8%
fmm-def62.8%
associate-+l+62.8%
+-commutative62.8%
count-262.8%
associate-+l+62.8%
+-commutative62.8%
count-262.8%
fmm-def59.8%
associate-+l+59.8%
+-commutative59.8%
count-259.8%
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 -3.5e-16) (not (<= x 7e-16))) (* 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 <= -3.5e-16) || !(x <= 7e-16)) {
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 <= (-3.5d-16)) .or. (.not. (x <= 7d-16))) 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 <= -3.5e-16) || !(x <= 7e-16)) {
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 <= -3.5e-16) or not (x <= 7e-16): 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 <= -3.5e-16) || !(x <= 7e-16)) 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 <= -3.5e-16) || ~((x <= 7e-16))) 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, -3.5e-16], N[Not[LessEqual[x, 7e-16]], $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 -3.5 \cdot 10^{-16} \lor \neg \left(x \leq 7 \cdot 10^{-16}\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 < -3.50000000000000017e-16 or 7.00000000000000035e-16 < 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 100.0%
if -3.50000000000000017e-16 < x < 7.00000000000000035e-16Initial program 99.9%
Taylor expanded in y around 0 99.9%
distribute-rgt-in99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (not (<= x 2.5))) (* 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 <= -2.5) || !(x <= 2.5)) {
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 <= (-2.5d0)) .or. (.not. (x <= 2.5d0))) 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 <= -2.5) || !(x <= 2.5)) {
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 <= -2.5) or not (x <= 2.5): 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 <= -2.5) || !(x <= 2.5)) 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 <= -2.5) || ~((x <= 2.5))) 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, -2.5], 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[(N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 2.5\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 < -2.5 or 2.5 < 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.3%
if -2.5 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.4%
distribute-rgt-in99.5%
*-commutative99.5%
Applied egg-rr99.5%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.1e+261)
(* x (+ t (* y 2.0)))
(if (or (<= y -1.45e+53) (not (<= y 6e+39)))
(* y 5.0)
(* x (+ t (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e+261) {
tmp = x * (t + (y * 2.0));
} else if ((y <= -1.45e+53) || !(y <= 6e+39)) {
tmp = y * 5.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.1d+261)) then
tmp = x * (t + (y * 2.0d0))
else if ((y <= (-1.45d+53)) .or. (.not. (y <= 6d+39))) then
tmp = y * 5.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.1e+261) {
tmp = x * (t + (y * 2.0));
} else if ((y <= -1.45e+53) || !(y <= 6e+39)) {
tmp = y * 5.0;
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e+261: tmp = x * (t + (y * 2.0)) elif (y <= -1.45e+53) or not (y <= 6e+39): tmp = y * 5.0 else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e+261) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif ((y <= -1.45e+53) || !(y <= 6e+39)) tmp = Float64(y * 5.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.1e+261) tmp = x * (t + (y * 2.0)); elseif ((y <= -1.45e+53) || ~((y <= 6e+39))) tmp = y * 5.0; else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e+261], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.45e+53], N[Not[LessEqual[y, 6e+39]], $MachinePrecision]], N[(y * 5.0), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+261}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{+53} \lor \neg \left(y \leq 6 \cdot 10^{+39}\right):\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -1.09999999999999992e261Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 83.8%
Taylor expanded in z around 0 76.3%
if -1.09999999999999992e261 < y < -1.4500000000000001e53 or 5.9999999999999999e39 < y Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+46.2%
associate-*r/41.9%
fmm-def46.3%
associate-+l+46.3%
+-commutative46.3%
count-246.3%
associate-+l+46.3%
+-commutative46.3%
count-246.3%
fmm-def41.9%
associate-+l+41.9%
+-commutative41.9%
count-241.9%
Applied egg-rr100.0%
Taylor expanded in x around 0 58.4%
*-commutative58.4%
Simplified58.4%
if -1.4500000000000001e53 < y < 5.9999999999999999e39Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+75.7%
associate-*r/73.0%
fmm-def75.3%
associate-+l+75.3%
+-commutative75.3%
count-275.3%
associate-+l+75.3%
+-commutative75.3%
count-275.3%
fmm-def73.0%
associate-+l+73.0%
+-commutative73.0%
count-273.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 79.7%
Final simplification70.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (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 <= -2.5) || !(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 <= (-2.5d0)) .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 <= -2.5) || !(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 <= -2.5) 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 <= -2.5) || !(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 <= -2.5) || ~((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, -2.5], 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 -2.5 \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 < -2.5 or 2.5 < 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.3%
if -2.5 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -8.5e+136)
(* z (+ (* x 2.0) (* 5.0 (/ y z))))
(if (<= z 1.75e+53)
(+ (* y 5.0) (* x (+ t (* y 2.0))))
(+ (* y 5.0) (* 2.0 (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.5e+136) {
tmp = z * ((x * 2.0) + (5.0 * (y / z)));
} else if (z <= 1.75e+53) {
tmp = (y * 5.0) + (x * (t + (y * 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 (z <= (-8.5d+136)) then
tmp = z * ((x * 2.0d0) + (5.0d0 * (y / z)))
else if (z <= 1.75d+53) then
tmp = (y * 5.0d0) + (x * (t + (y * 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 (z <= -8.5e+136) {
tmp = z * ((x * 2.0) + (5.0 * (y / z)));
} else if (z <= 1.75e+53) {
tmp = (y * 5.0) + (x * (t + (y * 2.0)));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.5e+136: tmp = z * ((x * 2.0) + (5.0 * (y / z))) elif z <= 1.75e+53: tmp = (y * 5.0) + (x * (t + (y * 2.0))) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.5e+136) tmp = Float64(z * Float64(Float64(x * 2.0) + Float64(5.0 * Float64(y / z)))); elseif (z <= 1.75e+53) tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y * 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 (z <= -8.5e+136) tmp = z * ((x * 2.0) + (5.0 * (y / z))); elseif (z <= 1.75e+53) tmp = (y * 5.0) + (x * (t + (y * 2.0))); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.5e+136], N[(z * N[(N[(x * 2.0), $MachinePrecision] + N[(5.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.75e+53], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $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}\;z \leq -8.5 \cdot 10^{+136}:\\
\;\;\;\;z \cdot \left(x \cdot 2 + 5 \cdot \frac{y}{z}\right)\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{+53}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -8.49999999999999966e136Initial program 99.9%
Taylor expanded in z around inf 93.5%
Taylor expanded in z around inf 93.6%
if -8.49999999999999966e136 < z < 1.75000000000000009e53Initial program 99.9%
Taylor expanded in y around inf 93.6%
if 1.75000000000000009e53 < z Initial program 99.9%
Taylor expanded in z around inf 86.1%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1e-16) (not (<= x 8.5e-24))) (* 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 <= -1e-16) || !(x <= 8.5e-24)) {
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 <= (-1d-16)) .or. (.not. (x <= 8.5d-24))) 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 <= -1e-16) || !(x <= 8.5e-24)) {
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 <= -1e-16) or not (x <= 8.5e-24): 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 <= -1e-16) || !(x <= 8.5e-24)) 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 <= -1e-16) || ~((x <= 8.5e-24))) 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, -1e-16], N[Not[LessEqual[x, 8.5e-24]], $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 -1 \cdot 10^{-16} \lor \neg \left(x \leq 8.5 \cdot 10^{-24}\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 < -9.9999999999999998e-17 or 8.5000000000000002e-24 < 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 -9.9999999999999998e-17 < x < 8.5000000000000002e-24Initial program 99.9%
Taylor expanded in z around inf 83.1%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.8e-18) (not (<= x 0.000108))) (* 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.8e-18) || !(x <= 0.000108)) {
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.8d-18)) .or. (.not. (x <= 0.000108d0))) 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.8e-18) || !(x <= 0.000108)) {
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.8e-18) or not (x <= 0.000108): 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.8e-18) || !(x <= 0.000108)) 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.8e-18) || ~((x <= 0.000108))) 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.8e-18], N[Not[LessEqual[x, 0.000108]], $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.8 \cdot 10^{-18} \lor \neg \left(x \leq 0.000108\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.80000000000000005e-18 or 1.08e-4 < 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.3%
if -1.80000000000000005e-18 < x < 1.08e-4Initial program 99.9%
Taylor expanded in t around inf 80.7%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1e+53) (not (<= y 3.1e+38))) (* 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 <= -1e+53) || !(y <= 3.1e+38)) {
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 <= (-1d+53)) .or. (.not. (y <= 3.1d+38))) 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 <= -1e+53) || !(y <= 3.1e+38)) {
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 <= -1e+53) or not (y <= 3.1e+38): 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 <= -1e+53) || !(y <= 3.1e+38)) 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 <= -1e+53) || ~((y <= 3.1e+38))) 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, -1e+53], N[Not[LessEqual[y, 3.1e+38]], $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 \cdot 10^{+53} \lor \neg \left(y \leq 3.1 \cdot 10^{+38}\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 < -9.9999999999999999e52 or 3.10000000000000018e38 < 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 86.8%
if -9.9999999999999999e52 < y < 3.10000000000000018e38Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+75.7%
associate-*r/73.0%
fmm-def75.3%
associate-+l+75.3%
+-commutative75.3%
count-275.3%
associate-+l+75.3%
+-commutative75.3%
count-275.3%
fmm-def73.0%
associate-+l+73.0%
+-commutative73.0%
count-273.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 79.7%
Final simplification82.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e-19) (not (<= x 2.5e-19))) (* x (+ t (* y 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e-19) || !(x <= 2.5e-19)) {
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 <= (-5d-19)) .or. (.not. (x <= 2.5d-19))) 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 <= -5e-19) || !(x <= 2.5e-19)) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e-19) or not (x <= 2.5e-19): tmp = x * (t + (y * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e-19) || !(x <= 2.5e-19)) 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 <= -5e-19) || ~((x <= 2.5e-19))) 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, -5e-19], N[Not[LessEqual[x, 2.5e-19]], $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 \cdot 10^{-19} \lor \neg \left(x \leq 2.5 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.0000000000000004e-19 or 2.5000000000000002e-19 < 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%
Taylor expanded in z around 0 71.6%
if -5.0000000000000004e-19 < x < 2.5000000000000002e-19Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+49.9%
associate-*r/49.8%
fmm-def50.2%
associate-+l+50.2%
+-commutative50.2%
count-250.2%
associate-+l+50.2%
+-commutative50.2%
count-250.2%
fmm-def49.8%
associate-+l+49.8%
+-commutative49.8%
count-249.8%
Applied egg-rr100.0%
Taylor expanded in x around 0 64.1%
*-commutative64.1%
Simplified64.1%
Final simplification67.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.5e-19) (* x t) (if (<= x 0.00076) (* y 5.0) (* x (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.5e-19) {
tmp = x * t;
} else if (x <= 0.00076) {
tmp = y * 5.0;
} else {
tmp = x * (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 <= (-2.5d-19)) then
tmp = x * t
else if (x <= 0.00076d0) then
tmp = y * 5.0d0
else
tmp = x * (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 <= -2.5e-19) {
tmp = x * t;
} else if (x <= 0.00076) {
tmp = y * 5.0;
} else {
tmp = x * (z * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.5e-19: tmp = x * t elif x <= 0.00076: tmp = y * 5.0 else: tmp = x * (z * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.5e-19) tmp = Float64(x * t); elseif (x <= 0.00076) tmp = Float64(y * 5.0); else tmp = Float64(x * Float64(z * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.5e-19) tmp = x * t; elseif (x <= 0.00076) tmp = y * 5.0; else tmp = x * (z * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.5e-19], N[(x * t), $MachinePrecision], If[LessEqual[x, 0.00076], N[(y * 5.0), $MachinePrecision], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 0.00076:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.5000000000000002e-19Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+80.0%
associate-*r/72.2%
fmm-def79.2%
associate-+l+79.2%
+-commutative79.2%
count-279.2%
associate-+l+79.2%
+-commutative79.2%
count-279.2%
fmm-def72.2%
associate-+l+72.2%
+-commutative72.2%
count-272.2%
Applied egg-rr100.0%
Taylor expanded in t around inf 48.8%
*-commutative48.8%
Simplified48.8%
if -2.5000000000000002e-19 < x < 7.6000000000000004e-4Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+48.1%
associate-*r/48.0%
fmm-def48.4%
associate-+l+48.4%
+-commutative48.4%
count-248.4%
associate-+l+48.4%
+-commutative48.4%
count-248.4%
fmm-def48.0%
associate-+l+48.0%
+-commutative48.0%
count-248.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 63.2%
*-commutative63.2%
Simplified63.2%
if 7.6000000000000004e-4 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+79.8%
associate-*r/74.0%
fmm-def78.9%
associate-+l+78.9%
+-commutative78.9%
count-278.9%
associate-+l+78.9%
+-commutative78.9%
count-278.9%
fmm-def74.0%
associate-+l+74.0%
+-commutative74.0%
count-274.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 44.4%
*-commutative44.4%
associate-*r*44.4%
*-commutative44.4%
Simplified44.4%
Final simplification55.4%
(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 -2.6e-19) (not (<= x 1.4e+17))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e-19) || !(x <= 1.4e+17)) {
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 <= (-2.6d-19)) .or. (.not. (x <= 1.4d+17))) 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 <= -2.6e-19) || !(x <= 1.4e+17)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.6e-19) or not (x <= 1.4e+17): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.6e-19) || !(x <= 1.4e+17)) 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 <= -2.6e-19) || ~((x <= 1.4e+17))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.6e-19], N[Not[LessEqual[x, 1.4e+17]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-19} \lor \neg \left(x \leq 1.4 \cdot 10^{+17}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.60000000000000013e-19 or 1.4e17 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+80.8%
associate-*r/73.9%
fmm-def80.0%
associate-+l+80.0%
+-commutative80.0%
count-280.0%
associate-+l+80.0%
+-commutative80.0%
count-280.0%
fmm-def73.9%
associate-+l+73.9%
+-commutative73.9%
count-273.9%
Applied egg-rr100.0%
Taylor expanded in t around inf 41.6%
*-commutative41.6%
Simplified41.6%
if -2.60000000000000013e-19 < x < 1.4e17Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+48.2%
associate-*r/48.1%
fmm-def48.5%
associate-+l+48.5%
+-commutative48.5%
count-248.5%
associate-+l+48.5%
+-commutative48.5%
count-248.5%
fmm-def48.1%
associate-+l+48.1%
+-commutative48.1%
count-248.1%
Applied egg-rr100.0%
Taylor expanded in x around 0 61.6%
*-commutative61.6%
Simplified61.6%
Final simplification52.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.9%
+-commutative99.9%
fma-define100.0%
flip-+63.0%
associate-*r/59.8%
fmm-def62.8%
associate-+l+62.8%
+-commutative62.8%
count-262.8%
associate-+l+62.8%
+-commutative62.8%
count-262.8%
fmm-def59.8%
associate-+l+59.8%
+-commutative59.8%
count-259.8%
Applied egg-rr100.0%
Taylor expanded in t around inf 29.4%
*-commutative29.4%
Simplified29.4%
herbie shell --seed 2024163
(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)))