
(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
(let* ((t_1 (- (+ (* y x) (/ (* t z) 16.0)) (/ (* b a) 4.0))))
(if (<= t_1 INFINITY)
(+ c t_1)
(fma (* -0.25 b) a (fma (* 0.0625 t) z c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((y * x) + ((t * z) / 16.0)) - ((b * a) / 4.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = c + t_1;
} else {
tmp = fma((-0.25 * b), a, fma((0.0625 * t), z, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(y * x) + Float64(Float64(t * z) / 16.0)) - Float64(Float64(b * a) / 4.0)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(c + t_1); else tmp = fma(Float64(-0.25 * b), a, fma(Float64(0.0625 * t), z, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(y * x), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(N[(-0.25 * b), $MachinePrecision] * a + N[(N[(0.0625 * t), $MachinePrecision] * z + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot x + \frac{t \cdot z}{16}\right) - \frac{b \cdot a}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;c + t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(0.0625 \cdot t, z, 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 y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6466.7
Applied rewrites66.7%
Final simplification99.2%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma (* 0.0625 z) t (* y x))) (t_2 (+ (* y x) (/ (* t z) 16.0)))) (if (<= t_2 -1e+135) t_1 (if (<= t_2 5e+192) (+ (* -0.25 (* b a)) 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, (y * x));
double t_2 = (y * x) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -1e+135) {
tmp = t_1;
} else if (t_2 <= 5e+192) {
tmp = (-0.25 * (b * a)) + c;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(0.0625 * z), t, Float64(y * x)) t_2 = Float64(Float64(y * x) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -1e+135) tmp = t_1; elseif (t_2 <= 5e+192) tmp = Float64(Float64(-0.25 * Float64(b * a)) + c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(0.0625 * z), $MachinePrecision] * t + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * x), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+135], t$95$1, If[LessEqual[t$95$2, 5e+192], N[(N[(-0.25 * N[(b * a), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625 \cdot z, t, y \cdot x\right)\\
t_2 := y \cdot x + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+192}:\\
\;\;\;\;-0.25 \cdot \left(b \cdot a\right) + c\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -9.99999999999999962e134 or 5.00000000000000033e192 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 94.6%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6487.6
Applied rewrites87.6%
Taylor expanded in c around 0
Applied rewrites82.7%
if -9.99999999999999962e134 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 5.00000000000000033e192Initial program 100.0%
Taylor expanded in b around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6474.1
Applied rewrites74.1%
Final simplification78.0%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* b a) -2e+38)
(fma (* -0.25 b) a (* y x))
(if (<= (* b a) -1e-198)
(fma y x c)
(if (<= (* b a) 5e+88) (fma (* 0.0625 z) t c) (fma (* -0.25 a) b c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b * a) <= -2e+38) {
tmp = fma((-0.25 * b), a, (y * x));
} else if ((b * a) <= -1e-198) {
tmp = fma(y, x, c);
} else if ((b * a) <= 5e+88) {
tmp = fma((0.0625 * z), t, c);
} else {
tmp = fma((-0.25 * a), b, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(b * a) <= -2e+38) tmp = fma(Float64(-0.25 * b), a, Float64(y * x)); elseif (Float64(b * a) <= -1e-198) tmp = fma(y, x, c); elseif (Float64(b * a) <= 5e+88) tmp = fma(Float64(0.0625 * z), t, c); else tmp = fma(Float64(-0.25 * a), b, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(b * a), $MachinePrecision], -2e+38], N[(N[(-0.25 * b), $MachinePrecision] * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], -1e-198], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 5e+88], N[(N[(0.0625 * z), $MachinePrecision] * t + c), $MachinePrecision], N[(N[(-0.25 * a), $MachinePrecision] * b + c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot b, a, y \cdot x\right)\\
\mathbf{elif}\;b \cdot a \leq -1 \cdot 10^{-198}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot a, b, c\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999995e38Initial program 98.2%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.4
Applied rewrites81.4%
Taylor expanded in c around 0
Applied rewrites74.9%
if -1.99999999999999995e38 < (*.f64 a b) < -9.9999999999999991e-199Initial program 98.0%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.2
Applied rewrites69.2%
Taylor expanded in b around 0
Applied rewrites66.8%
if -9.9999999999999991e-199 < (*.f64 a b) < 4.99999999999999997e88Initial program 97.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.1
Applied rewrites74.1%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6474.1
Applied rewrites74.1%
Taylor expanded in b around 0
Applied rewrites70.3%
Applied rewrites70.4%
if 4.99999999999999997e88 < (*.f64 a b) Initial program 97.9%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.1
Applied rewrites96.1%
Taylor expanded in t around 0
Applied rewrites91.3%
Final simplification74.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* -0.25 a) b c)))
(if (<= (* b a) -2e+85)
t_1
(if (<= (* b a) -1e-198)
(fma y x c)
(if (<= (* b a) 5e+88) (fma (* 0.0625 z) t 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 * a), b, c);
double tmp;
if ((b * a) <= -2e+85) {
tmp = t_1;
} else if ((b * a) <= -1e-198) {
tmp = fma(y, x, c);
} else if ((b * a) <= 5e+88) {
tmp = fma((0.0625 * z), t, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(-0.25 * a), b, c) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = t_1; elseif (Float64(b * a) <= -1e-198) tmp = fma(y, x, c); elseif (Float64(b * a) <= 5e+88) tmp = fma(Float64(0.0625 * z), t, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(-0.25 * a), $MachinePrecision] * b + c), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], -1e-198], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 5e+88], N[(N[(0.0625 * z), $MachinePrecision] * t + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25 \cdot a, b, c\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq -1 \cdot 10^{-198}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85 or 4.99999999999999997e88 < (*.f64 a b) Initial program 97.8%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
Taylor expanded in t around 0
Applied rewrites81.8%
if -2e85 < (*.f64 a b) < -9.9999999999999991e-199Initial program 98.3%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.5
Applied rewrites70.5%
Taylor expanded in b around 0
Applied rewrites65.1%
if -9.9999999999999991e-199 < (*.f64 a b) < 4.99999999999999997e88Initial program 97.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.1
Applied rewrites74.1%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6474.1
Applied rewrites74.1%
Taylor expanded in b around 0
Applied rewrites70.3%
Applied rewrites70.4%
Final simplification73.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* -0.25 a) b c)))
(if (<= (* b a) -2e+85)
t_1
(if (<= (* b a) -1e-198)
(fma y x c)
(if (<= (* b a) 5e+88) (fma (* t z) 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 * a), b, c);
double tmp;
if ((b * a) <= -2e+85) {
tmp = t_1;
} else if ((b * a) <= -1e-198) {
tmp = fma(y, x, c);
} else if ((b * a) <= 5e+88) {
tmp = fma((t * z), 0.0625, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(-0.25 * a), b, c) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = t_1; elseif (Float64(b * a) <= -1e-198) tmp = fma(y, x, c); elseif (Float64(b * a) <= 5e+88) tmp = fma(Float64(t * z), 0.0625, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(-0.25 * a), $MachinePrecision] * b + c), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], -1e-198], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 5e+88], N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25 \cdot a, b, c\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq -1 \cdot 10^{-198}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85 or 4.99999999999999997e88 < (*.f64 a b) Initial program 97.8%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
Taylor expanded in t around 0
Applied rewrites81.8%
if -2e85 < (*.f64 a b) < -9.9999999999999991e-199Initial program 98.3%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.5
Applied rewrites70.5%
Taylor expanded in b around 0
Applied rewrites65.1%
if -9.9999999999999991e-199 < (*.f64 a b) < 4.99999999999999997e88Initial program 97.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.1
Applied rewrites74.1%
Taylor expanded in b around 0
Applied rewrites70.3%
Final simplification73.3%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* b a) -2e+85)
(fma (* 0.0625 z) t (fma (* -0.25 a) b c))
(if (<= (* b a) 2e+88)
(fma (* 0.0625 t) z (fma y x c))
(fma (* -0.25 b) a (fma (* 0.0625 t) z c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b * a) <= -2e+85) {
tmp = fma((0.0625 * z), t, fma((-0.25 * a), b, c));
} else if ((b * a) <= 2e+88) {
tmp = fma((0.0625 * t), z, fma(y, x, c));
} else {
tmp = fma((-0.25 * b), a, fma((0.0625 * t), z, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = fma(Float64(0.0625 * z), t, fma(Float64(-0.25 * a), b, c)); elseif (Float64(b * a) <= 2e+88) tmp = fma(Float64(0.0625 * t), z, fma(y, x, c)); else tmp = fma(Float64(-0.25 * b), a, fma(Float64(0.0625 * t), z, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], N[(N[(0.0625 * z), $MachinePrecision] * t + N[(N[(-0.25 * a), $MachinePrecision] * b + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 2e+88], N[(N[(0.0625 * t), $MachinePrecision] * z + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(-0.25 * b), $MachinePrecision] * a + N[(N[(0.0625 * t), $MachinePrecision] * z + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, \mathsf{fma}\left(-0.25 \cdot a, b, c\right)\right)\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot t, z, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(0.0625 \cdot t, z, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85Initial program 97.8%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.7
Applied rewrites89.7%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6489.7
Applied rewrites89.7%
if -2e85 < (*.f64 a b) < 1.99999999999999992e88Initial program 97.5%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.0
Applied rewrites93.0%
if 1.99999999999999992e88 < (*.f64 a b) Initial program 97.9%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.1
Applied rewrites96.1%
Final simplification93.0%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (* -0.25 b) a (fma (* 0.0625 t) z c))))
(if (<= (* b a) -2e+85)
t_1
(if (<= (* b a) 2e+88) (fma (* 0.0625 t) z (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 = fma((-0.25 * b), a, fma((0.0625 * t), z, c));
double tmp;
if ((b * a) <= -2e+85) {
tmp = t_1;
} else if ((b * a) <= 2e+88) {
tmp = fma((0.0625 * t), z, fma(y, x, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(-0.25 * b), a, fma(Float64(0.0625 * t), z, c)) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = t_1; elseif (Float64(b * a) <= 2e+88) tmp = fma(Float64(0.0625 * t), z, 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[(-0.25 * b), $MachinePrecision] * a + N[(N[(0.0625 * t), $MachinePrecision] * z + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 2e+88], N[(N[(0.0625 * t), $MachinePrecision] * z + N[(y * x + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(0.0625 \cdot t, z, c\right)\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot t, z, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85 or 1.99999999999999992e88 < (*.f64 a b) Initial program 97.9%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.0
Applied rewrites93.0%
if -2e85 < (*.f64 a b) < 1.99999999999999992e88Initial program 97.5%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.0
Applied rewrites93.0%
Final simplification93.0%
(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) -5e+45)
t_1
(if (<= (* b a) 5e+88) (fma (* 0.0625 t) z (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 = fma((-0.25 * b), a, fma(y, x, c));
double tmp;
if ((b * a) <= -5e+45) {
tmp = t_1;
} else if ((b * a) <= 5e+88) {
tmp = fma((0.0625 * t), z, fma(y, x, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(-0.25 * b), a, fma(y, x, c)) tmp = 0.0 if (Float64(b * a) <= -5e+45) tmp = t_1; elseif (Float64(b * a) <= 5e+88) tmp = fma(Float64(0.0625 * t), z, 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[(-0.25 * b), $MachinePrecision] * a + N[(y * x + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -5e+45], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 5e+88], N[(N[(0.0625 * t), $MachinePrecision] * z + N[(y * x + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{if}\;b \cdot a \leq -5 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot t, z, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5e45 or 4.99999999999999997e88 < (*.f64 a b) Initial program 98.0%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6487.7
Applied rewrites87.7%
if -5e45 < (*.f64 a b) < 4.99999999999999997e88Initial program 97.3%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
Final simplification91.5%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* t z) -2e+136)
(fma (* 0.0625 z) t c)
(if (<= (* t z) 2e+182)
(fma (* -0.25 b) a (fma y x c))
(fma (* 0.0625 z) t (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t * z) <= -2e+136) {
tmp = fma((0.0625 * z), t, c);
} else if ((t * z) <= 2e+182) {
tmp = fma((-0.25 * b), a, fma(y, x, c));
} else {
tmp = fma((0.0625 * z), t, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(t * z) <= -2e+136) tmp = fma(Float64(0.0625 * z), t, c); elseif (Float64(t * z) <= 2e+182) tmp = fma(Float64(-0.25 * b), a, fma(y, x, c)); else tmp = fma(Float64(0.0625 * z), t, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(t * z), $MachinePrecision], -2e+136], N[(N[(0.0625 * z), $MachinePrecision] * t + c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+182], N[(N[(-0.25 * b), $MachinePrecision] * a + N[(y * x + c), $MachinePrecision]), $MachinePrecision], N[(N[(0.0625 * z), $MachinePrecision] * t + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+136}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, c\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+182}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot b, a, \mathsf{fma}\left(y, x, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000012e136Initial program 97.6%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.9
Applied rewrites93.9%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.0
Applied rewrites94.0%
Taylor expanded in b around 0
Applied rewrites83.4%
Applied rewrites83.5%
if -2.00000000000000012e136 < (*.f64 z t) < 2.0000000000000001e182Initial program 100.0%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Applied rewrites88.3%
if 2.0000000000000001e182 < (*.f64 z t) Initial program 80.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.2
Applied rewrites86.2%
Taylor expanded in c around 0
Applied rewrites86.2%
Final simplification87.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma (* -0.25 a) b c))) (if (<= (* b a) -2e+85) t_1 (if (<= (* b a) 2e+28) (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 = fma((-0.25 * a), b, c);
double tmp;
if ((b * a) <= -2e+85) {
tmp = t_1;
} else if ((b * a) <= 2e+28) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(-0.25 * a), b, c) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = t_1; elseif (Float64(b * a) <= 2e+28) 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[(-0.25 * a), $MachinePrecision] * b + c), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 2e+28], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.25 \cdot a, b, c\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85 or 1.99999999999999992e28 < (*.f64 a b) Initial program 98.0%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in t around 0
Applied rewrites77.7%
if -2e85 < (*.f64 a b) < 1.99999999999999992e28Initial program 97.3%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.8
Applied rewrites62.8%
Taylor expanded in b around 0
Applied rewrites59.1%
Final simplification66.6%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* -0.25 (* b a)))) (if (<= (* b a) -2e+85) t_1 (if (<= (* b a) 4e+33) (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 = -0.25 * (b * a);
double tmp;
if ((b * a) <= -2e+85) {
tmp = t_1;
} else if ((b * a) <= 4e+33) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(-0.25 * Float64(b * a)) tmp = 0.0 if (Float64(b * a) <= -2e+85) tmp = t_1; elseif (Float64(b * a) <= 4e+33) 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[(-0.25 * N[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+85], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 4e+33], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -0.25 \cdot \left(b \cdot a\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 4 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2e85 or 3.9999999999999998e33 < (*.f64 a b) Initial program 98.0%
Taylor expanded in b around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
if -2e85 < (*.f64 a b) < 3.9999999999999998e33Initial program 97.3%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6463.0
Applied rewrites63.0%
Taylor expanded in b around 0
Applied rewrites59.4%
Final simplification64.2%
(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 97.6%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6471.7
Applied rewrites71.7%
Taylor expanded in b around 0
Applied rewrites42.8%
(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 97.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
herbie shell --seed 2024268
(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))