
(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 11 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 (+ (* 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(y + Float64(z + z)) + Float64(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[(y + N[(z + z), $MachinePrecision]), $MachinePrecision] + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(y + \left(z + z\right)\right) + \left(y + t\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
associate-+l+N/A
+-lowering-+.f64N/A
associate-+l+N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -2.4e+112)
(* x t)
(if (<= x -3.9e+30)
(* x (+ y y))
(if (<= x -2.65e-12)
(* x t)
(if (<= x 4e+16)
(* y 5.0)
(if (<= x 7.2e+208) (* x t) (* x (+ z z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e+112) {
tmp = x * t;
} else if (x <= -3.9e+30) {
tmp = x * (y + y);
} else if (x <= -2.65e-12) {
tmp = x * t;
} else if (x <= 4e+16) {
tmp = y * 5.0;
} else if (x <= 7.2e+208) {
tmp = x * t;
} else {
tmp = x * (z + 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.4d+112)) then
tmp = x * t
else if (x <= (-3.9d+30)) then
tmp = x * (y + y)
else if (x <= (-2.65d-12)) then
tmp = x * t
else if (x <= 4d+16) then
tmp = y * 5.0d0
else if (x <= 7.2d+208) then
tmp = x * t
else
tmp = x * (z + z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e+112) {
tmp = x * t;
} else if (x <= -3.9e+30) {
tmp = x * (y + y);
} else if (x <= -2.65e-12) {
tmp = x * t;
} else if (x <= 4e+16) {
tmp = y * 5.0;
} else if (x <= 7.2e+208) {
tmp = x * t;
} else {
tmp = x * (z + z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e+112: tmp = x * t elif x <= -3.9e+30: tmp = x * (y + y) elif x <= -2.65e-12: tmp = x * t elif x <= 4e+16: tmp = y * 5.0 elif x <= 7.2e+208: tmp = x * t else: tmp = x * (z + z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e+112) tmp = Float64(x * t); elseif (x <= -3.9e+30) tmp = Float64(x * Float64(y + y)); elseif (x <= -2.65e-12) tmp = Float64(x * t); elseif (x <= 4e+16) tmp = Float64(y * 5.0); elseif (x <= 7.2e+208) tmp = Float64(x * t); else tmp = Float64(x * Float64(z + z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.4e+112) tmp = x * t; elseif (x <= -3.9e+30) tmp = x * (y + y); elseif (x <= -2.65e-12) tmp = x * t; elseif (x <= 4e+16) tmp = y * 5.0; elseif (x <= 7.2e+208) tmp = x * t; else tmp = x * (z + z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e+112], N[(x * t), $MachinePrecision], If[LessEqual[x, -3.9e+30], N[(x * N[(y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.65e-12], N[(x * t), $MachinePrecision], If[LessEqual[x, 4e+16], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 7.2e+208], N[(x * t), $MachinePrecision], N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+112}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(y + y\right)\\
\mathbf{elif}\;x \leq -2.65 \cdot 10^{-12}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+16}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+208}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + z\right)\\
\end{array}
\end{array}
if x < -2.4e112 or -3.90000000000000011e30 < x < -2.64999999999999982e-12 or 4e16 < x < 7.20000000000000005e208Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6446.9
Simplified46.9%
if -2.4e112 < x < -3.90000000000000011e30Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64100.0
Simplified100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
count-2N/A
+-lowering-+.f6469.0
Simplified69.0%
if -2.64999999999999982e-12 < x < 4e16Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f6458.8
Simplified58.8%
if 7.20000000000000005e208 < x Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64100.0
Simplified100.0%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
count-2N/A
+-lowering-+.f6444.3
Simplified44.3%
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
count-2N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
count-2N/A
+-lowering-+.f6453.7
Applied egg-rr53.7%
Final simplification55.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ y y))))
(if (<= x -7e+112)
(* x t)
(if (<= x -1.45e+30)
t_1
(if (<= x -6.4e-12) (* x t) (if (<= x 2.5) (* y 5.0) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y + y);
double tmp;
if (x <= -7e+112) {
tmp = x * t;
} else if (x <= -1.45e+30) {
tmp = t_1;
} else if (x <= -6.4e-12) {
tmp = x * t;
} else if (x <= 2.5) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y + y)
if (x <= (-7d+112)) then
tmp = x * t
else if (x <= (-1.45d+30)) then
tmp = t_1
else if (x <= (-6.4d-12)) then
tmp = x * t
else if (x <= 2.5d0) then
tmp = y * 5.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y + y);
double tmp;
if (x <= -7e+112) {
tmp = x * t;
} else if (x <= -1.45e+30) {
tmp = t_1;
} else if (x <= -6.4e-12) {
tmp = x * t;
} else if (x <= 2.5) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y + y) tmp = 0 if x <= -7e+112: tmp = x * t elif x <= -1.45e+30: tmp = t_1 elif x <= -6.4e-12: tmp = x * t elif x <= 2.5: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y + y)) tmp = 0.0 if (x <= -7e+112) tmp = Float64(x * t); elseif (x <= -1.45e+30) tmp = t_1; elseif (x <= -6.4e-12) tmp = Float64(x * t); elseif (x <= 2.5) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y + y); tmp = 0.0; if (x <= -7e+112) tmp = x * t; elseif (x <= -1.45e+30) tmp = t_1; elseif (x <= -6.4e-12) tmp = x * t; elseif (x <= 2.5) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+112], N[(x * t), $MachinePrecision], If[LessEqual[x, -1.45e+30], t$95$1, If[LessEqual[x, -6.4e-12], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.5], N[(y * 5.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y + y\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+112}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -6.4 \cdot 10^{-12}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.99999999999999994e112 or -1.4499999999999999e30 < x < -6.4000000000000002e-12Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6448.0
Simplified48.0%
if -6.99999999999999994e112 < x < -1.4499999999999999e30 or 2.5 < x Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
count-2N/A
+-lowering-+.f6447.4
Simplified47.4%
if -6.4000000000000002e-12 < x < 2.5Initial program 99.8%
Taylor expanded in x around 0
*-lowering-*.f6459.5
Simplified59.5%
Final simplification54.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (fma x 2.0 5.0))))
(if (<= y -7.5e-45)
t_1
(if (<= y 5.5e-23)
(* x (fma 2.0 z t))
(if (<= y 3.05e+147) (fma x t (* y 5.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -7.5e-45) {
tmp = t_1;
} else if (y <= 5.5e-23) {
tmp = x * fma(2.0, z, t);
} else if (y <= 3.05e+147) {
tmp = fma(x, t, (y * 5.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -7.5e-45) tmp = t_1; elseif (y <= 5.5e-23) tmp = Float64(x * fma(2.0, z, t)); elseif (y <= 3.05e+147) tmp = fma(x, t, Float64(y * 5.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.5e-45], t$95$1, If[LessEqual[y, 5.5e-23], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.05e+147], N[(x * t + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-23}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{+147}:\\
\;\;\;\;\mathsf{fma}\left(x, t, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.5000000000000006e-45 or 3.05000000000000016e147 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-lowering-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
accelerator-lowering-fma.f6484.0
Simplified84.0%
if -7.5000000000000006e-45 < y < 5.5000000000000001e-23Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6485.8
Simplified85.8%
if 5.5000000000000001e-23 < y < 3.05000000000000016e147Initial program 99.9%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6485.3
Applied egg-rr85.3%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6476.8
Simplified76.8%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6476.8
Applied egg-rr76.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -5.4e+23)
(* x (fma 2.0 (+ y z) t))
(if (<= x 1.8e-5)
(fma y 5.0 (* x (+ (+ z z) t)))
(* x (fma z 2.0 (+ y (+ y t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.4e+23) {
tmp = x * fma(2.0, (y + z), t);
} else if (x <= 1.8e-5) {
tmp = fma(y, 5.0, (x * ((z + z) + t)));
} else {
tmp = x * fma(z, 2.0, (y + (y + t)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -5.4e+23) tmp = Float64(x * fma(2.0, Float64(y + z), t)); elseif (x <= 1.8e-5) tmp = fma(y, 5.0, Float64(x * Float64(Float64(z + z) + t))); else tmp = Float64(x * fma(z, 2.0, Float64(y + Float64(y + t)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.4e+23], N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-5], N[(y * 5.0 + N[(x * N[(N[(z + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(z * 2.0 + N[(y + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.4 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(\left(z + z\right) + t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, 2, y + \left(y + t\right)\right)\\
\end{array}
\end{array}
if x < -5.3999999999999997e23Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64100.0
Simplified100.0%
if -5.3999999999999997e23 < x < 1.80000000000000005e-5Initial program 99.9%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6499.0
Applied egg-rr99.0%
if 1.80000000000000005e-5 < x Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
+-commutativeN/A
distribute-lft-inN/A
count-2N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
associate-+r+N/A
count-2N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
(FPCore (x y z t) :precision binary64 (if (<= x -4.7e-15) (* x (fma 2.0 (+ y z) t)) (if (<= x 2.9e-8) (fma y 5.0 (* x t)) (* x (fma z 2.0 (+ y (+ y t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.7e-15) {
tmp = x * fma(2.0, (y + z), t);
} else if (x <= 2.9e-8) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = x * fma(z, 2.0, (y + (y + t)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -4.7e-15) tmp = Float64(x * fma(2.0, Float64(y + z), t)); elseif (x <= 2.9e-8) tmp = fma(y, 5.0, Float64(x * t)); else tmp = Float64(x * fma(z, 2.0, Float64(y + Float64(y + t)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.7e-15], N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.9e-8], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(z * 2.0 + N[(y + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, 2, y + \left(y + t\right)\right)\\
\end{array}
\end{array}
if x < -4.6999999999999999e-15Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6498.3
Simplified98.3%
if -4.6999999999999999e-15 < x < 2.9000000000000002e-8Initial program 99.8%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6499.4
Applied egg-rr99.4%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6482.0
Simplified82.0%
if 2.9000000000000002e-8 < x Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.9
Simplified99.9%
+-commutativeN/A
distribute-lft-inN/A
count-2N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
associate-+r+N/A
count-2N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6499.9
Applied egg-rr99.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -3e-11) t_1 (if (<= x 3e-8) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -3e-11) {
tmp = t_1;
} else if (x <= 3e-8) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -3e-11) tmp = t_1; elseif (x <= 3e-8) tmp = fma(y, 5.0, Float64(x * t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e-11], t$95$1, If[LessEqual[x, 3e-8], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3e-11 or 2.99999999999999973e-8 < x Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f6499.1
Simplified99.1%
if -3e-11 < x < 2.99999999999999973e-8Initial program 99.8%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
+-lowering-+.f6499.4
Applied egg-rr99.4%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f6482.0
Simplified82.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -8e-45) t_1 (if (<= y 6e-16) (* x (fma 2.0 z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -8e-45) {
tmp = t_1;
} else if (y <= 6e-16) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -8e-45) tmp = t_1; elseif (y <= 6e-16) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8e-45], t$95$1, If[LessEqual[y, 6e-16], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -8 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-16}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.99999999999999987e-45 or 5.99999999999999987e-16 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-lowering-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
accelerator-lowering-fma.f6479.9
Simplified79.9%
if -7.99999999999999987e-45 < y < 5.99999999999999987e-16Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6485.3
Simplified85.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.2e+33) (* y 5.0) (if (<= y 4.1e-15) (* x (fma 2.0 z t)) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.2e+33) {
tmp = y * 5.0;
} else if (y <= 4.1e-15) {
tmp = x * fma(2.0, z, t);
} else {
tmp = y * 5.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -1.2e+33) tmp = Float64(y * 5.0); elseif (y <= 4.1e-15) tmp = Float64(x * fma(2.0, z, t)); else tmp = Float64(y * 5.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.2e+33], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 4.1e-15], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+33}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -1.2e33 or 4.10000000000000036e-15 < y Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6454.0
Simplified54.0%
if -1.2e33 < y < 4.10000000000000036e-15Initial program 99.9%
Taylor expanded in y around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6479.4
Simplified79.4%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e+87) (* x t) (if (<= t 4.6e+76) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e+87) {
tmp = x * t;
} else if (t <= 4.6e+76) {
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 (t <= (-2.8d+87)) then
tmp = x * t
else if (t <= 4.6d+76) 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 (t <= -2.8e+87) {
tmp = x * t;
} else if (t <= 4.6e+76) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e+87: tmp = x * t elif t <= 4.6e+76: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e+87) tmp = Float64(x * t); elseif (t <= 4.6e+76) 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 (t <= -2.8e+87) tmp = x * t; elseif (t <= 4.6e+76) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e+87], N[(x * t), $MachinePrecision], If[LessEqual[t, 4.6e+76], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+87}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+76}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -2.80000000000000015e87 or 4.60000000000000002e76 < t Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
*-lowering-*.f6468.4
Simplified68.4%
if -2.80000000000000015e87 < t < 4.60000000000000002e76Initial program 99.9%
Taylor expanded in x around 0
*-lowering-*.f6439.8
Simplified39.8%
Final simplification49.6%
(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.9%
Taylor expanded in x around 0
*-lowering-*.f6434.1
Simplified34.1%
Final simplification34.1%
herbie shell --seed 2024199
(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)))