
(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 99.5%
+-commutative99.5%
fma-define100.0%
flip-+56.7%
associate-*r/51.5%
fma-neg53.4%
associate-+l+53.4%
+-commutative53.4%
count-253.4%
associate-+l+53.4%
+-commutative53.4%
count-253.4%
fma-neg51.5%
associate-+l+51.6%
+-commutative51.6%
count-251.6%
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.5%
fma-define99.6%
associate-+l+99.6%
+-commutative99.6%
count-299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-14) (not (<= x 1.8e-32))) (* x (+ t (+ (* (+ y z) 2.0) (* 5.0 (/ y x))))) (+ (* y 5.0) (* x (+ t (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-14) || !(x <= 1.8e-32)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} 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.1d-14)) .or. (.not. (x <= 1.8d-32))) then
tmp = x * (t + (((y + z) * 2.0d0) + (5.0d0 * (y / x))))
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.1e-14) || !(x <= 1.8e-32)) {
tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x))));
} else {
tmp = (y * 5.0) + (x * (t + (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-14) or not (x <= 1.8e-32): tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))) else: tmp = (y * 5.0) + (x * (t + (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-14) || !(x <= 1.8e-32)) 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(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.1e-14) || ~((x <= 1.8e-32))) tmp = x * (t + (((y + z) * 2.0) + (5.0 * (y / x)))); 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.1e-14], N[Not[LessEqual[x, 1.8e-32]], $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[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-14} \lor \neg \left(x \leq 1.8 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \left(t + \left(\left(y + z\right) \cdot 2 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.0999999999999999e-14 or 1.79999999999999996e-32 < x Initial program 99.2%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 99.9%
if -2.0999999999999999e-14 < x < 1.79999999999999996e-32Initial program 99.9%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -58000000.0) (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 <= -58000000.0) || !(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 <= (-58000000.0d0)) .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 <= -58000000.0) || !(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 <= -58000000.0) 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 <= -58000000.0) || !(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 <= -58000000.0) || ~((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, -58000000.0], 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 -58000000 \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 < -5.8e7 or 2.5 < x Initial program 99.2%
fma-define99.2%
associate-+l+99.2%
+-commutative99.2%
count-299.2%
Simplified99.2%
Taylor expanded in x around inf 99.2%
if -5.8e7 < x < 2.5Initial program 99.9%
Taylor expanded in y around 0 99.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.75e-33) (not (<= x 5.5e-87))) (* 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 <= -2.75e-33) || !(x <= 5.5e-87)) {
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 <= (-2.75d-33)) .or. (.not. (x <= 5.5d-87))) 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 <= -2.75e-33) || !(x <= 5.5e-87)) {
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 <= -2.75e-33) or not (x <= 5.5e-87): 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 <= -2.75e-33) || !(x <= 5.5e-87)) 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 <= -2.75e-33) || ~((x <= 5.5e-87))) 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, -2.75e-33], N[Not[LessEqual[x, 5.5e-87]], $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 -2.75 \cdot 10^{-33} \lor \neg \left(x \leq 5.5 \cdot 10^{-87}\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.75e-33 or 5.5000000000000004e-87 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in x around inf 93.2%
if -2.75e-33 < x < 5.5000000000000004e-87Initial program 99.9%
Taylor expanded in t around inf 85.9%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -15000.0) (not (<= y 4.1e+60))) (* 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 <= -15000.0) || !(y <= 4.1e+60)) {
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 <= (-15000.0d0)) .or. (.not. (y <= 4.1d+60))) 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 <= -15000.0) || !(y <= 4.1e+60)) {
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 <= -15000.0) or not (y <= 4.1e+60): 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 <= -15000.0) || !(y <= 4.1e+60)) 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 <= -15000.0) || ~((y <= 4.1e+60))) 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, -15000.0], N[Not[LessEqual[y, 4.1e+60]], $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 -15000 \lor \neg \left(y \leq 4.1 \cdot 10^{+60}\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 < -15000 or 4.1e60 < y Initial program 99.1%
fma-define99.1%
associate-+l+99.1%
+-commutative99.1%
count-299.1%
Simplified99.1%
Taylor expanded in y around inf 79.2%
if -15000 < y < 4.1e60Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+66.8%
associate-*r/59.8%
fma-neg61.4%
associate-+l+61.4%
+-commutative61.4%
count-261.4%
associate-+l+61.4%
+-commutative61.4%
count-261.4%
fma-neg59.8%
associate-+l+59.8%
+-commutative59.8%
count-259.8%
Applied egg-rr100.0%
Taylor expanded in y around 0 80.1%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.55e-33) (not (<= x 2.4e-92))) (* x (+ t (* z 2.0))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e-33) || !(x <= 2.4e-92)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.55d-33)) .or. (.not. (x <= 2.4d-92))) then
tmp = x * (t + (z * 2.0d0))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e-33) || !(x <= 2.4e-92)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.55e-33) or not (x <= 2.4e-92): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.55e-33) || !(x <= 2.4e-92)) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.55e-33) || ~((x <= 2.4e-92))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.55e-33], N[Not[LessEqual[x, 2.4e-92]], $MachinePrecision]], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-33} \lor \neg \left(x \leq 2.4 \cdot 10^{-92}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.54999999999999998e-33 or 2.4000000000000001e-92 < x Initial program 99.3%
+-commutative99.3%
fma-define100.0%
flip-+67.3%
associate-*r/58.9%
fma-neg61.7%
associate-+l+61.7%
+-commutative61.7%
count-261.7%
associate-+l+61.7%
+-commutative61.7%
count-261.7%
fma-neg58.9%
associate-+l+58.9%
+-commutative58.9%
count-258.9%
Applied egg-rr100.0%
Taylor expanded in y around 0 72.7%
if -1.54999999999999998e-33 < x < 2.4000000000000001e-92Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+40.4%
associate-*r/40.3%
fma-neg40.7%
associate-+l+40.7%
+-commutative40.7%
count-240.7%
associate-+l+40.7%
+-commutative40.7%
count-240.7%
fma-neg40.3%
associate-+l+40.3%
+-commutative40.3%
count-240.3%
Applied egg-rr100.0%
Taylor expanded in x around 0 69.1%
*-commutative69.1%
Simplified69.1%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e-33) (not (<= x 5.8e-16))) (* 2.0 (* x (+ y z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-33) || !(x <= 5.8e-16)) {
tmp = 2.0 * (x * (y + z));
} 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.2d-33)) .or. (.not. (x <= 5.8d-16))) then
tmp = 2.0d0 * (x * (y + z))
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.2e-33) || !(x <= 5.8e-16)) {
tmp = 2.0 * (x * (y + z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e-33) or not (x <= 5.8e-16): tmp = 2.0 * (x * (y + z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e-33) || !(x <= 5.8e-16)) tmp = Float64(2.0 * Float64(x * Float64(y + z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e-33) || ~((x <= 5.8e-16))) tmp = 2.0 * (x * (y + z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e-33], N[Not[LessEqual[x, 5.8e-16]], $MachinePrecision]], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-33} \lor \neg \left(x \leq 5.8 \cdot 10^{-16}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.20000000000000005e-33 or 5.7999999999999996e-16 < x Initial program 99.2%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in t around 0 70.1%
Taylor expanded in x around inf 67.4%
if -2.20000000000000005e-33 < x < 5.7999999999999996e-16Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+41.4%
associate-*r/41.4%
fma-neg41.8%
associate-+l+41.8%
+-commutative41.8%
count-241.8%
associate-+l+41.8%
+-commutative41.8%
count-241.8%
fma-neg41.4%
associate-+l+41.4%
+-commutative41.4%
count-241.4%
Applied egg-rr100.0%
Taylor expanded in x around 0 65.0%
*-commutative65.0%
Simplified65.0%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.9e-30) (* x (+ t (* y 2.0))) (if (<= x 4.8e-16) (* y 5.0) (* 2.0 (* x (+ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e-30) {
tmp = x * (t + (y * 2.0));
} else if (x <= 4.8e-16) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * (y + 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 <= (-2.9d-30)) then
tmp = x * (t + (y * 2.0d0))
else if (x <= 4.8d-16) then
tmp = y * 5.0d0
else
tmp = 2.0d0 * (x * (y + z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e-30) {
tmp = x * (t + (y * 2.0));
} else if (x <= 4.8e-16) {
tmp = y * 5.0;
} else {
tmp = 2.0 * (x * (y + z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.9e-30: tmp = x * (t + (y * 2.0)) elif x <= 4.8e-16: tmp = y * 5.0 else: tmp = 2.0 * (x * (y + z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.9e-30) tmp = Float64(x * Float64(t + Float64(y * 2.0))); elseif (x <= 4.8e-16) tmp = Float64(y * 5.0); else tmp = Float64(2.0 * Float64(x * Float64(y + z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.9e-30) tmp = x * (t + (y * 2.0)); elseif (x <= 4.8e-16) tmp = y * 5.0; else tmp = 2.0 * (x * (y + z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.9e-30], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e-16], N[(y * 5.0), $MachinePrecision], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-30}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-16}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\end{array}
\end{array}
if x < -2.89999999999999989e-30Initial program 98.5%
fma-define98.5%
associate-+l+98.5%
+-commutative98.5%
count-298.5%
Simplified98.5%
Taylor expanded in x around inf 97.0%
Taylor expanded in y around inf 65.9%
if -2.89999999999999989e-30 < x < 4.8000000000000001e-16Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+41.1%
associate-*r/41.1%
fma-neg41.5%
associate-+l+41.5%
+-commutative41.5%
count-241.5%
associate-+l+41.5%
+-commutative41.5%
count-241.5%
fma-neg41.1%
associate-+l+41.1%
+-commutative41.1%
count-241.1%
Applied egg-rr100.0%
Taylor expanded in x around 0 64.5%
*-commutative64.5%
Simplified64.5%
if 4.8000000000000001e-16 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in t around 0 77.3%
Taylor expanded in x around inf 73.2%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.3e-28) (* x t) (if (<= x 1e-15) (* y 5.0) (* x (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.3e-28) {
tmp = x * t;
} else if (x <= 1e-15) {
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 <= (-1.3d-28)) then
tmp = x * t
else if (x <= 1d-15) 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 <= -1.3e-28) {
tmp = x * t;
} else if (x <= 1e-15) {
tmp = y * 5.0;
} else {
tmp = x * (z * 2.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.3e-28: tmp = x * t elif x <= 1e-15: tmp = y * 5.0 else: tmp = x * (z * 2.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.3e-28) tmp = Float64(x * t); elseif (x <= 1e-15) 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 <= -1.3e-28) tmp = x * t; elseif (x <= 1e-15) tmp = y * 5.0; else tmp = x * (z * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.3e-28], N[(x * t), $MachinePrecision], If[LessEqual[x, 1e-15], N[(y * 5.0), $MachinePrecision], N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-28}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 10^{-15}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 2\right)\\
\end{array}
\end{array}
if x < -1.3e-28Initial program 98.5%
+-commutative98.5%
fma-define100.0%
flip-+73.2%
associate-*r/66.2%
fma-neg70.8%
associate-+l+70.8%
+-commutative70.8%
count-270.8%
associate-+l+70.8%
+-commutative70.8%
count-270.8%
fma-neg66.2%
associate-+l+66.2%
+-commutative66.2%
count-266.2%
Applied egg-rr100.0%
Taylor expanded in t around inf 43.3%
*-commutative43.3%
Simplified43.3%
if -1.3e-28 < x < 1.0000000000000001e-15Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+41.1%
associate-*r/41.1%
fma-neg41.5%
associate-+l+41.5%
+-commutative41.5%
count-241.5%
associate-+l+41.5%
+-commutative41.5%
count-241.5%
fma-neg41.1%
associate-+l+41.1%
+-commutative41.1%
count-241.1%
Applied egg-rr100.0%
Taylor expanded in x around 0 64.5%
*-commutative64.5%
Simplified64.5%
if 1.0000000000000001e-15 < x Initial program 100.0%
+-commutative100.0%
fma-define100.0%
flip-+66.4%
associate-*r/54.7%
fma-neg56.3%
associate-+l+56.3%
+-commutative56.3%
count-256.3%
associate-+l+56.3%
+-commutative56.3%
count-256.3%
fma-neg54.7%
associate-+l+54.7%
+-commutative54.7%
count-254.7%
Applied egg-rr100.0%
Taylor expanded in z around inf 46.5%
associate-*r*46.5%
*-commutative46.5%
associate-*r*46.5%
Simplified46.5%
Final simplification53.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.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-25) (not (<= x 0.018))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-25) || !(x <= 0.018)) {
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 <= (-4.5d-25)) .or. (.not. (x <= 0.018d0))) 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 <= -4.5e-25) || !(x <= 0.018)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e-25) or not (x <= 0.018): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e-25) || !(x <= 0.018)) 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 <= -4.5e-25) || ~((x <= 0.018))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e-25], N[Not[LessEqual[x, 0.018]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-25} \lor \neg \left(x \leq 0.018\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -4.5000000000000001e-25 or 0.0179999999999999986 < x Initial program 99.2%
+-commutative99.2%
fma-define100.0%
flip-+71.8%
associate-*r/61.9%
fma-neg65.1%
associate-+l+65.1%
+-commutative65.1%
count-265.1%
associate-+l+65.1%
+-commutative65.1%
count-265.1%
fma-neg61.9%
associate-+l+61.9%
+-commutative61.9%
count-261.9%
Applied egg-rr100.0%
Taylor expanded in t around inf 38.5%
*-commutative38.5%
Simplified38.5%
if -4.5000000000000001e-25 < x < 0.0179999999999999986Initial program 99.9%
+-commutative99.9%
fma-define100.0%
flip-+40.6%
associate-*r/40.5%
fma-neg41.0%
associate-+l+41.0%
+-commutative41.0%
count-241.0%
associate-+l+41.0%
+-commutative41.0%
count-241.0%
fma-neg40.5%
associate-+l+40.5%
+-commutative40.5%
count-240.5%
Applied egg-rr100.0%
Taylor expanded in x around 0 62.1%
*-commutative62.1%
Simplified62.1%
Final simplification49.9%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-define100.0%
flip-+56.7%
associate-*r/51.5%
fma-neg53.4%
associate-+l+53.4%
+-commutative53.4%
count-253.4%
associate-+l+53.4%
+-commutative53.4%
count-253.4%
fma-neg51.5%
associate-+l+51.6%
+-commutative51.6%
count-251.6%
Applied egg-rr100.0%
Taylor expanded in t around inf 29.6%
*-commutative29.6%
Simplified29.6%
herbie shell --seed 2024141
(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)))