
(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 14 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 (if (<= (- (+ (* y x) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY) (fma a (* b -0.25) (fma 0.0625 (* z t) (fma x y c))) (fma y x (* b (* a -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((((y * x) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
tmp = fma(a, (b * -0.25), fma(0.0625, (z * t), fma(x, y, c)));
} else {
tmp = fma(y, x, (b * (a * -0.25)));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(Float64(Float64(y * x) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf) tmp = fma(a, Float64(b * -0.25), fma(0.0625, Float64(z * t), fma(x, y, c))); else tmp = fma(y, x, Float64(b * Float64(a * -0.25))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(y * x), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(a * N[(b * -0.25), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot x + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(x, y, c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot \left(a \cdot -0.25\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%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.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%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites62.5%
Taylor expanded in a around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.5
Applied rewrites87.5%
Final simplification99.6%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma y x (* 0.0625 (* z t)))) (t_2 (+ (* y x) (/ (* z t) 16.0)))) (if (<= t_2 -5e+142) t_1 (if (<= t_2 5e+143) (fma -0.25 (* a b) c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(y, x, (0.0625 * (z * t)));
double t_2 = (y * x) + ((z * t) / 16.0);
double tmp;
if (t_2 <= -5e+142) {
tmp = t_1;
} else if (t_2 <= 5e+143) {
tmp = fma(-0.25, (a * b), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(y, x, Float64(0.0625 * Float64(z * t))) t_2 = Float64(Float64(y * x) + Float64(Float64(z * t) / 16.0)) tmp = 0.0 if (t_2 <= -5e+142) tmp = t_1; elseif (t_2 <= 5e+143) tmp = fma(-0.25, Float64(a * b), c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(y * x + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+142], t$95$1, If[LessEqual[t$95$2, 5e+143], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, 0.0625 \cdot \left(z \cdot t\right)\right)\\
t_2 := y \cdot x + \frac{z \cdot t}{16}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -5.0000000000000001e142 or 5.00000000000000012e143 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 93.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites97.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6481.9
Applied rewrites81.9%
if -5.0000000000000001e142 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 5.00000000000000012e143Initial 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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6487.7
Applied rewrites87.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6472.6
Applied rewrites72.6%
Final simplification76.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* z t) 0.0625 c)))
(if (<= (* z t) -5e+57)
t_1
(if (<= (* z t) -4e-293)
(fma x y c)
(if (<= (* z t) 1e-105)
(fma -0.25 (* a b) c)
(if (<= (* z t) 1e+66) (fma a (* b -0.25) (* y x)) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((z * t), 0.0625, c);
double tmp;
if ((z * t) <= -5e+57) {
tmp = t_1;
} else if ((z * t) <= -4e-293) {
tmp = fma(x, y, c);
} else if ((z * t) <= 1e-105) {
tmp = fma(-0.25, (a * b), c);
} else if ((z * t) <= 1e+66) {
tmp = fma(a, (b * -0.25), (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(z * t), 0.0625, c) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = t_1; elseif (Float64(z * t) <= -4e-293) tmp = fma(x, y, c); elseif (Float64(z * t) <= 1e-105) tmp = fma(-0.25, Float64(a * b), c); elseif (Float64(z * t) <= 1e+66) tmp = fma(a, Float64(b * -0.25), Float64(y * x)); 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 + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -4e-293], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e-105], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+66], N[(a * N[(b * -0.25), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-293}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57 or 9.99999999999999945e65 < (*.f64 z t) Initial program 93.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6477.6
Applied rewrites77.6%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
if -4.99999999999999972e57 < (*.f64 z t) < -4.0000000000000002e-293Initial program 98.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.3
Applied rewrites72.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6471.9
Applied rewrites71.9%
if -4.0000000000000002e-293 < (*.f64 z t) < 9.99999999999999965e-106Initial program 98.4%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6476.9
Applied rewrites76.9%
if 9.99999999999999965e-106 < (*.f64 z t) < 9.99999999999999945e65Initial 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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6487.0
Applied rewrites87.0%
Taylor expanded in x around inf
lower-*.f6478.9
Applied rewrites78.9%
Final simplification76.3%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -5e+57)
(fma 0.0625 (* z t) (fma a (* b -0.25) c))
(if (<= (* z t) 1e-33)
(fma a (* b -0.25) (fma x y c))
(fma y x (fma -0.25 (* a b) (* 0.0625 (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -5e+57) {
tmp = fma(0.0625, (z * t), fma(a, (b * -0.25), c));
} else if ((z * t) <= 1e-33) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(y, x, fma(-0.25, (a * b), (0.0625 * (z * t))));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), c)); elseif (Float64(z * t) <= 1e-33) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(y, x, fma(-0.25, Float64(a * b), Float64(0.0625 * Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e-33], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(-0.25 * N[(a * b), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(-0.25, a \cdot b, 0.0625 \cdot \left(z \cdot t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57Initial program 95.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
if -4.99999999999999972e57 < (*.f64 z t) < 1.0000000000000001e-33Initial program 98.5%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6497.2
Applied rewrites97.2%
if 1.0000000000000001e-33 < (*.f64 z t) Initial program 94.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites97.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification93.6%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -5e+57)
(fma 0.0625 (* z t) (fma a (* b -0.25) c))
(if (<= (* z t) 1e-33)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* z t) (fma a (* b -0.25) (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -5e+57) {
tmp = fma(0.0625, (z * t), fma(a, (b * -0.25), c));
} else if ((z * t) <= 1e-33) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (z * t), fma(a, (b * -0.25), (y * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), c)); elseif (Float64(z * t) <= 1e-33) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e-33], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{-33}:\\
\;\;\;\;\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, \mathsf{fma}\left(a, b \cdot -0.25, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57Initial program 95.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
if -4.99999999999999972e57 < (*.f64 z t) < 1.0000000000000001e-33Initial program 98.5%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6497.2
Applied rewrites97.2%
if 1.0000000000000001e-33 < (*.f64 z t) Initial program 94.4%
Taylor expanded in c around 0
associate--l+N/A
lower-fma.f64N/A
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Final simplification93.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* z t) 0.0625 c)))
(if (<= (* z t) -5e+57)
t_1
(if (<= (* z t) -4e-293)
(fma x y c)
(if (<= (* z t) 1e+66) (fma -0.25 (* a b) c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((z * t), 0.0625, c);
double tmp;
if ((z * t) <= -5e+57) {
tmp = t_1;
} else if ((z * t) <= -4e-293) {
tmp = fma(x, y, c);
} else if ((z * t) <= 1e+66) {
tmp = fma(-0.25, (a * b), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(z * t), 0.0625, c) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = t_1; elseif (Float64(z * t) <= -4e-293) tmp = fma(x, y, c); elseif (Float64(z * t) <= 1e+66) tmp = fma(-0.25, Float64(a * b), 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 + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -4e-293], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+66], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-293}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57 or 9.99999999999999945e65 < (*.f64 z t) Initial program 93.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6477.6
Applied rewrites77.6%
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
if -4.99999999999999972e57 < (*.f64 z t) < -4.0000000000000002e-293Initial program 98.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.3
Applied rewrites72.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6471.9
Applied rewrites71.9%
if -4.0000000000000002e-293 < (*.f64 z t) < 9.99999999999999945e65Initial program 99.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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6494.1
Applied rewrites94.1%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (<= (* z t) -5e+57)
t_1
(if (<= (* z t) -4e-293)
(fma x y c)
(if (<= (* z t) 1e+95) (fma -0.25 (* a b) c) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (z * t);
double tmp;
if ((z * t) <= -5e+57) {
tmp = t_1;
} else if ((z * t) <= -4e-293) {
tmp = fma(x, y, c);
} else if ((z * t) <= 1e+95) {
tmp = fma(-0.25, (a * b), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = t_1; elseif (Float64(z * t) <= -4e-293) tmp = fma(x, y, c); elseif (Float64(z * t) <= 1e+95) tmp = fma(-0.25, Float64(a * b), 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]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -4e-293], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+95], N[(-0.25 * N[(a * b), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -4 \cdot 10^{-293}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, a \cdot b, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57 or 1.00000000000000002e95 < (*.f64 z t) Initial program 93.5%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6469.5
Applied rewrites69.5%
if -4.99999999999999972e57 < (*.f64 z t) < -4.0000000000000002e-293Initial program 98.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.3
Applied rewrites72.3%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6471.9
Applied rewrites71.9%
if -4.0000000000000002e-293 < (*.f64 z t) < 1.00000000000000002e95Initial program 99.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
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6492.6
Applied rewrites92.6%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6466.8
Applied rewrites66.8%
Final simplification69.0%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -5e+57)
(fma 0.0625 (* z t) (fma a (* b -0.25) c))
(if (<= (* z t) 1e+66)
(fma a (* b -0.25) (fma x y c))
(fma 0.0625 (* z t) (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -5e+57) {
tmp = fma(0.0625, (z * t), fma(a, (b * -0.25), c));
} else if ((z * t) <= 1e+66) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = fma(0.0625, (z * t), fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), c)); elseif (Float64(z * t) <= 1e+66) tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); else tmp = fma(0.0625, Float64(z * t), fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+66], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+66}:\\
\;\;\;\;\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, \mathsf{fma}\left(x, y, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.99999999999999972e57Initial program 95.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
if -4.99999999999999972e57 < (*.f64 z t) < 9.99999999999999945e65Initial program 98.7%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6495.1
Applied rewrites95.1%
if 9.99999999999999945e65 < (*.f64 z t) Initial program 91.8%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
Final simplification92.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) (fma x y c))))
(if (<= (* z t) -5e+57)
t_1
(if (<= (* z t) 1e+66) (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), fma(x, y, c));
double tmp;
if ((z * t) <= -5e+57) {
tmp = t_1;
} else if ((z * t) <= 1e+66) {
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), fma(x, y, c)) tmp = 0.0 if (Float64(z * t) <= -5e+57) tmp = t_1; elseif (Float64(z * t) <= 1e+66) 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] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+57], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+66], 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, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+66}:\\
\;\;\;\;\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) < -4.99999999999999972e57 or 9.99999999999999945e65 < (*.f64 z t) Initial program 93.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6485.5
Applied rewrites85.5%
if -4.99999999999999972e57 < (*.f64 z t) < 9.99999999999999945e65Initial program 98.7%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6495.1
Applied rewrites95.1%
Final simplification91.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma y x (* b (* a -0.25)))))
(if (<= (* a b) -1e+153)
t_1
(if (<= (* a b) 1e+104) (fma 0.0625 (* z t) (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(y, x, (b * (a * -0.25)));
double tmp;
if ((a * b) <= -1e+153) {
tmp = t_1;
} else if ((a * b) <= 1e+104) {
tmp = fma(0.0625, (z * t), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(y, x, Float64(b * Float64(a * -0.25))) tmp = 0.0 if (Float64(a * b) <= -1e+153) tmp = t_1; elseif (Float64(a * b) <= 1e+104) tmp = fma(0.0625, Float64(z * t), 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[(y * x + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+153], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+104], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, b \cdot \left(a \cdot -0.25\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1e153 or 1e104 < (*.f64 a b) Initial program 92.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites97.5%
Taylor expanded in a around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6483.7
Applied rewrites83.7%
if -1e153 < (*.f64 a b) < 1e104Initial program 98.8%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6490.4
Applied rewrites90.4%
Final simplification88.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* (* a b) -0.25))) (if (<= (* a b) -5e+115) t_1 (if (<= (* a b) 2e+117) (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 = (a * b) * -0.25;
double tmp;
if ((a * b) <= -5e+115) {
tmp = t_1;
} else if ((a * b) <= 2e+117) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * -0.25) tmp = 0.0 if (Float64(a * b) <= -5e+115) tmp = t_1; elseif (Float64(a * b) <= 2e+117) tmp = 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[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+115], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e+117], N[(x * y + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot -0.25\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5.00000000000000008e115 or 2.0000000000000001e117 < (*.f64 a b) Initial program 94.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites98.8%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
Taylor expanded in a around inf
lower-*.f64N/A
lower-*.f6471.7
Applied rewrites71.7%
if -5.00000000000000008e115 < (*.f64 a b) < 2.0000000000000001e117Initial program 98.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6489.8
Applied rewrites89.8%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6461.4
Applied rewrites61.4%
Final simplification64.7%
(FPCore (x y z t a b c) :precision binary64 (fma y x (+ (fma z (* t 0.0625) (* (* a b) -0.25)) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(y, x, (fma(z, (t * 0.0625), ((a * b) * -0.25)) + c));
}
function code(x, y, z, t, a, b, c) return fma(y, x, Float64(fma(z, Float64(t * 0.0625), Float64(Float64(a * b) * -0.25)) + c)) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x + N[(N[(z * N[(t * 0.0625), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, \mathsf{fma}\left(z, t \cdot 0.0625, \left(a \cdot b\right) \cdot -0.25\right) + c\right)
\end{array}
Initial program 96.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
associate--l+N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites98.8%
(FPCore (x y z t a b c) :precision binary64 (fma x y c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, c);
}
function code(x, y, z, t, a, b, c) return fma(x, y, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, c\right)
\end{array}
Initial program 96.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.0
Applied rewrites72.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6446.9
Applied rewrites46.9%
(FPCore (x y z t a b c) :precision binary64 (* y x))
double code(double x, double y, double z, double t, double a, double b, double c) {
return y * x;
}
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 = y * x
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return y * x;
}
def code(x, y, z, t, a, b, c): return y * x
function code(x, y, z, t, a, b, c) return Float64(y * x) end
function tmp = code(x, y, z, t, a, b, c) tmp = y * x; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot x
\end{array}
Initial program 96.9%
Taylor expanded in x around inf
lower-*.f6426.9
Applied rewrites26.9%
Final simplification26.9%
herbie shell --seed 2024214
(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))