Average Error: 0.1 → 0.1
Time: 5.9s
Precision: binary64
\[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
\[\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(y, x, c\right)\right)\right) \]
(FPCore (x y z t a b c)
 :precision binary64
 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
(FPCore (x y z t a b c)
 :precision binary64
 (fma 0.0625 (* t z) (fma a (* b -0.25) (fma y x 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;
}
double code(double x, double y, double z, double t, double a, double b, double c) {
	return fma(0.0625, (t * z), fma(a, (b * -0.25), fma(y, x, 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 code(x, y, z, t, a, b, c)
	return fma(0.0625, Float64(t * z), fma(a, Float64(b * -0.25), fma(y, x, 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]
code[x_, y_, z_, t_, a_, b_, c_] := N[(0.0625 * N[(t * z), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + N[(y * x + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(y, x, c\right)\right)\right)

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Initial program 0.1

    \[\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(t, z \cdot 0.0625, c\right)\right)\right)} \]
  3. Taylor expanded in x around 0 0.1

    \[\leadsto \color{blue}{\left(y \cdot x + \left(c + 0.0625 \cdot \left(t \cdot z\right)\right)\right) - 0.25 \cdot \left(a \cdot b\right)} \]
  4. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(y, x, c\right)\right)\right)} \]
  5. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(y, x, c\right)\right)\right) \]

Reproduce

herbie shell --seed 2022162 
(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))