Average Error: 0.0 → 0.0
Time: 2.0s
Precision: binary64
Cost: 448
\[x.re \cdot y.re - x.im \cdot y.im\]
\[x.re \cdot y.re - x.im \cdot y.im\]
x.re \cdot y.re - x.im \cdot y.im
x.re \cdot y.re - x.im \cdot y.im
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (- (* x.re y.re) (* x.im y.im)))
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (- (* x.re y.re) (* x.im y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (x_46_re * y_46_re) - (x_46_im * y_46_im);
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return (x_46_re * y_46_re) - (x_46_im * y_46_im);
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error15.4
Cost840
\[\begin{array}{l} \mathbf{if}\;x.re \cdot y.re \leq -1.726160711948435 \cdot 10^{-14} \lor \neg \left(x.re \cdot y.re \leq 6.278185345008299 \cdot 10^{-29}\right):\\ \;\;\;\;x.re \cdot y.re\\ \mathbf{else}:\\ \;\;\;\;-x.im \cdot y.im\\ \end{array}\]
Alternative 2
Error30.3
Cost192
\[x.re \cdot y.re\]
Alternative 3
Error61.0
Cost64
\[0\]
Alternative 4
Error61.7
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[x.re \cdot y.re - x.im \cdot y.im\]
  2. Simplified0.0

    \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im}\]
  3. Final simplification0.0

    \[\leadsto x.re \cdot y.re - x.im \cdot y.im\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x.re x.im y.re y.im)
  :name "_multiplyComplex, real part"
  :precision binary64
  (- (* x.re y.re) (* x.im y.im)))