
(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 13 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 (+ c (fma (- a) (* 0.25 b) (fma 0.0625 (* z t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + fma(-a, (0.25 * b), fma(0.0625, (z * t), (x * y)));
}
function code(x, y, z, t, a, b, c) return Float64(c + fma(Float64(-a), Float64(0.25 * b), fma(0.0625, Float64(z * t), Float64(x * y)))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[((-a) * N[(0.25 * b), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \mathsf{fma}\left(-a, 0.25 \cdot b, \mathsf{fma}\left(0.0625, z \cdot t, x \cdot y\right)\right)
\end{array}
Initial program 98.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval99.2
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-eval99.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma -0.25 (* b a) c)))
(if (<= (* z t) -1.7e+95)
(fma (* z t) 0.0625 c)
(if (<= (* z t) -9.6e-272)
t_1
(if (<= (* z t) 1.3e-134)
(fma x y c)
(if (<= (* z t) 2.5e+237) t_1 (* (* z t) 0.0625)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(-0.25, (b * a), c);
double tmp;
if ((z * t) <= -1.7e+95) {
tmp = fma((z * t), 0.0625, c);
} else if ((z * t) <= -9.6e-272) {
tmp = t_1;
} else if ((z * t) <= 1.3e-134) {
tmp = fma(x, y, c);
} else if ((z * t) <= 2.5e+237) {
tmp = t_1;
} else {
tmp = (z * t) * 0.0625;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(-0.25, Float64(b * a), c) tmp = 0.0 if (Float64(z * t) <= -1.7e+95) tmp = fma(Float64(z * t), 0.0625, c); elseif (Float64(z * t) <= -9.6e-272) tmp = t_1; elseif (Float64(z * t) <= 1.3e-134) tmp = fma(x, y, c); elseif (Float64(z * t) <= 2.5e+237) tmp = t_1; else tmp = Float64(Float64(z * t) * 0.0625); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-0.25 * N[(b * a), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1.7e+95], N[(N[(z * t), $MachinePrecision] * 0.0625 + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -9.6e-272], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1.3e-134], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2.5e+237], t$95$1, N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25, b \cdot a, c\right)\\
\mathbf{if}\;z \cdot t \leq -1.7 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{elif}\;z \cdot t \leq -9.6 \cdot 10^{-272}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 1.3 \cdot 10^{-134}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;z \cdot t \leq 2.5 \cdot 10^{+237}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\end{array}
\end{array}
if (*.f64 z t) < -1.70000000000000011e95Initial program 100.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in x around 0
Applied rewrites76.6%
if -1.70000000000000011e95 < (*.f64 z t) < -9.59999999999999959e-272 or 1.30000000000000011e-134 < (*.f64 z t) < 2.5000000000000001e237Initial program 99.2%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.0
Applied rewrites88.0%
Taylor expanded in x around 0
Applied rewrites66.9%
if -9.59999999999999959e-272 < (*.f64 z t) < 1.30000000000000011e-134Initial program 100.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6474.8
Applied rewrites74.8%
Taylor expanded in x around 0
Applied rewrites30.3%
Taylor expanded in z around 0
Applied rewrites74.8%
if 2.5000000000000001e237 < (*.f64 z t) Initial program 90.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval95.5
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-eval95.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in x around inf
lower-*.f6411.3
Applied rewrites11.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites86.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* z t) 0.0625 c)))
(if (<= (* x y) -1e+37)
(fma -0.25 (* b a) (fma y x c))
(if (<= (* x y) 5e+79) (fma (* -0.25 b) a t_1) (fma 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 ((x * y) <= -1e+37) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else if ((x * y) <= 5e+79) {
tmp = fma((-0.25 * b), a, t_1);
} else {
tmp = fma(y, x, 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(x * y) <= -1e+37) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); elseif (Float64(x * y) <= 5e+79) tmp = fma(Float64(-0.25 * b), a, t_1); else tmp = fma(y, x, 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[(x * y), $MachinePrecision], -1e+37], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+79], N[(N[(-0.25 * b), $MachinePrecision] * a + t$95$1), $MachinePrecision], N[(y * x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot b, a, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999954e36Initial program 98.3%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.6
Applied rewrites91.6%
if -9.99999999999999954e36 < (*.f64 x y) < 5e79Initial program 99.3%
Taylor expanded in x around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.2
Applied rewrites96.2%
Applied rewrites96.8%
if 5e79 < (*.f64 x y) Initial program 97.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.6
Applied rewrites86.6%
Final simplification93.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* z t) 0.0625 c)))
(if (<= (* x y) -2e+30)
(fma -0.25 (* b a) (fma y x c))
(if (<= (* x y) 5e+79) (fma -0.25 (* b a) t_1) (fma 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 ((x * y) <= -2e+30) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else if ((x * y) <= 5e+79) {
tmp = fma(-0.25, (b * a), t_1);
} else {
tmp = fma(y, x, 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(x * y) <= -2e+30) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); elseif (Float64(x * y) <= 5e+79) tmp = fma(-0.25, Float64(b * a), t_1); else tmp = fma(y, x, 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[(x * y), $MachinePrecision], -2e+30], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+79], N[(-0.25 * N[(b * a), $MachinePrecision] + t$95$1), $MachinePrecision], N[(y * x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2e30Initial program 96.7%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6490.2
Applied rewrites90.2%
if -2e30 < (*.f64 x y) < 5e79Initial program 100.0%
Taylor expanded in x around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.8
Applied rewrites96.8%
if 5e79 < (*.f64 x y) Initial program 97.9%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.6
Applied rewrites86.6%
Final simplification93.3%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -4e+95)
(fma y x (fma (* z t) 0.0625 c))
(if (<= (* z t) 1e+188)
(fma -0.25 (* b a) (fma y x c))
(fma (* -0.25 a) b (* (* t 0.0625) z)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -4e+95) {
tmp = fma(y, x, fma((z * t), 0.0625, c));
} else if ((z * t) <= 1e+188) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else {
tmp = fma((-0.25 * a), b, ((t * 0.0625) * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -4e+95) tmp = fma(y, x, fma(Float64(z * t), 0.0625, c)); elseif (Float64(z * t) <= 1e+188) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); else tmp = fma(Float64(-0.25 * a), b, Float64(Float64(t * 0.0625) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -4e+95], N[(y * x + N[(N[(z * t), $MachinePrecision] * 0.0625 + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+188], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(-0.25 * a), $MachinePrecision] * b + N[(N[(t * 0.0625), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+188}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot a, b, \left(t \cdot 0.0625\right) \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.00000000000000008e95Initial program 100.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.5
Applied rewrites88.5%
if -4.00000000000000008e95 < (*.f64 z t) < 1e188Initial program 99.4%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.9
Applied rewrites92.9%
if 1e188 < (*.f64 z t) Initial program 92.8%
Taylor expanded in x around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6489.2
Applied rewrites89.2%
Applied rewrites92.9%
Taylor expanded in c around 0
Applied rewrites86.7%
Applied rewrites90.3%
Final simplification91.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma -0.25 (* b a) (fma y x c))))
(if (<= (* b a) -1e-8)
t_1
(if (<= (* b a) 1e+163) (fma y x (fma (* z t) 0.0625 c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(-0.25, (b * a), fma(y, x, c));
double tmp;
if ((b * a) <= -1e-8) {
tmp = t_1;
} else if ((b * a) <= 1e+163) {
tmp = fma(y, x, fma((z * t), 0.0625, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(-0.25, Float64(b * a), fma(y, x, c)) tmp = 0.0 if (Float64(b * a) <= -1e-8) tmp = t_1; elseif (Float64(b * a) <= 1e+163) tmp = fma(y, x, fma(Float64(z * t), 0.0625, c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -1e-8], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 1e+163], N[(y * x + N[(N[(z * t), $MachinePrecision] * 0.0625 + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(z \cdot t, 0.0625, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1e-8 or 9.9999999999999994e162 < (*.f64 a b) Initial program 98.3%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.8
Applied rewrites86.8%
if -1e-8 < (*.f64 a b) < 9.9999999999999994e162Initial program 99.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6495.6
Applied rewrites95.6%
Final simplification91.7%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* z t) -1.3e+115)
(fma (* z t) 0.0625 c)
(if (<= (* z t) 4.3e+241)
(fma -0.25 (* b a) (fma y x c))
(* (* z t) 0.0625))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z * t) <= -1.3e+115) {
tmp = fma((z * t), 0.0625, c);
} else if ((z * t) <= 4.3e+241) {
tmp = fma(-0.25, (b * a), fma(y, x, c));
} else {
tmp = (z * t) * 0.0625;
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(z * t) <= -1.3e+115) tmp = fma(Float64(z * t), 0.0625, c); elseif (Float64(z * t) <= 4.3e+241) tmp = fma(-0.25, Float64(b * a), fma(y, x, c)); else tmp = Float64(Float64(z * t) * 0.0625); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(z * t), $MachinePrecision], -1.3e+115], N[(N[(z * t), $MachinePrecision] * 0.0625 + c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4.3e+241], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1.3 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot t, 0.0625, c\right)\\
\mathbf{elif}\;z \cdot t \leq 4.3 \cdot 10^{+241}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot t\right) \cdot 0.0625\\
\end{array}
\end{array}
if (*.f64 z t) < -1.3e115Initial program 100.0%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
Taylor expanded in x around 0
Applied rewrites79.9%
if -1.3e115 < (*.f64 z t) < 4.30000000000000004e241Initial program 99.5%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.2
Applied rewrites91.2%
if 4.30000000000000004e241 < (*.f64 z t) Initial program 90.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval95.5
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-eval95.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in x around inf
lower-*.f6411.3
Applied rewrites11.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites86.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* z t) 0.0625 c)))
(if (<= (* z t) -255000.0)
t_1
(if (<= (* z t) 520000.0) (fma -0.25 (* b a) (* x y)) 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) <= -255000.0) {
tmp = t_1;
} else if ((z * t) <= 520000.0) {
tmp = fma(-0.25, (b * a), (x * y));
} 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) <= -255000.0) tmp = t_1; elseif (Float64(z * t) <= 520000.0) tmp = fma(-0.25, Float64(b * a), Float64(x * y)); 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], -255000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 520000.0], N[(-0.25 * N[(b * a), $MachinePrecision] + N[(x * y), $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 -255000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 520000:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -255000 or 5.2e5 < (*.f64 z t) Initial program 98.3%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6480.6
Applied rewrites80.6%
Taylor expanded in x around 0
Applied rewrites69.1%
if -255000 < (*.f64 z t) < 5.2e5Initial program 99.3%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6497.3
Applied rewrites97.3%
Taylor expanded in x around 0
Applied rewrites64.0%
Taylor expanded in c around 0
Applied rewrites73.3%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -2e+120) (fma x y c) (if (<= (* x y) 5e+79) (fma -0.25 (* b a) c) (fma x y c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -2e+120) {
tmp = fma(x, y, c);
} else if ((x * y) <= 5e+79) {
tmp = fma(-0.25, (b * a), c);
} else {
tmp = fma(x, y, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -2e+120) tmp = fma(x, y, c); elseif (Float64(x * y) <= 5e+79) tmp = fma(-0.25, Float64(b * a), c); else tmp = fma(x, y, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+120], N[(x * y + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+79], N[(-0.25 * N[(b * a), $MachinePrecision] + c), $MachinePrecision], N[(x * y + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b \cdot a, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2e120 or 5e79 < (*.f64 x y) Initial program 97.8%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.6
Applied rewrites85.6%
Taylor expanded in x around 0
Applied rewrites26.0%
Taylor expanded in z around 0
Applied rewrites75.2%
if -2e120 < (*.f64 x y) < 5e79Initial program 99.4%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.2
Applied rewrites69.2%
Taylor expanded in x around 0
Applied rewrites64.5%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* (* b a) -0.25))) (if (<= (* b a) -1e+174) t_1 (if (<= (* b a) 4e+143) (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 = (b * a) * -0.25;
double tmp;
if ((b * a) <= -1e+174) {
tmp = t_1;
} else if ((b * a) <= 4e+143) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(b * a) * -0.25) tmp = 0.0 if (Float64(b * a) <= -1e+174) tmp = t_1; elseif (Float64(b * a) <= 4e+143) 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[(b * a), $MachinePrecision] * -0.25), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -1e+174], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 4e+143], N[(x * y + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b \cdot a\right) \cdot -0.25\\
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 4 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000007e174 or 4.0000000000000001e143 < (*.f64 a b) Initial program 97.3%
Taylor expanded in a around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.0
Applied rewrites78.0%
if -1.00000000000000007e174 < (*.f64 a b) < 4.0000000000000001e143Initial program 99.4%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.9
Applied rewrites88.9%
Taylor expanded in x around 0
Applied rewrites59.1%
Taylor expanded in z around 0
Applied rewrites59.5%
Final simplification65.0%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625)))
(if (<= (* z t) -3.15e+111)
t_1
(if (<= (* z t) 4.2e+159) (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 = (z * t) * 0.0625;
double tmp;
if ((z * t) <= -3.15e+111) {
tmp = t_1;
} else if ((z * t) <= 4.2e+159) {
tmp = fma(x, y, 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) <= -3.15e+111) tmp = t_1; elseif (Float64(z * t) <= 4.2e+159) 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[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -3.15e+111], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4.2e+159], N[(x * y + 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 -3.15 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 4.2 \cdot 10^{+159}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -3.1500000000000001e111 or 4.19999999999999978e159 < (*.f64 z t) Initial program 97.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval98.7
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-eval98.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in x around inf
lower-*.f6413.7
Applied rewrites13.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
if -3.1500000000000001e111 < (*.f64 z t) < 4.19999999999999978e159Initial program 99.4%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6467.0
Applied rewrites67.0%
Taylor expanded in x around 0
Applied rewrites36.0%
Taylor expanded in z around 0
Applied rewrites60.2%
(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 98.8%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.7
Applied rewrites71.7%
Taylor expanded in x around 0
Applied rewrites47.7%
Taylor expanded in z around 0
Applied rewrites47.5%
(FPCore (x y z t a b c) :precision binary64 (* x y))
double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return x * y;
}
def code(x, y, z, t, a, b, c): return x * y
function code(x, y, z, t, a, b, c) return Float64(x * y) end
function tmp = code(x, y, z, t, a, b, c) tmp = x * y; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y), $MachinePrecision]
\begin{array}{l}
\\
x \cdot y
\end{array}
Initial program 98.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval99.2
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
metadata-eval99.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Taylor expanded in x around inf
lower-*.f6427.7
Applied rewrites27.7%
herbie shell --seed 2024298
(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))