_multiplyComplex, real part

Percentage Accurate: 99.2% → 99.6%
Time: 3.9s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x.re \cdot y.re - x.im \cdot y.im \end{array} \]
(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);
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = (x_46re * y_46re) - (x_46im * y_46im)
end function
public static 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);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return (x_46_re * y_46_re) - (x_46_im * y_46_im)
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(x_46_re * y_46_re) - Float64(x_46_im * y_46_im))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = (x_46_re * y_46_re) - (x_46_im * y_46_im);
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(x$46$re * y$46$re), $MachinePrecision] - N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x.re \cdot y.re - x.im \cdot y.im
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x.re \cdot y.re - x.im \cdot y.im \end{array} \]
(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);
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = (x_46re * y_46re) - (x_46im * y_46im)
end function
public static 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);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return (x_46_re * y_46_re) - (x_46_im * y_46_im)
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(x_46_re * y_46_re) - Float64(x_46_im * y_46_im))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = (x_46_re * y_46_re) - (x_46_im * y_46_im);
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(x$46$re * y$46$re), $MachinePrecision] - N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x.re \cdot y.re - x.im \cdot y.im
\end{array}

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(-y.im, x.im, y.re \cdot x.re\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (fma (- y.im) x.im (* y.re x.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return fma(-y_46_im, x_46_im, (y_46_re * x_46_re));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return fma(Float64(-y_46_im), x_46_im, Float64(y_46_re * x_46_re))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[((-y$46$im) * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(-y.im, x.im, y.re \cdot x.re\right)
\end{array}
Derivation
  1. Initial program 98.0%

    \[x.re \cdot y.re - x.im \cdot y.im \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
    2. sub-negN/A

      \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
    3. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) + x.re \cdot y.re} \]
    4. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) + x.re \cdot y.re \]
    5. *-commutativeN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) + x.re \cdot y.re \]
    6. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im} + x.re \cdot y.re \]
    7. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(y.im\right), x.im, x.re \cdot y.re\right)} \]
    8. lower-neg.f6499.6

      \[\leadsto \mathsf{fma}\left(\color{blue}{-y.im}, x.im, x.re \cdot y.re\right) \]
    9. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(-y.im, x.im, \color{blue}{x.re \cdot y.re}\right) \]
    10. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(-y.im, x.im, \color{blue}{y.re \cdot x.re}\right) \]
    11. lower-*.f6499.6

      \[\leadsto \mathsf{fma}\left(-y.im, x.im, \color{blue}{y.re \cdot x.re}\right) \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-y.im, x.im, y.re \cdot x.re\right)} \]
  5. Add Preprocessing

Alternative 2: 73.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \cdot y.re \leq -2 \cdot 10^{+55} \lor \neg \left(x.re \cdot y.re \leq 5 \cdot 10^{+112}\right):\\ \;\;\;\;\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-x.im\right) \cdot y.im\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= (* x.re y.re) -2e+55) (not (<= (* x.re y.re) 5e+112)))
   (fma y.im x.im (* y.re x.re))
   (* (- x.im) y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (((x_46_re * y_46_re) <= -2e+55) || !((x_46_re * y_46_re) <= 5e+112)) {
		tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re));
	} else {
		tmp = -x_46_im * y_46_im;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((Float64(x_46_re * y_46_re) <= -2e+55) || !(Float64(x_46_re * y_46_re) <= 5e+112))
		tmp = fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re));
	else
		tmp = Float64(Float64(-x_46_im) * y_46_im);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[N[(x$46$re * y$46$re), $MachinePrecision], -2e+55], N[Not[LessEqual[N[(x$46$re * y$46$re), $MachinePrecision], 5e+112]], $MachinePrecision]], N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[((-x$46$im) * y$46$im), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \cdot y.re \leq -2 \cdot 10^{+55} \lor \neg \left(x.re \cdot y.re \leq 5 \cdot 10^{+112}\right):\\
\;\;\;\;\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-x.im\right) \cdot y.im\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x.re y.re) < -2.00000000000000002e55 or 5e112 < (*.f64 x.re y.re)

    1. Initial program 94.7%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      10. lower-neg.f6495.8

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(-y.im\right)} \cdot x.im\right) \]
    4. Applied rewrites95.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{y.re \cdot x.re + \left(-y.im\right) \cdot x.im} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(-y.im\right) \cdot x.im \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-y.im\right) \cdot x.im + y.re \cdot x.re} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(-y.im\right) \cdot x.im} + y.re \cdot x.re \]
      5. lift-fma.f6498.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(-y.im, x.im, y.re \cdot x.re\right)} \]
    6. Applied rewrites87.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)} \]

    if -2.00000000000000002e55 < (*.f64 x.re y.re) < 5e112

    1. Initial program 100.0%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-1 \cdot \left(x.im \cdot y.im\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
      3. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im \]
      4. lower-neg.f6478.0

        \[\leadsto \color{blue}{\left(-x.im\right)} \cdot y.im \]
    5. Applied rewrites78.0%

      \[\leadsto \color{blue}{\left(-x.im\right) \cdot y.im} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \cdot y.re \leq -2 \cdot 10^{+55} \lor \neg \left(x.re \cdot y.re \leq 5 \cdot 10^{+112}\right):\\ \;\;\;\;\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-x.im\right) \cdot y.im\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.re \cdot y.re \leq -2 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\ \mathbf{elif}\;x.re \cdot y.re \leq 5 \cdot 10^{+112}:\\ \;\;\;\;\left(-x.im\right) \cdot y.im\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= (* x.re y.re) -2e+55)
   (fma y.im x.im (* y.re x.re))
   (if (<= (* x.re y.re) 5e+112)
     (* (- x.im) y.im)
     (fma y.re x.re (* y.im x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((x_46_re * y_46_re) <= -2e+55) {
		tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re));
	} else if ((x_46_re * y_46_re) <= 5e+112) {
		tmp = -x_46_im * y_46_im;
	} else {
		tmp = fma(y_46_re, x_46_re, (y_46_im * x_46_im));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (Float64(x_46_re * y_46_re) <= -2e+55)
		tmp = fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re));
	elseif (Float64(x_46_re * y_46_re) <= 5e+112)
		tmp = Float64(Float64(-x_46_im) * y_46_im);
	else
		tmp = fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[N[(x$46$re * y$46$re), $MachinePrecision], -2e+55], N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x$46$re * y$46$re), $MachinePrecision], 5e+112], N[((-x$46$im) * y$46$im), $MachinePrecision], N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.re \cdot y.re \leq -2 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)\\

\mathbf{elif}\;x.re \cdot y.re \leq 5 \cdot 10^{+112}:\\
\;\;\;\;\left(-x.im\right) \cdot y.im\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x.re y.re) < -2.00000000000000002e55

    1. Initial program 94.8%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      10. lower-neg.f6494.8

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(-y.im\right)} \cdot x.im\right) \]
    4. Applied rewrites94.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \color{blue}{y.re \cdot x.re + \left(-y.im\right) \cdot x.im} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(-y.im\right) \cdot x.im \]
      3. +-commutativeN/A

        \[\leadsto \color{blue}{\left(-y.im\right) \cdot x.im + y.re \cdot x.re} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(-y.im\right) \cdot x.im} + y.re \cdot x.re \]
      5. lift-fma.f64100.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(-y.im, x.im, y.re \cdot x.re\right)} \]
    6. Applied rewrites87.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)} \]

    if -2.00000000000000002e55 < (*.f64 x.re y.re) < 5e112

    1. Initial program 100.0%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Taylor expanded in x.re around 0

      \[\leadsto \color{blue}{-1 \cdot \left(x.im \cdot y.im\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
      3. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im \]
      4. lower-neg.f6478.0

        \[\leadsto \color{blue}{\left(-x.im\right)} \cdot y.im \]
    5. Applied rewrites78.0%

      \[\leadsto \color{blue}{\left(-x.im\right) \cdot y.im} \]

    if 5e112 < (*.f64 x.re y.re)

    1. Initial program 94.6%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      10. lower-neg.f6497.3

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(-y.im\right)} \cdot x.im\right) \]
    4. Applied rewrites97.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)} \cdot x.im\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(0 - y.im\right)} \cdot x.im\right) \]
      3. flip3--N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\frac{{0}^{3} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)}} \cdot x.im\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\color{blue}{0} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      5. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\color{blue}{\mathsf{neg}\left({y.im}^{3}\right)}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      6. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{y.im}^{\left(\frac{3}{2}\right)} \cdot {y.im}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      7. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(y.im \cdot y.im\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      8. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\color{blue}{\left(\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\mathsf{neg}\left(y.im\right)\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\left(\color{blue}{\left(-y.im\right)} \cdot \left(\mathsf{neg}\left(y.im\right)\right)\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\left(\left(-y.im\right) \cdot \color{blue}{\left(-y.im\right)}\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      11. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(-y.im\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(-y.im\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      12. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(-y.im\right)}^{3}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}}^{3}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      14. cube-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left({y.im}^{3}\right)\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      15. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{\left(0 - {y.im}^{3}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\left(\color{blue}{{0}^{3}} - {y.im}^{3}\right)\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(\frac{{0}^{3} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)}\right)\right)} \cdot x.im\right) \]
      18. flip3--N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \left(\mathsf{neg}\left(\color{blue}{\left(0 - y.im\right)}\right)\right) \cdot x.im\right) \]
      19. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}\right)\right) \cdot x.im\right) \]
      20. remove-double-neg88.4

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{y.im} \cdot x.im\right) \]
    6. Applied rewrites88.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x.re \cdot y.re - x.im \cdot y.im\\ \mathbf{if}\;t\_0 \leq \infty:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (- (* x.re y.re) (* x.im y.im))))
   (if (<= t_0 INFINITY) t_0 (fma y.re x.re (* y.im x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_re * y_46_re) - (x_46_im * y_46_im);
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0;
	} else {
		tmp = fma(y_46_re, x_46_re, (y_46_im * x_46_im));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_re * y_46_re) - Float64(x_46_im * y_46_im))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = t_0;
	else
		tmp = fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re * y$46$re), $MachinePrecision] - N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x.re \cdot y.re - x.im \cdot y.im\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) < +inf.0

    1. Initial program 100.0%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing

    if +inf.0 < (-.f64 (*.f64 x.re y.re) (*.f64 x.im y.im))

    1. Initial program 0.0%

      \[x.re \cdot y.re - x.im \cdot y.im \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \color{blue}{x.re \cdot y.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{y.re \cdot x.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
      5. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
      10. lower-neg.f6420.0

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(-y.im\right)} \cdot x.im\right) \]
    4. Applied rewrites20.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)} \]
    5. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)} \cdot x.im\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(0 - y.im\right)} \cdot x.im\right) \]
      3. flip3--N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\frac{{0}^{3} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)}} \cdot x.im\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\color{blue}{0} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      5. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\color{blue}{\mathsf{neg}\left({y.im}^{3}\right)}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      6. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{y.im}^{\left(\frac{3}{2}\right)} \cdot {y.im}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      7. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(y.im \cdot y.im\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      8. sqr-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\color{blue}{\left(\left(\mathsf{neg}\left(y.im\right)\right) \cdot \left(\mathsf{neg}\left(y.im\right)\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      9. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\left(\color{blue}{\left(-y.im\right)} \cdot \left(\mathsf{neg}\left(y.im\right)\right)\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      10. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\left(\left(-y.im\right) \cdot \color{blue}{\left(-y.im\right)}\right)}^{\left(\frac{3}{2}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      11. pow-prod-downN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(-y.im\right)}^{\left(\frac{3}{2}\right)} \cdot {\left(-y.im\right)}^{\left(\frac{3}{2}\right)}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      12. sqr-powN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{{\left(-y.im\right)}^{3}}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      13. lift-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left({\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}}^{3}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      14. cube-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left({y.im}^{3}\right)\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      15. sub0-negN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\color{blue}{\left(0 - {y.im}^{3}\right)}\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \frac{\mathsf{neg}\left(\left(\color{blue}{{0}^{3}} - {y.im}^{3}\right)\right)}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)} \cdot x.im\right) \]
      17. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(\frac{{0}^{3} - {y.im}^{3}}{0 \cdot 0 + \left(y.im \cdot y.im + 0 \cdot y.im\right)}\right)\right)} \cdot x.im\right) \]
      18. flip3--N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \left(\mathsf{neg}\left(\color{blue}{\left(0 - y.im\right)}\right)\right) \cdot x.im\right) \]
      19. neg-sub0N/A

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.im\right)\right)}\right)\right) \cdot x.im\right) \]
      20. remove-double-neg80.0

        \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{y.im} \cdot x.im\right) \]
    6. Applied rewrites80.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right) \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (fma y.re x.re (* (- y.im) x.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return fma(y_46_re, x_46_re, (-y_46_im * x_46_im));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return fma(y_46_re, x_46_re, Float64(Float64(-y_46_im) * x_46_im))
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * x$46$re + N[((-y$46$im) * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)
\end{array}
Derivation
  1. Initial program 98.0%

    \[x.re \cdot y.re - x.im \cdot y.im \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{x.re \cdot y.re - x.im \cdot y.im} \]
    2. sub-negN/A

      \[\leadsto \color{blue}{x.re \cdot y.re + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \color{blue}{x.re \cdot y.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{y.re \cdot x.re} + \left(\mathsf{neg}\left(x.im \cdot y.im\right)\right) \]
    5. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(x.im \cdot y.im\right)\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{x.im \cdot y.im}\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(y.re, x.re, \mathsf{neg}\left(\color{blue}{y.im \cdot x.im}\right)\right) \]
    8. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
    9. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.im}\right) \]
    10. lower-neg.f6498.4

      \[\leadsto \mathsf{fma}\left(y.re, x.re, \color{blue}{\left(-y.im\right)} \cdot x.im\right) \]
  4. Applied rewrites98.4%

    \[\leadsto \color{blue}{\mathsf{fma}\left(y.re, x.re, \left(-y.im\right) \cdot x.im\right)} \]
  5. Add Preprocessing

Alternative 6: 52.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \left(-x.im\right) \cdot y.im \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (- 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_im * y_46_im;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = -x_46im * y_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return -x_46_im * y_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return -x_46_im * y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(-x_46_im) * y_46_im)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = -x_46_im * y_46_im;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[((-x$46$im) * y$46$im), $MachinePrecision]
\begin{array}{l}

\\
\left(-x.im\right) \cdot y.im
\end{array}
Derivation
  1. Initial program 98.0%

    \[x.re \cdot y.re - x.im \cdot y.im \]
  2. Add Preprocessing
  3. Taylor expanded in x.re around 0

    \[\leadsto \color{blue}{-1 \cdot \left(x.im \cdot y.im\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
    2. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
    3. mul-1-negN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im \]
    4. lower-neg.f6454.8

      \[\leadsto \color{blue}{\left(-x.im\right)} \cdot y.im \]
  5. Applied rewrites54.8%

    \[\leadsto \color{blue}{\left(-x.im\right) \cdot y.im} \]
  6. Add Preprocessing

Alternative 7: 3.7% accurate, 2.3× speedup?

\[\begin{array}{l} \\ y.im \cdot x.im \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (* y.im x.im))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return y_46_im * x_46_im;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = y_46im * x_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return y_46_im * x_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return y_46_im * x_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(y_46_im * x_46_im)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = y_46_im * x_46_im;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$im * x$46$im), $MachinePrecision]
\begin{array}{l}

\\
y.im \cdot x.im
\end{array}
Derivation
  1. Initial program 98.0%

    \[x.re \cdot y.re - x.im \cdot y.im \]
  2. Add Preprocessing
  3. Taylor expanded in x.re around 0

    \[\leadsto \color{blue}{-1 \cdot \left(x.im \cdot y.im\right)} \]
  4. Step-by-step derivation
    1. associate-*r*N/A

      \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
    2. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(-1 \cdot x.im\right) \cdot y.im} \]
    3. mul-1-negN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x.im\right)\right)} \cdot y.im \]
    4. lower-neg.f6454.8

      \[\leadsto \color{blue}{\left(-x.im\right)} \cdot y.im \]
  5. Applied rewrites54.8%

    \[\leadsto \color{blue}{\left(-x.im\right) \cdot y.im} \]
  6. Step-by-step derivation
    1. Applied rewrites4.7%

      \[\leadsto \color{blue}{y.im \cdot x.im} \]
    2. Add Preprocessing

    Reproduce

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