
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)))) (if (<= t_1 INFINITY) (+ t_1 c) (fma a (* b -0.25) (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + c;
} else {
tmp = fma(a, (b * -0.25), fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 + c); else tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + c), $MachinePrecision], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6466.7
Simplified66.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma x y (* (* a b) -0.25))) (t_2 (fma 0.0625 (* z t) c)))
(if (<= (* z t) -2e+122)
t_2
(if (<= (* z t) -2e-292)
t_1
(if (<= (* z t) 5e-217)
(fma (* b -0.25) a c)
(if (<= (* z t) 2e-36) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(x, y, ((a * b) * -0.25));
double t_2 = fma(0.0625, (z * t), c);
double tmp;
if ((z * t) <= -2e+122) {
tmp = t_2;
} else if ((z * t) <= -2e-292) {
tmp = t_1;
} else if ((z * t) <= 5e-217) {
tmp = fma((b * -0.25), a, c);
} else if ((z * t) <= 2e-36) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(x, y, Float64(Float64(a * b) * -0.25)) t_2 = fma(0.0625, Float64(z * t), c) tmp = 0.0 if (Float64(z * t) <= -2e+122) tmp = t_2; elseif (Float64(z * t) <= -2e-292) tmp = t_1; elseif (Float64(z * t) <= 5e-217) tmp = fma(Float64(b * -0.25), a, c); elseif (Float64(z * t) <= 2e-36) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(x * y + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+122], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -2e-292], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-217], N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-36], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right)\\
t_2 := \mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+122}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-292}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-217}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000003e122 or 1.9999999999999999e-36 < (*.f64 z t) Initial program 91.5%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6477.8
Simplified77.8%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.6
Simplified72.6%
if -2.00000000000000003e122 < (*.f64 z t) < -2.0000000000000001e-292 or 5.0000000000000002e-217 < (*.f64 z t) < 1.9999999999999999e-36Initial program 100.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6495.3
Simplified95.3%
Taylor expanded in c around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6478.0
Simplified78.0%
if -2.0000000000000001e-292 < (*.f64 z t) < 5.0000000000000002e-217Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6474.5
Simplified74.5%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6474.5
Applied egg-rr74.5%
Final simplification75.0%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -5e+125)
(fma y x c)
(if (<= (* x y) -5e-192)
(fma (* b -0.25) a c)
(if (<= (* x y) 4e+38) (fma 0.0625 (* z t) c) (fma y x c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -5e+125) {
tmp = fma(y, x, c);
} else if ((x * y) <= -5e-192) {
tmp = fma((b * -0.25), a, c);
} else if ((x * y) <= 4e+38) {
tmp = fma(0.0625, (z * t), c);
} else {
tmp = fma(y, x, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -5e+125) tmp = fma(y, x, c); elseif (Float64(x * y) <= -5e-192) tmp = fma(Float64(b * -0.25), a, c); elseif (Float64(x * y) <= 4e+38) tmp = fma(0.0625, Float64(z * t), c); else tmp = fma(y, x, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+125], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-192], N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+38], N[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision], N[(y * x + c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-192}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999962e125 or 3.99999999999999991e38 < (*.f64 x y) Initial program 92.2%
Taylor expanded in x around inf
*-lowering-*.f6476.6
Simplified76.6%
*-commutativeN/A
accelerator-lowering-fma.f6476.6
Applied egg-rr76.6%
if -4.99999999999999962e125 < (*.f64 x y) < -5.0000000000000001e-192Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6469.8
Simplified69.8%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.8
Applied egg-rr69.8%
if -5.0000000000000001e-192 < (*.f64 x y) < 3.99999999999999991e38Initial program 98.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6494.4
Simplified94.4%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6465.9
Simplified65.9%
Final simplification71.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) (fma x y c))))
(if (<= (* x y) -5e+125)
t_1
(if (<= (* x y) 4e+38) (fma 0.0625 (* z t) (fma a (* b -0.25) c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(a, (b * -0.25), fma(x, y, c));
double tmp;
if ((x * y) <= -5e+125) {
tmp = t_1;
} else if ((x * y) <= 4e+38) {
tmp = fma(0.0625, (z * t), fma(a, (b * -0.25), c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), fma(x, y, c)) tmp = 0.0 if (Float64(x * y) <= -5e+125) tmp = t_1; elseif (Float64(x * y) <= 4e+38) tmp = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+125], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+38], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999962e125 or 3.99999999999999991e38 < (*.f64 x y) Initial program 92.2%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6488.8
Simplified88.8%
if -4.99999999999999962e125 < (*.f64 x y) < 3.99999999999999991e38Initial program 99.4%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6492.7
Simplified92.7%
Final simplification91.1%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -5e+151)
(fma 0.0625 (* z t) (* (* a b) -0.25))
(if (<= (* z t) 5e+168)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* z t) c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -5e+151) {
tmp = fma(0.0625, (z * t), ((a * b) * -0.25));
} else if ((z * t) <= 5e+168) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (z * t), c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -5e+151) tmp = fma(0.0625, Float64(z * t), Float64(Float64(a * b) * -0.25)); elseif (Float64(z * t) <= 5e+168) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(z * t), c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+151], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+168], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \left(a \cdot b\right) \cdot -0.25\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000002e151Initial program 90.0%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6483.6
Simplified83.6%
Taylor expanded in a around inf
*-lowering-*.f64N/A
*-lowering-*.f6480.3
Simplified80.3%
if -5.0000000000000002e151 < (*.f64 z t) < 4.99999999999999967e168Initial program 100.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6492.8
Simplified92.8%
if 4.99999999999999967e168 < (*.f64 z t) Initial program 83.3%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6472.7
Simplified72.7%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6478.8
Simplified78.8%
Final simplification89.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) c)))
(if (<= (* z t) -2e+122)
t_1
(if (<= (* z t) 5e+168) (fma a (* b -0.25) (fma x y c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(0.0625, (z * t), c);
double tmp;
if ((z * t) <= -2e+122) {
tmp = t_1;
} else if ((z * t) <= 5e+168) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(z * t), c) tmp = 0.0 if (Float64(z * t) <= -2e+122) tmp = t_1; elseif (Float64(z * t) <= 5e+168) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+122], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+168], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000003e122 or 4.99999999999999967e168 < (*.f64 z t) Initial program 87.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6477.6
Simplified77.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6476.6
Simplified76.6%
if -2.00000000000000003e122 < (*.f64 z t) < 4.99999999999999967e168Initial program 100.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6493.7
Simplified93.7%
Final simplification89.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -4e+140) (fma y x c) (if (<= (* x y) 4e+38) (fma 0.0625 (* z t) c) (fma y x c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -4e+140) {
tmp = fma(y, x, c);
} else if ((x * y) <= 4e+38) {
tmp = fma(0.0625, (z * t), c);
} else {
tmp = fma(y, x, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -4e+140) tmp = fma(y, x, c); elseif (Float64(x * y) <= 4e+38) tmp = fma(0.0625, Float64(z * t), c); else tmp = fma(y, x, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+140], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+38], N[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision], N[(y * x + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.00000000000000024e140 or 3.99999999999999991e38 < (*.f64 x y) Initial program 92.9%
Taylor expanded in x around inf
*-lowering-*.f6477.4
Simplified77.4%
*-commutativeN/A
accelerator-lowering-fma.f6477.4
Applied egg-rr77.4%
if -4.00000000000000024e140 < (*.f64 x y) < 3.99999999999999991e38Initial program 98.7%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6491.6
Simplified91.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6463.9
Simplified63.9%
Final simplification69.1%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* a (* b -0.25)))) (if (<= (* a b) -5e+190) t_1 (if (<= (* a b) 4e+127) (fma y x c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if ((a * b) <= -5e+190) {
tmp = t_1;
} else if ((a * b) <= 4e+127) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (Float64(a * b) <= -5e+190) tmp = t_1; elseif (Float64(a * b) <= 4e+127) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+190], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 4e+127], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+127}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5.00000000000000036e190 or 3.99999999999999982e127 < (*.f64 a b) Initial program 88.5%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6474.0
Simplified74.0%
if -5.00000000000000036e190 < (*.f64 a b) < 3.99999999999999982e127Initial program 99.0%
Taylor expanded in x around inf
*-lowering-*.f6465.1
Simplified65.1%
*-commutativeN/A
accelerator-lowering-fma.f6465.1
Applied egg-rr65.1%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* (* z t) 0.0625))) (if (<= (* z t) -2e+123) t_1 (if (<= (* z t) 5e+168) (fma y x c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double tmp;
if ((z * t) <= -2e+123) {
tmp = t_1;
} else if ((z * t) <= 5e+168) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(z * t) <= -2e+123) tmp = t_1; elseif (Float64(z * t) <= 5e+168) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+123], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+168], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999996e123 or 4.99999999999999967e168 < (*.f64 z t) Initial program 86.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f6471.9
Simplified71.9%
if -1.99999999999999996e123 < (*.f64 z t) < 4.99999999999999967e168Initial program 100.0%
Taylor expanded in x around inf
*-lowering-*.f6465.1
Simplified65.1%
*-commutativeN/A
accelerator-lowering-fma.f6465.1
Applied egg-rr65.1%
Final simplification66.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -2.4e+157) (* x y) (if (<= (* x y) 70000000000000.0) c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -2.4e+157) {
tmp = x * y;
} else if ((x * y) <= 70000000000000.0) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((x * y) <= (-2.4d+157)) then
tmp = x * y
else if ((x * y) <= 70000000000000.0d0) then
tmp = c
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -2.4e+157) {
tmp = x * y;
} else if ((x * y) <= 70000000000000.0) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -2.4e+157: tmp = x * y elif (x * y) <= 70000000000000.0: tmp = c else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -2.4e+157) tmp = Float64(x * y); elseif (Float64(x * y) <= 70000000000000.0) tmp = c; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((x * y) <= -2.4e+157) tmp = x * y; elseif ((x * y) <= 70000000000000.0) tmp = c; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -2.4e+157], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 70000000000000.0], c, N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.4 \cdot 10^{+157}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 70000000000000:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -2.4e157 or 7e13 < (*.f64 x y) Initial program 93.1%
Taylor expanded in x around inf
*-lowering-*.f6468.4
Simplified68.4%
if -2.4e157 < (*.f64 x y) < 7e13Initial program 98.7%
Taylor expanded in c around inf
Simplified33.9%
(FPCore (x y z t a b c) :precision binary64 (fma y x c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(y, x, c);
}
function code(x, y, z, t, a, b, c) return fma(y, x, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, c\right)
\end{array}
Initial program 96.5%
Taylor expanded in x around inf
*-lowering-*.f6454.4
Simplified54.4%
*-commutativeN/A
accelerator-lowering-fma.f6454.4
Applied egg-rr54.4%
(FPCore (x y z t a b c) :precision binary64 c)
double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
def code(x, y, z, t, a, b, c): return c
function code(x, y, z, t, a, b, c) return c end
function tmp = code(x, y, z, t, a, b, c) tmp = c; end
code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}
\\
c
\end{array}
Initial program 96.5%
Taylor expanded in c around inf
Simplified23.9%
herbie shell --seed 2024198
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))