
(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 (+ (fma (* t 0.0625) z (fma x y (* (* a b) -0.25))) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma((t * 0.0625), z, fma(x, y, ((a * b) * -0.25))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(Float64(t * 0.0625), z, fma(x, y, Float64(Float64(a * b) * -0.25))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, \left(a \cdot b\right) \cdot -0.25\right)\right) + c
\end{array}
Initial program 97.6%
lift--.f64N/A
sub-negN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval99.2
Applied rewrites99.2%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma (* t 0.0625) z (* x y))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -2e+73) t_1 (if (<= t_2 2e+21) (fma a (* b -0.25) c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma((t * 0.0625), z, (x * y));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -2e+73) {
tmp = t_1;
} else if (t_2 <= 2e+21) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(Float64(t * 0.0625), z, Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -2e+73) tmp = t_1; elseif (t_2 <= 2e+21) tmp = fma(a, Float64(b * -0.25), c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+73], t$95$1, If[LessEqual[t$95$2, 2e+21], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -1.99999999999999997e73 or 2e21 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 96.5%
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.f6481.5
Applied rewrites81.5%
Applied rewrites82.7%
Taylor expanded in x around inf
Applied rewrites74.3%
if -1.99999999999999997e73 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 2e21Initial 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.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites85.7%
Final simplification78.0%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma 0.0625 (* t z) (* x y))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -2e+73) t_1 (if (<= t_2 2e+21) (fma a (* b -0.25) c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(0.0625, (t * z), (x * y));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -2e+73) {
tmp = t_1;
} else if (t_2 <= 2e+21) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(t * z), Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -2e+73) tmp = t_1; elseif (t_2 <= 2e+21) tmp = fma(a, Float64(b * -0.25), c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+73], t$95$1, If[LessEqual[t$95$2, 2e+21], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, t \cdot z, x \cdot y\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -1.99999999999999997e73 or 2e21 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 96.5%
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.f6481.5
Applied rewrites81.5%
Taylor expanded in x around inf
Applied rewrites73.1%
if -1.99999999999999997e73 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 2e21Initial 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.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites85.7%
Final simplification77.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) c)))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 0.0004)
(fma (* 0.0625 z) t c)
(if (<= (* a b) 5e+108) (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(a, (b * -0.25), c);
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 0.0004) {
tmp = fma((0.0625 * z), t, c);
} else if ((a * b) <= 5e+108) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), c) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 0.0004) tmp = fma(Float64(0.0625 * z), t, c); elseif (Float64(a * b) <= 5e+108) 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[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 0.0004], N[(N[(0.0625 * z), $MachinePrecision] * t + c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+108], N[(x * y + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 0.0004:\\
\;\;\;\;\mathsf{fma}\left(0.0625 \cdot z, t, c\right)\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 4.99999999999999991e108 < (*.f64 a b) Initial program 95.8%
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.0
Applied rewrites92.0%
Taylor expanded in x around 0
Applied rewrites82.7%
if -1.00000000000000004e192 < (*.f64 a b) < 4.00000000000000019e-4Initial program 98.1%
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.f6492.3
Applied rewrites92.3%
Applied rewrites93.5%
Taylor expanded in x around 0
Applied rewrites65.7%
Applied rewrites65.7%
if 4.00000000000000019e-4 < (*.f64 a b) < 4.99999999999999991e108Initial program 100.0%
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.1
Applied rewrites85.1%
Taylor expanded in t around 0
Applied rewrites72.4%
Final simplification71.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) c)))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 0.0004)
(fma 0.0625 (* t z) c)
(if (<= (* a b) 5e+108) (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(a, (b * -0.25), c);
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 0.0004) {
tmp = fma(0.0625, (t * z), c);
} else if ((a * b) <= 5e+108) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), c) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 0.0004) tmp = fma(0.0625, Float64(t * z), c); elseif (Float64(a * b) <= 5e+108) 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[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 0.0004], N[(0.0625 * N[(t * z), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+108], N[(x * y + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 0.0004:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, c\right)\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 4.99999999999999991e108 < (*.f64 a b) Initial program 95.8%
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.0
Applied rewrites92.0%
Taylor expanded in x around 0
Applied rewrites82.7%
if -1.00000000000000004e192 < (*.f64 a b) < 4.00000000000000019e-4Initial program 98.1%
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.f6492.3
Applied rewrites92.3%
Taylor expanded in x around 0
Applied rewrites65.7%
if 4.00000000000000019e-4 < (*.f64 a b) < 4.99999999999999991e108Initial program 100.0%
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.1
Applied rewrites85.1%
Taylor expanded in t around 0
Applied rewrites72.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* a (* b -0.25))))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 0.0004)
(fma 0.0625 (* t z) c)
(if (<= (* a b) 5e+108) (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) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 0.0004) {
tmp = fma(0.0625, (t * z), c);
} else if ((a * b) <= 5e+108) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 0.0004) tmp = fma(0.0625, Float64(t * z), c); elseif (Float64(a * b) <= 5e+108) 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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 0.0004], N[(0.0625 * N[(t * z), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+108], N[(x * y + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 0.0004:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, c\right)\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 4.99999999999999991e108 < (*.f64 a b) Initial program 95.8%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6479.9
Applied rewrites79.9%
if -1.00000000000000004e192 < (*.f64 a b) < 4.00000000000000019e-4Initial program 98.1%
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.f6492.3
Applied rewrites92.3%
Taylor expanded in x around 0
Applied rewrites65.7%
if 4.00000000000000019e-4 < (*.f64 a b) < 4.99999999999999991e108Initial program 100.0%
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.1
Applied rewrites85.1%
Taylor expanded in t around 0
Applied rewrites72.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma y x (+ c (* a (* b -0.25))))))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 1e+18) (fma (* t 0.0625) z (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, (c + (a * (b * -0.25))));
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 1e+18) {
tmp = fma((t * 0.0625), z, 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(c + Float64(a * Float64(b * -0.25)))) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 1e+18) tmp = fma(Float64(t * 0.0625), z, 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[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+18], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, c + a \cdot \left(b \cdot -0.25\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 1e18 < (*.f64 a b) Initial program 96.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.f6491.5
Applied rewrites91.5%
Applied rewrites92.6%
if -1.00000000000000004e192 < (*.f64 a b) < 1e18Initial program 98.2%
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.f6492.5
Applied rewrites92.5%
Applied rewrites93.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) (fma x y c))))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 1e+18) (fma (* t 0.0625) z (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(a, (b * -0.25), fma(x, y, c));
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 1e+18) {
tmp = fma((t * 0.0625), z, fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), fma(x, y, c)) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 1e+18) tmp = fma(Float64(t * 0.0625), z, 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[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+18], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 1e18 < (*.f64 a b) Initial program 96.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.f6491.5
Applied rewrites91.5%
if -1.00000000000000004e192 < (*.f64 a b) < 1e18Initial program 98.2%
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.f6492.5
Applied rewrites92.5%
Applied rewrites93.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) (fma x y c))))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 1e+18) (fma 0.0625 (* t z) (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(a, (b * -0.25), fma(x, y, c));
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 1e+18) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), fma(x, y, c)) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 1e+18) tmp = fma(0.0625, Float64(t * z), 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[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+18], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 1e18 < (*.f64 a b) Initial program 96.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.f6491.5
Applied rewrites91.5%
if -1.00000000000000004e192 < (*.f64 a b) < 1e18Initial program 98.2%
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.f6492.5
Applied rewrites92.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma y x (* (* a b) -0.25))))
(if (<= (* a b) -1e+192)
t_1
(if (<= (* a b) 2e+87) (fma 0.0625 (* t z) (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, ((a * b) * -0.25));
double tmp;
if ((a * b) <= -1e+192) {
tmp = t_1;
} else if ((a * b) <= 2e+87) {
tmp = fma(0.0625, (t * z), 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(Float64(a * b) * -0.25)) tmp = 0.0 if (Float64(a * b) <= -1e+192) tmp = t_1; elseif (Float64(a * b) <= 2e+87) tmp = fma(0.0625, Float64(t * z), 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[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+192], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e+87], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, \left(a \cdot b\right) \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000004e192 or 1.9999999999999999e87 < (*.f64 a b) Initial program 96.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.3
Applied rewrites92.3%
Applied rewrites93.6%
Taylor expanded in c around 0
Applied rewrites90.8%
if -1.00000000000000004e192 < (*.f64 a b) < 1.9999999999999999e87Initial 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.f6491.5
Applied rewrites91.5%
Final simplification91.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* a (* b -0.25)))) (if (<= (* a b) -1e+162) t_1 (if (<= (* a b) 5e+108) (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) <= -1e+162) {
tmp = t_1;
} else if ((a * b) <= 5e+108) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (Float64(a * b) <= -1e+162) tmp = t_1; elseif (Float64(a * b) <= 5e+108) 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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+162], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e+108], N[(x * y + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -9.9999999999999994e161 or 4.99999999999999991e108 < (*.f64 a b) Initial program 96.0%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
if -9.9999999999999994e161 < (*.f64 a b) < 4.99999999999999991e108Initial 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.f6491.7
Applied rewrites91.7%
Taylor expanded in t around 0
Applied rewrites55.5%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* 0.0625 (* t z)))) (if (<= (* t z) -1e+158) t_1 (if (<= (* t z) 2e+90) (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 = 0.0625 * (t * z);
double tmp;
if ((t * z) <= -1e+158) {
tmp = t_1;
} else if ((t * z) <= 2e+90) {
tmp = fma(x, y, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(t * z)) tmp = 0.0 if (Float64(t * z) <= -1e+158) tmp = t_1; elseif (Float64(t * z) <= 2e+90) 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[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -1e+158], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 2e+90], N[(x * y + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(x, y, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999953e157 or 1.99999999999999993e90 < (*.f64 z t) Initial program 92.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f6468.6
Applied rewrites68.6%
if -9.99999999999999953e157 < (*.f64 z t) < 1.99999999999999993e90Initial program 100.0%
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.f6467.4
Applied rewrites67.4%
Taylor expanded in t around 0
Applied rewrites56.4%
Final simplification60.5%
(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 97.6%
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.1
Applied rewrites72.1%
Taylor expanded in t around 0
Applied rewrites43.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 97.6%
Taylor expanded in x around inf
lower-*.f6426.7
Applied rewrites26.7%
herbie shell --seed 2024216
(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))