
(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 14 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%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
*-commutative100.0%
fma-define100.0%
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 99.5%
fma-define99.5%
associate-+l+99.5%
+-commutative99.5%
count-299.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (* z 2.0)))) (t_2 (* y (+ 5.0 (* x 2.0)))))
(if (<= y -6.8e+80)
t_2
(if (<= y -1.2e+47)
t_1
(if (<= y -420000000000.0)
(+ (* y 5.0) (* x t))
(if (<= y 1.05e+97) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (z * 2.0));
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -6.8e+80) {
tmp = t_2;
} else if (y <= -1.2e+47) {
tmp = t_1;
} else if (y <= -420000000000.0) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.05e+97) {
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 = x * (t + (z * 2.0d0))
t_2 = y * (5.0d0 + (x * 2.0d0))
if (y <= (-6.8d+80)) then
tmp = t_2
else if (y <= (-1.2d+47)) then
tmp = t_1
else if (y <= (-420000000000.0d0)) then
tmp = (y * 5.0d0) + (x * t)
else if (y <= 1.05d+97) 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 = x * (t + (z * 2.0));
double t_2 = y * (5.0 + (x * 2.0));
double tmp;
if (y <= -6.8e+80) {
tmp = t_2;
} else if (y <= -1.2e+47) {
tmp = t_1;
} else if (y <= -420000000000.0) {
tmp = (y * 5.0) + (x * t);
} else if (y <= 1.05e+97) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (z * 2.0)) t_2 = y * (5.0 + (x * 2.0)) tmp = 0 if y <= -6.8e+80: tmp = t_2 elif y <= -1.2e+47: tmp = t_1 elif y <= -420000000000.0: tmp = (y * 5.0) + (x * t) elif y <= 1.05e+97: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(z * 2.0))) t_2 = Float64(y * Float64(5.0 + Float64(x * 2.0))) tmp = 0.0 if (y <= -6.8e+80) tmp = t_2; elseif (y <= -1.2e+47) tmp = t_1; elseif (y <= -420000000000.0) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (y <= 1.05e+97) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (z * 2.0)); t_2 = y * (5.0 + (x * 2.0)); tmp = 0.0; if (y <= -6.8e+80) tmp = t_2; elseif (y <= -1.2e+47) tmp = t_1; elseif (y <= -420000000000.0) tmp = (y * 5.0) + (x * t); elseif (y <= 1.05e+97) tmp = t_1; else tmp = t_2; 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]}, Block[{t$95$2 = N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e+80], t$95$2, If[LessEqual[y, -1.2e+47], t$95$1, If[LessEqual[y, -420000000000.0], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+97], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + z \cdot 2\right)\\
t_2 := y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -420000000000:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -6.79999999999999984e80 or 1.05000000000000006e97 < y Initial program 98.9%
Taylor expanded in y around inf 83.3%
if -6.79999999999999984e80 < y < -1.20000000000000009e47 or -4.2e11 < y < 1.05000000000000006e97Initial program 100.0%
Taylor expanded in y around 0 79.4%
if -1.20000000000000009e47 < y < -4.2e11Initial program 99.4%
fma-define99.4%
associate-+l+99.4%
associate-+l+99.4%
Simplified99.4%
Taylor expanded in z around 0 92.4%
Simplified80.0%
fma-undefine80.0%
+-commutative80.0%
Applied egg-rr80.0%
Final simplification81.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (* x z))))
(if (<= x -7.5e+177)
t_1
(if (<= x -3.7e+82)
(* 2.0 (* y x))
(if (<= x -5.8e-30) t_1 (if (<= x 1.7e-54) (* y 5.0) (* x t)))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -7.5e+177) {
tmp = t_1;
} else if (x <= -3.7e+82) {
tmp = 2.0 * (y * x);
} else if (x <= -5.8e-30) {
tmp = t_1;
} else if (x <= 1.7e-54) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 2.0d0 * (x * z)
if (x <= (-7.5d+177)) then
tmp = t_1
else if (x <= (-3.7d+82)) then
tmp = 2.0d0 * (y * x)
else if (x <= (-5.8d-30)) then
tmp = t_1
else if (x <= 1.7d-54) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (x * z);
double tmp;
if (x <= -7.5e+177) {
tmp = t_1;
} else if (x <= -3.7e+82) {
tmp = 2.0 * (y * x);
} else if (x <= -5.8e-30) {
tmp = t_1;
} else if (x <= 1.7e-54) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (x * z) tmp = 0 if x <= -7.5e+177: tmp = t_1 elif x <= -3.7e+82: tmp = 2.0 * (y * x) elif x <= -5.8e-30: tmp = t_1 elif x <= 1.7e-54: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(x * z)) tmp = 0.0 if (x <= -7.5e+177) tmp = t_1; elseif (x <= -3.7e+82) tmp = Float64(2.0 * Float64(y * x)); elseif (x <= -5.8e-30) tmp = t_1; elseif (x <= 1.7e-54) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (x * z); tmp = 0.0; if (x <= -7.5e+177) tmp = t_1; elseif (x <= -3.7e+82) tmp = 2.0 * (y * x); elseif (x <= -5.8e-30) tmp = t_1; elseif (x <= 1.7e-54) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e+177], t$95$1, If[LessEqual[x, -3.7e+82], N[(2.0 * N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.8e-30], t$95$1, If[LessEqual[x, 1.7e-54], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{+177}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{+82}:\\
\;\;\;\;2 \cdot \left(y \cdot x\right)\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-54}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -7.50000000000000039e177 or -3.7000000000000002e82 < x < -5.79999999999999978e-30Initial program 98.4%
Taylor expanded in z around 0 90.9%
Simplified53.3%
if -7.50000000000000039e177 < x < -3.7000000000000002e82Initial program 100.0%
Taylor expanded in y around 0 83.2%
Simplified67.3%
if -5.79999999999999978e-30 < x < 1.69999999999999994e-54Initial program 99.8%
Taylor expanded in x around 0 64.0%
if 1.69999999999999994e-54 < x Initial program 99.9%
Taylor expanded in t around inf 42.8%
Final simplification56.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -8e+82)
(* 2.0 (* x (+ y z)))
(if (or (<= x -1.35e-68) (not (<= x 1.6e-98)))
(* x (+ t (* z 2.0)))
(* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8e+82) {
tmp = 2.0 * (x * (y + z));
} else if ((x <= -1.35e-68) || !(x <= 1.6e-98)) {
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 <= (-8d+82)) then
tmp = 2.0d0 * (x * (y + z))
else if ((x <= (-1.35d-68)) .or. (.not. (x <= 1.6d-98))) 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 <= -8e+82) {
tmp = 2.0 * (x * (y + z));
} else if ((x <= -1.35e-68) || !(x <= 1.6e-98)) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8e+82: tmp = 2.0 * (x * (y + z)) elif (x <= -1.35e-68) or not (x <= 1.6e-98): tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8e+82) tmp = Float64(2.0 * Float64(x * Float64(y + z))); elseif ((x <= -1.35e-68) || !(x <= 1.6e-98)) 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 <= -8e+82) tmp = 2.0 * (x * (y + z)); elseif ((x <= -1.35e-68) || ~((x <= 1.6e-98))) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8e+82], N[(2.0 * N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.35e-68], N[Not[LessEqual[x, 1.6e-98]], $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 -8 \cdot 10^{+82}:\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-68} \lor \neg \left(x \leq 1.6 \cdot 10^{-98}\right):\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.9999999999999997e82Initial program 98.0%
fma-define98.0%
associate-+l+98.0%
+-commutative98.0%
count-298.0%
Simplified98.0%
Taylor expanded in t around 0 78.7%
Simplified80.6%
if -7.9999999999999997e82 < x < -1.3500000000000001e-68 or 1.6e-98 < x Initial program 99.9%
Taylor expanded in y around 0 70.8%
if -1.3500000000000001e-68 < x < 1.6e-98Initial program 99.8%
Taylor expanded in x around 0 66.6%
Final simplification71.3%
(FPCore (x y z t) :precision binary64 (if (<= x -5e+104) (* x (+ t (* (+ y z) 2.0))) (+ (* x (+ t (* z 2.0))) (* y (+ 5.0 (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+104) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 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 <= (-5d+104)) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (x * (t + (z * 2.0d0))) + (y * (5.0d0 + (x * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+104) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5e+104: tmp = x * (t + ((y + z) * 2.0)) else: tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5e+104) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(x * Float64(t + Float64(z * 2.0))) + Float64(y * Float64(5.0 + Float64(x * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5e+104) tmp = x * (t + ((y + z) * 2.0)); else tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5e+104], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+104}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -4.9999999999999997e104Initial program 97.9%
fma-define97.9%
associate-+l+97.9%
+-commutative97.9%
count-297.9%
Simplified97.9%
Taylor expanded in x around inf 100.0%
if -4.9999999999999997e104 < x Initial program 99.9%
Taylor expanded in y around 0 98.5%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.02e-28) (not (<= x 7e-78))) (* 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.02e-28) || !(x <= 7e-78)) {
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.02d-28)) .or. (.not. (x <= 7d-78))) 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.02e-28) || !(x <= 7e-78)) {
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.02e-28) or not (x <= 7e-78): 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.02e-28) || !(x <= 7e-78)) 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.02e-28) || ~((x <= 7e-78))) 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.02e-28], N[Not[LessEqual[x, 7e-78]], $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.02 \cdot 10^{-28} \lor \neg \left(x \leq 7 \cdot 10^{-78}\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.01999999999999997e-28 or 6.9999999999999999e-78 < 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.8%
if -1.01999999999999997e-28 < x < 6.9999999999999999e-78Initial program 99.8%
fma-define99.8%
associate-+l+99.8%
associate-+l+99.8%
Simplified99.8%
Taylor expanded in z around 0 84.4%
Simplified84.4%
fma-undefine84.4%
+-commutative84.4%
Applied egg-rr84.4%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.75e-31) (not (<= x 3.7e-75))) (* 2.0 (* x (+ y z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e-31) || !(x <= 3.7e-75)) {
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 <= (-1.75d-31)) .or. (.not. (x <= 3.7d-75))) 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 <= -1.75e-31) || !(x <= 3.7e-75)) {
tmp = 2.0 * (x * (y + z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.75e-31) or not (x <= 3.7e-75): tmp = 2.0 * (x * (y + z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.75e-31) || !(x <= 3.7e-75)) 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 <= -1.75e-31) || ~((x <= 3.7e-75))) 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, -1.75e-31], N[Not[LessEqual[x, 3.7e-75]], $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 -1.75 \cdot 10^{-31} \lor \neg \left(x \leq 3.7 \cdot 10^{-75}\right):\\
\;\;\;\;2 \cdot \left(x \cdot \left(y + z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.74999999999999993e-31 or 3.70000000000000024e-75 < x Initial program 99.3%
fma-define99.3%
associate-+l+99.3%
+-commutative99.3%
count-299.3%
Simplified99.3%
Taylor expanded in t around 0 72.0%
Simplified66.8%
if -1.74999999999999993e-31 < x < 3.70000000000000024e-75Initial program 99.8%
Taylor expanded in x around 0 64.8%
Final simplification66.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.5e+78) (not (<= y 1e+97))) (* 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 <= -8.5e+78) || !(y <= 1e+97)) {
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 <= (-8.5d+78)) .or. (.not. (y <= 1d+97))) 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 <= -8.5e+78) || !(y <= 1e+97)) {
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 <= -8.5e+78) or not (y <= 1e+97): 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 <= -8.5e+78) || !(y <= 1e+97)) 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 <= -8.5e+78) || ~((y <= 1e+97))) 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, -8.5e+78], N[Not[LessEqual[y, 1e+97]], $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 -8.5 \cdot 10^{+78} \lor \neg \left(y \leq 10^{+97}\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 < -8.50000000000000079e78 or 1.0000000000000001e97 < y Initial program 98.9%
Taylor expanded in y around inf 83.3%
if -8.50000000000000079e78 < y < 1.0000000000000001e97Initial program 99.9%
Taylor expanded in y around 0 76.7%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (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 * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e-30) (not (<= x 1.5e-54))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e-30) || !(x <= 1.5e-54)) {
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 <= (-7.2d-30)) .or. (.not. (x <= 1.5d-54))) 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 <= -7.2e-30) || !(x <= 1.5e-54)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e-30) or not (x <= 1.5e-54): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e-30) || !(x <= 1.5e-54)) 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 <= -7.2e-30) || ~((x <= 1.5e-54))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e-30], N[Not[LessEqual[x, 1.5e-54]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-30} \lor \neg \left(x \leq 1.5 \cdot 10^{-54}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -7.2000000000000006e-30 or 1.50000000000000005e-54 < x Initial program 99.3%
Taylor expanded in t around inf 37.5%
if -7.2000000000000006e-30 < x < 1.50000000000000005e-54Initial program 99.8%
Taylor expanded in x around 0 64.0%
Final simplification48.7%
(FPCore (x y z t) :precision binary64 (if (<= x -6.2e-29) (* 2.0 (* x z)) (if (<= x 2.2e-53) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e-29) {
tmp = 2.0 * (x * z);
} else if (x <= 2.2e-53) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-6.2d-29)) then
tmp = 2.0d0 * (x * z)
else if (x <= 2.2d-53) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e-29) {
tmp = 2.0 * (x * z);
} else if (x <= 2.2e-53) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e-29: tmp = 2.0 * (x * z) elif x <= 2.2e-53: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e-29) tmp = Float64(2.0 * Float64(x * z)); elseif (x <= 2.2e-53) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.2e-29) tmp = 2.0 * (x * z); elseif (x <= 2.2e-53) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e-29], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e-53], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-29}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-53}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -6.20000000000000052e-29Initial program 98.8%
Taylor expanded in z around 0 90.4%
Simplified47.1%
if -6.20000000000000052e-29 < x < 2.20000000000000018e-53Initial program 99.8%
Taylor expanded in x around 0 64.0%
if 2.20000000000000018e-53 < x Initial program 99.9%
Taylor expanded in t around inf 42.8%
Final simplification53.2%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return 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 = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 30.1%
Final simplification30.1%
(FPCore (x y z t) :precision binary64 -1.0)
double code(double x, double y, double z, double t) {
return -1.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 = -1.0d0
end function
public static double code(double x, double y, double z, double t) {
return -1.0;
}
def code(x, y, z, t): return -1.0
function code(x, y, z, t) return -1.0 end
function tmp = code(x, y, z, t) tmp = -1.0; end
code[x_, y_, z_, t_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 99.5%
Taylor expanded in x around 0 30.1%
Simplified2.9%
Final simplification2.9%
herbie shell --seed 2024046
(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)))