_multiplyComplex, imaginary part

Percentage Accurate: 99.3% → 99.6%
Time: 4.0s
Alternatives: 4
Speedup: 0.4×

Specification

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

\\
x.re \cdot y.im + x.im \cdot y.re
\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 4 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.1× speedup?

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

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

    \[x.re \cdot y.im + x.im \cdot y.re \]
  2. Step-by-step derivation
    1. fma-define99.2%

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

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

Alternative 2: 67.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x.im \leq -1.6 \cdot 10^{+53} \lor \neg \left(x.im \leq -9.4 \cdot 10^{+36}\right) \land \left(x.im \leq -8 \cdot 10^{+31} \lor \neg \left(x.im \leq -1.75 \cdot 10^{+20}\right) \land \left(x.im \leq -7.1 \cdot 10^{+14} \lor \neg \left(x.im \leq -3900000\right) \land \left(x.im \leq -3550000 \lor \neg \left(x.im \leq -108000\right) \land \left(x.im \leq -11.5 \lor \neg \left(x.im \leq -5.3 \cdot 10^{-21}\right) \land \left(x.im \leq -3.7 \cdot 10^{-22} \lor \neg \left(x.im \leq -2.1 \cdot 10^{-27}\right) \land \left(x.im \leq -2.4 \cdot 10^{-29} \lor \neg \left(x.im \leq -1.6 \cdot 10^{-33}\right) \land \left(x.im \leq -2.7 \cdot 10^{-35} \lor \neg \left(x.im \leq -6.5 \cdot 10^{-46}\right) \land \left(x.im \leq -2.2 \cdot 10^{-46} \lor \neg \left(x.im \leq -3.05 \cdot 10^{-49}\right) \land \left(x.im \leq -1.5 \cdot 10^{-52} \lor \neg \left(x.im \leq -1.55 \cdot 10^{-54}\right) \land \left(x.im \leq -8.2 \cdot 10^{-64} \lor \neg \left(x.im \leq -1.15 \cdot 10^{-83}\right) \land \left(x.im \leq -7.5 \cdot 10^{-95} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-96}\right) \land \left(x.im \leq -2.15 \cdot 10^{-96} \lor \neg \left(x.im \leq -1.65 \cdot 10^{-103}\right) \land \left(x.im \leq -7 \cdot 10^{-119} \lor \neg \left(x.im \leq -1.38 \cdot 10^{-126}\right) \land \left(x.im \leq -1.22 \cdot 10^{-126} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-165}\right) \land \left(x.im \leq -1.15 \cdot 10^{-167} \lor \neg \left(x.im \leq -1.25 \cdot 10^{-191}\right) \land \left(x.im \leq -1.22 \cdot 10^{-191} \lor \neg \left(x.im \leq -4.4 \cdot 10^{-292}\right) \land \left(x.im \leq -4.2 \cdot 10^{-292} \lor \neg \left(x.im \leq -1.2 \cdot 10^{-298}\right) \land \left(x.im \leq -1.85 \cdot 10^{-301} \lor \neg \left(x.im \leq 6.6 \cdot 10^{-295}\right) \land \left(x.im \leq 6.8 \cdot 10^{-295} \lor \neg \left(x.im \leq 1.15 \cdot 10^{-266}\right) \land \left(x.im \leq 1.16 \cdot 10^{-266} \lor \neg \left(x.im \leq 1.7 \cdot 10^{-230}\right) \land \left(x.im \leq 1.75 \cdot 10^{-230} \lor \neg \left(x.im \leq 3.6 \cdot 10^{-202}\right) \land \left(x.im \leq 3.7 \cdot 10^{-202} \lor \neg \left(x.im \leq 3.3 \cdot 10^{-180}\right) \land \left(x.im \leq 4.2 \cdot 10^{-159} \lor \neg \left(x.im \leq 3.8 \cdot 10^{-138}\right) \land \left(x.im \leq 3.3 \cdot 10^{-102} \lor \neg \left(x.im \leq 2.75 \cdot 10^{-73} \lor \neg \left(x.im \leq 2.2 \cdot 10^{-72}\right) \land \left(x.im \leq 1.22 \cdot 10^{-46} \lor \neg \left(x.im \leq 4.6 \cdot 10^{+45}\right) \land \left(x.im \leq 2 \cdot 10^{+46} \lor \neg \left(x.im \leq 4.25 \cdot 10^{+52}\right) \land \left(x.im \leq 4 \cdot 10^{+53} \lor \neg \left(x.im \leq 5.5 \cdot 10^{+82}\right) \land x.im \leq 6.6 \cdot 10^{+82}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;x.im \cdot y.re\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot y.im\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (or (<= x.im -1.6e+53)
         (and (not (<= x.im -9.4e+36))
              (or (<= x.im -8e+31)
                  (and (not (<= x.im -1.75e+20))
                       (or (<= x.im -7.1e+14)
                           (and (not (<= x.im -3900000.0))
                                (or (<= x.im -3550000.0)
                                    (and (not (<= x.im -108000.0))
                                         (or (<= x.im -11.5)
                                             (and (not (<= x.im -5.3e-21))
                                                  (or (<= x.im -3.7e-22)
                                                      (and (not
                                                            (<= x.im -2.1e-27))
                                                           (or (<=
                                                                x.im
                                                                -2.4e-29)
                                                               (and (not
                                                                     (<=
                                                                      x.im
                                                                      -1.6e-33))
                                                                    (or (<=
                                                                         x.im
                                                                         -2.7e-35)
                                                                        (and (not
                                                                              (<=
                                                                               x.im
                                                                               -6.5e-46))
                                                                             (or (<=
                                                                                  x.im
                                                                                  -2.2e-46)
                                                                                 (and (not
                                                                                       (<=
                                                                                        x.im
                                                                                        -3.05e-49))
                                                                                      (or (<=
                                                                                           x.im
                                                                                           -1.5e-52)
                                                                                          (and (not
                                                                                                (<=
                                                                                                 x.im
                                                                                                 -1.55e-54))
                                                                                               (or (<=
                                                                                                    x.im
                                                                                                    -8.2e-64)
                                                                                                   (and (not
                                                                                                         (<=
                                                                                                          x.im
                                                                                                          -1.15e-83))
                                                                                                        (or (<=
                                                                                                             x.im
                                                                                                             -7.5e-95)
                                                                                                            (and (not
                                                                                                                  (<=
                                                                                                                   x.im
                                                                                                                   -3.7e-96))
                                                                                                                 (or (<=
                                                                                                                      x.im
                                                                                                                      -2.15e-96)
                                                                                                                     (and (not
                                                                                                                           (<=
                                                                                                                            x.im
                                                                                                                            -1.65e-103))
                                                                                                                          (or (<=
                                                                                                                               x.im
                                                                                                                               -7e-119)
                                                                                                                              (and (not
                                                                                                                                    (<=
                                                                                                                                     x.im
                                                                                                                                     -1.38e-126))
                                                                                                                                   (or (<=
                                                                                                                                        x.im
                                                                                                                                        -1.22e-126)
                                                                                                                                       (and (not
                                                                                                                                             (<=
                                                                                                                                              x.im
                                                                                                                                              -3.7e-165))
                                                                                                                                            (or (<=
                                                                                                                                                 x.im
                                                                                                                                                 -1.15e-167)
                                                                                                                                                (and (not
                                                                                                                                                      (<=
                                                                                                                                                       x.im
                                                                                                                                                       -1.25e-191))
                                                                                                                                                     (or (<=
                                                                                                                                                          x.im
                                                                                                                                                          -1.22e-191)
                                                                                                                                                         (and (not
                                                                                                                                                               (<=
                                                                                                                                                                x.im
                                                                                                                                                                -4.4e-292))
                                                                                                                                                              (or (<=
                                                                                                                                                                   x.im
                                                                                                                                                                   -4.2e-292)
                                                                                                                                                                  (and (not
                                                                                                                                                                        (<=
                                                                                                                                                                         x.im
                                                                                                                                                                         -1.2e-298))
                                                                                                                                                                       (or (<=
                                                                                                                                                                            x.im
                                                                                                                                                                            -1.85e-301)
                                                                                                                                                                           (and (not
                                                                                                                                                                                 (<=
                                                                                                                                                                                  x.im
                                                                                                                                                                                  6.6e-295))
                                                                                                                                                                                (or (<=
                                                                                                                                                                                     x.im
                                                                                                                                                                                     6.8e-295)
                                                                                                                                                                                    (and (not
                                                                                                                                                                                          (<=
                                                                                                                                                                                           x.im
                                                                                                                                                                                           1.15e-266))
                                                                                                                                                                                         (or (<=
                                                                                                                                                                                              x.im
                                                                                                                                                                                              1.16e-266)
                                                                                                                                                                                             (and (not
                                                                                                                                                                                                   (<=
                                                                                                                                                                                                    x.im
                                                                                                                                                                                                    1.7e-230))
                                                                                                                                                                                                  (or (<=
                                                                                                                                                                                                       x.im
                                                                                                                                                                                                       1.75e-230)
                                                                                                                                                                                                      (and (not
                                                                                                                                                                                                            (<=
                                                                                                                                                                                                             x.im
                                                                                                                                                                                                             3.6e-202))
                                                                                                                                                                                                           (or (<=
                                                                                                                                                                                                                x.im
                                                                                                                                                                                                                3.7e-202)
                                                                                                                                                                                                               (and (not
                                                                                                                                                                                                                     (<=
                                                                                                                                                                                                                      x.im
                                                                                                                                                                                                                      3.3e-180))
                                                                                                                                                                                                                    (or (<=
                                                                                                                                                                                                                         x.im
                                                                                                                                                                                                                         4.2e-159)
                                                                                                                                                                                                                        (and (not
                                                                                                                                                                                                                              (<=
                                                                                                                                                                                                                               x.im
                                                                                                                                                                                                                               3.8e-138))
                                                                                                                                                                                                                             (or (<=
                                                                                                                                                                                                                                  x.im
                                                                                                                                                                                                                                  3.3e-102)
                                                                                                                                                                                                                                 (not
                                                                                                                                                                                                                                  (or (<=
                                                                                                                                                                                                                                       x.im
                                                                                                                                                                                                                                       2.75e-73)
                                                                                                                                                                                                                                      (and (not
                                                                                                                                                                                                                                            (<=
                                                                                                                                                                                                                                             x.im
                                                                                                                                                                                                                                             2.2e-72))
                                                                                                                                                                                                                                           (or (<=
                                                                                                                                                                                                                                                x.im
                                                                                                                                                                                                                                                1.22e-46)
                                                                                                                                                                                                                                               (and (not
                                                                                                                                                                                                                                                     (<=
                                                                                                                                                                                                                                                      x.im
                                                                                                                                                                                                                                                      4.6e+45))
                                                                                                                                                                                                                                                    (or (<=
                                                                                                                                                                                                                                                         x.im
                                                                                                                                                                                                                                                         2e+46)
                                                                                                                                                                                                                                                        (and (not
                                                                                                                                                                                                                                                              (<=
                                                                                                                                                                                                                                                               x.im
                                                                                                                                                                                                                                                               4.25e+52))
                                                                                                                                                                                                                                                             (or (<=
                                                                                                                                                                                                                                                                  x.im
                                                                                                                                                                                                                                                                  4e+53)
                                                                                                                                                                                                                                                                 (and (not
                                                                                                                                                                                                                                                                       (<=
                                                                                                                                                                                                                                                                        x.im
                                                                                                                                                                                                                                                                        5.5e+82))
                                                                                                                                                                                                                                                                      (<=
                                                                                                                                                                                                                                                                       x.im
                                                                                                                                                                                                                                                                       6.6e+82)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
   (* x.im y.re)
   (* x.re 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_im <= -1.6e+53) || (!(x_46_im <= -9.4e+36) && ((x_46_im <= -8e+31) || (!(x_46_im <= -1.75e+20) && ((x_46_im <= -7.1e+14) || (!(x_46_im <= -3900000.0) && ((x_46_im <= -3550000.0) || (!(x_46_im <= -108000.0) && ((x_46_im <= -11.5) || (!(x_46_im <= -5.3e-21) && ((x_46_im <= -3.7e-22) || (!(x_46_im <= -2.1e-27) && ((x_46_im <= -2.4e-29) || (!(x_46_im <= -1.6e-33) && ((x_46_im <= -2.7e-35) || (!(x_46_im <= -6.5e-46) && ((x_46_im <= -2.2e-46) || (!(x_46_im <= -3.05e-49) && ((x_46_im <= -1.5e-52) || (!(x_46_im <= -1.55e-54) && ((x_46_im <= -8.2e-64) || (!(x_46_im <= -1.15e-83) && ((x_46_im <= -7.5e-95) || (!(x_46_im <= -3.7e-96) && ((x_46_im <= -2.15e-96) || (!(x_46_im <= -1.65e-103) && ((x_46_im <= -7e-119) || (!(x_46_im <= -1.38e-126) && ((x_46_im <= -1.22e-126) || (!(x_46_im <= -3.7e-165) && ((x_46_im <= -1.15e-167) || (!(x_46_im <= -1.25e-191) && ((x_46_im <= -1.22e-191) || (!(x_46_im <= -4.4e-292) && ((x_46_im <= -4.2e-292) || (!(x_46_im <= -1.2e-298) && ((x_46_im <= -1.85e-301) || (!(x_46_im <= 6.6e-295) && ((x_46_im <= 6.8e-295) || (!(x_46_im <= 1.15e-266) && ((x_46_im <= 1.16e-266) || (!(x_46_im <= 1.7e-230) && ((x_46_im <= 1.75e-230) || (!(x_46_im <= 3.6e-202) && ((x_46_im <= 3.7e-202) || (!(x_46_im <= 3.3e-180) && ((x_46_im <= 4.2e-159) || (!(x_46_im <= 3.8e-138) && ((x_46_im <= 3.3e-102) || !((x_46_im <= 2.75e-73) || (!(x_46_im <= 2.2e-72) && ((x_46_im <= 1.22e-46) || (!(x_46_im <= 4.6e+45) && ((x_46_im <= 2e+46) || (!(x_46_im <= 4.25e+52) && ((x_46_im <= 4e+53) || (!(x_46_im <= 5.5e+82) && (x_46_im <= 6.6e+82)))))))))))))))))))))))))))))))))))))))))))))))))))))))))) {
		tmp = x_46_im * y_46_re;
	} else {
		tmp = x_46_re * y_46_im;
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((x_46im <= (-1.6d+53)) .or. (.not. (x_46im <= (-9.4d+36))) .and. (x_46im <= (-8d+31)) .or. (.not. (x_46im <= (-1.75d+20))) .and. (x_46im <= (-7.1d+14)) .or. (.not. (x_46im <= (-3900000.0d0))) .and. (x_46im <= (-3550000.0d0)) .or. (.not. (x_46im <= (-108000.0d0))) .and. (x_46im <= (-11.5d0)) .or. (.not. (x_46im <= (-5.3d-21))) .and. (x_46im <= (-3.7d-22)) .or. (.not. (x_46im <= (-2.1d-27))) .and. (x_46im <= (-2.4d-29)) .or. (.not. (x_46im <= (-1.6d-33))) .and. (x_46im <= (-2.7d-35)) .or. (.not. (x_46im <= (-6.5d-46))) .and. (x_46im <= (-2.2d-46)) .or. (.not. (x_46im <= (-3.05d-49))) .and. (x_46im <= (-1.5d-52)) .or. (.not. (x_46im <= (-1.55d-54))) .and. (x_46im <= (-8.2d-64)) .or. (.not. (x_46im <= (-1.15d-83))) .and. (x_46im <= (-7.5d-95)) .or. (.not. (x_46im <= (-3.7d-96))) .and. (x_46im <= (-2.15d-96)) .or. (.not. (x_46im <= (-1.65d-103))) .and. (x_46im <= (-7d-119)) .or. (.not. (x_46im <= (-1.38d-126))) .and. (x_46im <= (-1.22d-126)) .or. (.not. (x_46im <= (-3.7d-165))) .and. (x_46im <= (-1.15d-167)) .or. (.not. (x_46im <= (-1.25d-191))) .and. (x_46im <= (-1.22d-191)) .or. (.not. (x_46im <= (-4.4d-292))) .and. (x_46im <= (-4.2d-292)) .or. (.not. (x_46im <= (-1.2d-298))) .and. (x_46im <= (-1.85d-301)) .or. (.not. (x_46im <= 6.6d-295)) .and. (x_46im <= 6.8d-295) .or. (.not. (x_46im <= 1.15d-266)) .and. (x_46im <= 1.16d-266) .or. (.not. (x_46im <= 1.7d-230)) .and. (x_46im <= 1.75d-230) .or. (.not. (x_46im <= 3.6d-202)) .and. (x_46im <= 3.7d-202) .or. (.not. (x_46im <= 3.3d-180)) .and. (x_46im <= 4.2d-159) .or. (.not. (x_46im <= 3.8d-138)) .and. (x_46im <= 3.3d-102) .or. (.not. (x_46im <= 2.75d-73) .or. (.not. (x_46im <= 2.2d-72)) .and. (x_46im <= 1.22d-46) .or. (.not. (x_46im <= 4.6d+45)) .and. (x_46im <= 2d+46) .or. (.not. (x_46im <= 4.25d+52)) .and. (x_46im <= 4d+53) .or. (.not. (x_46im <= 5.5d+82)) .and. (x_46im <= 6.6d+82))) then
        tmp = x_46im * y_46re
    else
        tmp = x_46re * y_46im
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if ((x_46_im <= -1.6e+53) || (!(x_46_im <= -9.4e+36) && ((x_46_im <= -8e+31) || (!(x_46_im <= -1.75e+20) && ((x_46_im <= -7.1e+14) || (!(x_46_im <= -3900000.0) && ((x_46_im <= -3550000.0) || (!(x_46_im <= -108000.0) && ((x_46_im <= -11.5) || (!(x_46_im <= -5.3e-21) && ((x_46_im <= -3.7e-22) || (!(x_46_im <= -2.1e-27) && ((x_46_im <= -2.4e-29) || (!(x_46_im <= -1.6e-33) && ((x_46_im <= -2.7e-35) || (!(x_46_im <= -6.5e-46) && ((x_46_im <= -2.2e-46) || (!(x_46_im <= -3.05e-49) && ((x_46_im <= -1.5e-52) || (!(x_46_im <= -1.55e-54) && ((x_46_im <= -8.2e-64) || (!(x_46_im <= -1.15e-83) && ((x_46_im <= -7.5e-95) || (!(x_46_im <= -3.7e-96) && ((x_46_im <= -2.15e-96) || (!(x_46_im <= -1.65e-103) && ((x_46_im <= -7e-119) || (!(x_46_im <= -1.38e-126) && ((x_46_im <= -1.22e-126) || (!(x_46_im <= -3.7e-165) && ((x_46_im <= -1.15e-167) || (!(x_46_im <= -1.25e-191) && ((x_46_im <= -1.22e-191) || (!(x_46_im <= -4.4e-292) && ((x_46_im <= -4.2e-292) || (!(x_46_im <= -1.2e-298) && ((x_46_im <= -1.85e-301) || (!(x_46_im <= 6.6e-295) && ((x_46_im <= 6.8e-295) || (!(x_46_im <= 1.15e-266) && ((x_46_im <= 1.16e-266) || (!(x_46_im <= 1.7e-230) && ((x_46_im <= 1.75e-230) || (!(x_46_im <= 3.6e-202) && ((x_46_im <= 3.7e-202) || (!(x_46_im <= 3.3e-180) && ((x_46_im <= 4.2e-159) || (!(x_46_im <= 3.8e-138) && ((x_46_im <= 3.3e-102) || !((x_46_im <= 2.75e-73) || (!(x_46_im <= 2.2e-72) && ((x_46_im <= 1.22e-46) || (!(x_46_im <= 4.6e+45) && ((x_46_im <= 2e+46) || (!(x_46_im <= 4.25e+52) && ((x_46_im <= 4e+53) || (!(x_46_im <= 5.5e+82) && (x_46_im <= 6.6e+82)))))))))))))))))))))))))))))))))))))))))))))))))))))))))) {
		tmp = x_46_im * y_46_re;
	} else {
		tmp = x_46_re * y_46_im;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	tmp = 0
	if (x_46_im <= -1.6e+53) or (not (x_46_im <= -9.4e+36) and ((x_46_im <= -8e+31) or (not (x_46_im <= -1.75e+20) and ((x_46_im <= -7.1e+14) or (not (x_46_im <= -3900000.0) and ((x_46_im <= -3550000.0) or (not (x_46_im <= -108000.0) and ((x_46_im <= -11.5) or (not (x_46_im <= -5.3e-21) and ((x_46_im <= -3.7e-22) or (not (x_46_im <= -2.1e-27) and ((x_46_im <= -2.4e-29) or (not (x_46_im <= -1.6e-33) and ((x_46_im <= -2.7e-35) or (not (x_46_im <= -6.5e-46) and ((x_46_im <= -2.2e-46) or (not (x_46_im <= -3.05e-49) and ((x_46_im <= -1.5e-52) or (not (x_46_im <= -1.55e-54) and ((x_46_im <= -8.2e-64) or (not (x_46_im <= -1.15e-83) and ((x_46_im <= -7.5e-95) or (not (x_46_im <= -3.7e-96) and ((x_46_im <= -2.15e-96) or (not (x_46_im <= -1.65e-103) and ((x_46_im <= -7e-119) or (not (x_46_im <= -1.38e-126) and ((x_46_im <= -1.22e-126) or (not (x_46_im <= -3.7e-165) and ((x_46_im <= -1.15e-167) or (not (x_46_im <= -1.25e-191) and ((x_46_im <= -1.22e-191) or (not (x_46_im <= -4.4e-292) and ((x_46_im <= -4.2e-292) or (not (x_46_im <= -1.2e-298) and ((x_46_im <= -1.85e-301) or (not (x_46_im <= 6.6e-295) and ((x_46_im <= 6.8e-295) or (not (x_46_im <= 1.15e-266) and ((x_46_im <= 1.16e-266) or (not (x_46_im <= 1.7e-230) and ((x_46_im <= 1.75e-230) or (not (x_46_im <= 3.6e-202) and ((x_46_im <= 3.7e-202) or (not (x_46_im <= 3.3e-180) and ((x_46_im <= 4.2e-159) or (not (x_46_im <= 3.8e-138) and ((x_46_im <= 3.3e-102) or not ((x_46_im <= 2.75e-73) or (not (x_46_im <= 2.2e-72) and ((x_46_im <= 1.22e-46) or (not (x_46_im <= 4.6e+45) and ((x_46_im <= 2e+46) or (not (x_46_im <= 4.25e+52) and ((x_46_im <= 4e+53) or (not (x_46_im <= 5.5e+82) and (x_46_im <= 6.6e+82))))))))))))))))))))))))))))))))))))))))))))))))))))))))):
		tmp = x_46_im * y_46_re
	else:
		tmp = x_46_re * y_46_im
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if ((x_46_im <= -1.6e+53) || (!(x_46_im <= -9.4e+36) && ((x_46_im <= -8e+31) || (!(x_46_im <= -1.75e+20) && ((x_46_im <= -7.1e+14) || (!(x_46_im <= -3900000.0) && ((x_46_im <= -3550000.0) || (!(x_46_im <= -108000.0) && ((x_46_im <= -11.5) || (!(x_46_im <= -5.3e-21) && ((x_46_im <= -3.7e-22) || (!(x_46_im <= -2.1e-27) && ((x_46_im <= -2.4e-29) || (!(x_46_im <= -1.6e-33) && ((x_46_im <= -2.7e-35) || (!(x_46_im <= -6.5e-46) && ((x_46_im <= -2.2e-46) || (!(x_46_im <= -3.05e-49) && ((x_46_im <= -1.5e-52) || (!(x_46_im <= -1.55e-54) && ((x_46_im <= -8.2e-64) || (!(x_46_im <= -1.15e-83) && ((x_46_im <= -7.5e-95) || (!(x_46_im <= -3.7e-96) && ((x_46_im <= -2.15e-96) || (!(x_46_im <= -1.65e-103) && ((x_46_im <= -7e-119) || (!(x_46_im <= -1.38e-126) && ((x_46_im <= -1.22e-126) || (!(x_46_im <= -3.7e-165) && ((x_46_im <= -1.15e-167) || (!(x_46_im <= -1.25e-191) && ((x_46_im <= -1.22e-191) || (!(x_46_im <= -4.4e-292) && ((x_46_im <= -4.2e-292) || (!(x_46_im <= -1.2e-298) && ((x_46_im <= -1.85e-301) || (!(x_46_im <= 6.6e-295) && ((x_46_im <= 6.8e-295) || (!(x_46_im <= 1.15e-266) && ((x_46_im <= 1.16e-266) || (!(x_46_im <= 1.7e-230) && ((x_46_im <= 1.75e-230) || (!(x_46_im <= 3.6e-202) && ((x_46_im <= 3.7e-202) || (!(x_46_im <= 3.3e-180) && ((x_46_im <= 4.2e-159) || (!(x_46_im <= 3.8e-138) && ((x_46_im <= 3.3e-102) || !((x_46_im <= 2.75e-73) || (!(x_46_im <= 2.2e-72) && ((x_46_im <= 1.22e-46) || (!(x_46_im <= 4.6e+45) && ((x_46_im <= 2e+46) || (!(x_46_im <= 4.25e+52) && ((x_46_im <= 4e+53) || (!(x_46_im <= 5.5e+82) && (x_46_im <= 6.6e+82))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
		tmp = Float64(x_46_im * y_46_re);
	else
		tmp = Float64(x_46_re * y_46_im);
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0;
	if ((x_46_im <= -1.6e+53) || (~((x_46_im <= -9.4e+36)) && ((x_46_im <= -8e+31) || (~((x_46_im <= -1.75e+20)) && ((x_46_im <= -7.1e+14) || (~((x_46_im <= -3900000.0)) && ((x_46_im <= -3550000.0) || (~((x_46_im <= -108000.0)) && ((x_46_im <= -11.5) || (~((x_46_im <= -5.3e-21)) && ((x_46_im <= -3.7e-22) || (~((x_46_im <= -2.1e-27)) && ((x_46_im <= -2.4e-29) || (~((x_46_im <= -1.6e-33)) && ((x_46_im <= -2.7e-35) || (~((x_46_im <= -6.5e-46)) && ((x_46_im <= -2.2e-46) || (~((x_46_im <= -3.05e-49)) && ((x_46_im <= -1.5e-52) || (~((x_46_im <= -1.55e-54)) && ((x_46_im <= -8.2e-64) || (~((x_46_im <= -1.15e-83)) && ((x_46_im <= -7.5e-95) || (~((x_46_im <= -3.7e-96)) && ((x_46_im <= -2.15e-96) || (~((x_46_im <= -1.65e-103)) && ((x_46_im <= -7e-119) || (~((x_46_im <= -1.38e-126)) && ((x_46_im <= -1.22e-126) || (~((x_46_im <= -3.7e-165)) && ((x_46_im <= -1.15e-167) || (~((x_46_im <= -1.25e-191)) && ((x_46_im <= -1.22e-191) || (~((x_46_im <= -4.4e-292)) && ((x_46_im <= -4.2e-292) || (~((x_46_im <= -1.2e-298)) && ((x_46_im <= -1.85e-301) || (~((x_46_im <= 6.6e-295)) && ((x_46_im <= 6.8e-295) || (~((x_46_im <= 1.15e-266)) && ((x_46_im <= 1.16e-266) || (~((x_46_im <= 1.7e-230)) && ((x_46_im <= 1.75e-230) || (~((x_46_im <= 3.6e-202)) && ((x_46_im <= 3.7e-202) || (~((x_46_im <= 3.3e-180)) && ((x_46_im <= 4.2e-159) || (~((x_46_im <= 3.8e-138)) && ((x_46_im <= 3.3e-102) || ~(((x_46_im <= 2.75e-73) || (~((x_46_im <= 2.2e-72)) && ((x_46_im <= 1.22e-46) || (~((x_46_im <= 4.6e+45)) && ((x_46_im <= 2e+46) || (~((x_46_im <= 4.25e+52)) && ((x_46_im <= 4e+53) || (~((x_46_im <= 5.5e+82)) && (x_46_im <= 6.6e+82)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
		tmp = x_46_im * y_46_re;
	else
		tmp = x_46_re * y_46_im;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[x$46$im, -1.6e+53], And[N[Not[LessEqual[x$46$im, -9.4e+36]], $MachinePrecision], Or[LessEqual[x$46$im, -8e+31], And[N[Not[LessEqual[x$46$im, -1.75e+20]], $MachinePrecision], Or[LessEqual[x$46$im, -7.1e+14], And[N[Not[LessEqual[x$46$im, -3900000.0]], $MachinePrecision], Or[LessEqual[x$46$im, -3550000.0], And[N[Not[LessEqual[x$46$im, -108000.0]], $MachinePrecision], Or[LessEqual[x$46$im, -11.5], And[N[Not[LessEqual[x$46$im, -5.3e-21]], $MachinePrecision], Or[LessEqual[x$46$im, -3.7e-22], And[N[Not[LessEqual[x$46$im, -2.1e-27]], $MachinePrecision], Or[LessEqual[x$46$im, -2.4e-29], And[N[Not[LessEqual[x$46$im, -1.6e-33]], $MachinePrecision], Or[LessEqual[x$46$im, -2.7e-35], And[N[Not[LessEqual[x$46$im, -6.5e-46]], $MachinePrecision], Or[LessEqual[x$46$im, -2.2e-46], And[N[Not[LessEqual[x$46$im, -3.05e-49]], $MachinePrecision], Or[LessEqual[x$46$im, -1.5e-52], And[N[Not[LessEqual[x$46$im, -1.55e-54]], $MachinePrecision], Or[LessEqual[x$46$im, -8.2e-64], And[N[Not[LessEqual[x$46$im, -1.15e-83]], $MachinePrecision], Or[LessEqual[x$46$im, -7.5e-95], And[N[Not[LessEqual[x$46$im, -3.7e-96]], $MachinePrecision], Or[LessEqual[x$46$im, -2.15e-96], And[N[Not[LessEqual[x$46$im, -1.65e-103]], $MachinePrecision], Or[LessEqual[x$46$im, -7e-119], And[N[Not[LessEqual[x$46$im, -1.38e-126]], $MachinePrecision], Or[LessEqual[x$46$im, -1.22e-126], And[N[Not[LessEqual[x$46$im, -3.7e-165]], $MachinePrecision], Or[LessEqual[x$46$im, -1.15e-167], And[N[Not[LessEqual[x$46$im, -1.25e-191]], $MachinePrecision], Or[LessEqual[x$46$im, -1.22e-191], And[N[Not[LessEqual[x$46$im, -4.4e-292]], $MachinePrecision], Or[LessEqual[x$46$im, -4.2e-292], And[N[Not[LessEqual[x$46$im, -1.2e-298]], $MachinePrecision], Or[LessEqual[x$46$im, -1.85e-301], And[N[Not[LessEqual[x$46$im, 6.6e-295]], $MachinePrecision], Or[LessEqual[x$46$im, 6.8e-295], And[N[Not[LessEqual[x$46$im, 1.15e-266]], $MachinePrecision], Or[LessEqual[x$46$im, 1.16e-266], And[N[Not[LessEqual[x$46$im, 1.7e-230]], $MachinePrecision], Or[LessEqual[x$46$im, 1.75e-230], And[N[Not[LessEqual[x$46$im, 3.6e-202]], $MachinePrecision], Or[LessEqual[x$46$im, 3.7e-202], And[N[Not[LessEqual[x$46$im, 3.3e-180]], $MachinePrecision], Or[LessEqual[x$46$im, 4.2e-159], And[N[Not[LessEqual[x$46$im, 3.8e-138]], $MachinePrecision], Or[LessEqual[x$46$im, 3.3e-102], N[Not[Or[LessEqual[x$46$im, 2.75e-73], And[N[Not[LessEqual[x$46$im, 2.2e-72]], $MachinePrecision], Or[LessEqual[x$46$im, 1.22e-46], And[N[Not[LessEqual[x$46$im, 4.6e+45]], $MachinePrecision], Or[LessEqual[x$46$im, 2e+46], And[N[Not[LessEqual[x$46$im, 4.25e+52]], $MachinePrecision], Or[LessEqual[x$46$im, 4e+53], And[N[Not[LessEqual[x$46$im, 5.5e+82]], $MachinePrecision], LessEqual[x$46$im, 6.6e+82]]]]]]]]]], $MachinePrecision]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]], N[(x$46$im * y$46$re), $MachinePrecision], N[(x$46$re * y$46$im), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.6 \cdot 10^{+53} \lor \neg \left(x.im \leq -9.4 \cdot 10^{+36}\right) \land \left(x.im \leq -8 \cdot 10^{+31} \lor \neg \left(x.im \leq -1.75 \cdot 10^{+20}\right) \land \left(x.im \leq -7.1 \cdot 10^{+14} \lor \neg \left(x.im \leq -3900000\right) \land \left(x.im \leq -3550000 \lor \neg \left(x.im \leq -108000\right) \land \left(x.im \leq -11.5 \lor \neg \left(x.im \leq -5.3 \cdot 10^{-21}\right) \land \left(x.im \leq -3.7 \cdot 10^{-22} \lor \neg \left(x.im \leq -2.1 \cdot 10^{-27}\right) \land \left(x.im \leq -2.4 \cdot 10^{-29} \lor \neg \left(x.im \leq -1.6 \cdot 10^{-33}\right) \land \left(x.im \leq -2.7 \cdot 10^{-35} \lor \neg \left(x.im \leq -6.5 \cdot 10^{-46}\right) \land \left(x.im \leq -2.2 \cdot 10^{-46} \lor \neg \left(x.im \leq -3.05 \cdot 10^{-49}\right) \land \left(x.im \leq -1.5 \cdot 10^{-52} \lor \neg \left(x.im \leq -1.55 \cdot 10^{-54}\right) \land \left(x.im \leq -8.2 \cdot 10^{-64} \lor \neg \left(x.im \leq -1.15 \cdot 10^{-83}\right) \land \left(x.im \leq -7.5 \cdot 10^{-95} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-96}\right) \land \left(x.im \leq -2.15 \cdot 10^{-96} \lor \neg \left(x.im \leq -1.65 \cdot 10^{-103}\right) \land \left(x.im \leq -7 \cdot 10^{-119} \lor \neg \left(x.im \leq -1.38 \cdot 10^{-126}\right) \land \left(x.im \leq -1.22 \cdot 10^{-126} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-165}\right) \land \left(x.im \leq -1.15 \cdot 10^{-167} \lor \neg \left(x.im \leq -1.25 \cdot 10^{-191}\right) \land \left(x.im \leq -1.22 \cdot 10^{-191} \lor \neg \left(x.im \leq -4.4 \cdot 10^{-292}\right) \land \left(x.im \leq -4.2 \cdot 10^{-292} \lor \neg \left(x.im \leq -1.2 \cdot 10^{-298}\right) \land \left(x.im \leq -1.85 \cdot 10^{-301} \lor \neg \left(x.im \leq 6.6 \cdot 10^{-295}\right) \land \left(x.im \leq 6.8 \cdot 10^{-295} \lor \neg \left(x.im \leq 1.15 \cdot 10^{-266}\right) \land \left(x.im \leq 1.16 \cdot 10^{-266} \lor \neg \left(x.im \leq 1.7 \cdot 10^{-230}\right) \land \left(x.im \leq 1.75 \cdot 10^{-230} \lor \neg \left(x.im \leq 3.6 \cdot 10^{-202}\right) \land \left(x.im \leq 3.7 \cdot 10^{-202} \lor \neg \left(x.im \leq 3.3 \cdot 10^{-180}\right) \land \left(x.im \leq 4.2 \cdot 10^{-159} \lor \neg \left(x.im \leq 3.8 \cdot 10^{-138}\right) \land \left(x.im \leq 3.3 \cdot 10^{-102} \lor \neg \left(x.im \leq 2.75 \cdot 10^{-73} \lor \neg \left(x.im \leq 2.2 \cdot 10^{-72}\right) \land \left(x.im \leq 1.22 \cdot 10^{-46} \lor \neg \left(x.im \leq 4.6 \cdot 10^{+45}\right) \land \left(x.im \leq 2 \cdot 10^{+46} \lor \neg \left(x.im \leq 4.25 \cdot 10^{+52}\right) \land \left(x.im \leq 4 \cdot 10^{+53} \lor \neg \left(x.im \leq 5.5 \cdot 10^{+82}\right) \land x.im \leq 6.6 \cdot 10^{+82}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\
\;\;\;\;x.im \cdot y.re\\

\mathbf{else}:\\
\;\;\;\;x.re \cdot y.im\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x.im < -1.6e53 or -9.39999999999999978e36 < x.im < -7.9999999999999997e31 or -1.75e20 < x.im < -7.1e14 or -3.9e6 < x.im < -3.55e6 or -108000 < x.im < -11.5 or -5.2999999999999999e-21 < x.im < -3.7e-22 or -2.10000000000000015e-27 < x.im < -2.39999999999999992e-29 or -1.59999999999999988e-33 < x.im < -2.6999999999999997e-35 or -6.49999999999999966e-46 < x.im < -2.2000000000000001e-46 or -3.04999999999999982e-49 < x.im < -1.5e-52 or -1.55000000000000002e-54 < x.im < -8.2000000000000001e-64 or -1.14999999999999995e-83 < x.im < -7.5000000000000003e-95 or -3.69999999999999986e-96 < x.im < -2.1499999999999999e-96 or -1.64999999999999995e-103 < x.im < -7e-119 or -1.38000000000000003e-126 < x.im < -1.21999999999999996e-126 or -3.70000000000000001e-165 < x.im < -1.1500000000000001e-167 or -1.25e-191 < x.im < -1.22e-191 or -4.40000000000000023e-292 < x.im < -4.19999999999999977e-292 or -1.19999999999999994e-298 < x.im < -1.8499999999999999e-301 or 6.5999999999999997e-295 < x.im < 6.80000000000000015e-295 or 1.14999999999999998e-266 < x.im < 1.16000000000000009e-266 or 1.7e-230 < x.im < 1.74999999999999994e-230 or 3.6000000000000001e-202 < x.im < 3.69999999999999991e-202 or 3.29999999999999998e-180 < x.im < 4.1999999999999998e-159 or 3.8000000000000002e-138 < x.im < 3.3e-102 or 2.75000000000000003e-73 < x.im < 2.20000000000000002e-72 or 1.22e-46 < x.im < 4.60000000000000025e45 or 2e46 < x.im < 4.24999999999999997e52 or 4e53 < x.im < 5.49999999999999997e82 or 6.5999999999999997e82 < x.im

    1. Initial program 96.3%

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

      \[\leadsto \color{blue}{x.im \cdot y.re} \]

    if -1.6e53 < x.im < -9.39999999999999978e36 or -7.9999999999999997e31 < x.im < -1.75e20 or -7.1e14 < x.im < -3.9e6 or -3.55e6 < x.im < -108000 or -11.5 < x.im < -5.2999999999999999e-21 or -3.7e-22 < x.im < -2.10000000000000015e-27 or -2.39999999999999992e-29 < x.im < -1.59999999999999988e-33 or -2.6999999999999997e-35 < x.im < -6.49999999999999966e-46 or -2.2000000000000001e-46 < x.im < -3.04999999999999982e-49 or -1.5e-52 < x.im < -1.55000000000000002e-54 or -8.2000000000000001e-64 < x.im < -1.14999999999999995e-83 or -7.5000000000000003e-95 < x.im < -3.69999999999999986e-96 or -2.1499999999999999e-96 < x.im < -1.64999999999999995e-103 or -7e-119 < x.im < -1.38000000000000003e-126 or -1.21999999999999996e-126 < x.im < -3.70000000000000001e-165 or -1.1500000000000001e-167 < x.im < -1.25e-191 or -1.22e-191 < x.im < -4.40000000000000023e-292 or -4.19999999999999977e-292 < x.im < -1.19999999999999994e-298 or -1.8499999999999999e-301 < x.im < 6.5999999999999997e-295 or 6.80000000000000015e-295 < x.im < 1.14999999999999998e-266 or 1.16000000000000009e-266 < x.im < 1.7e-230 or 1.74999999999999994e-230 < x.im < 3.6000000000000001e-202 or 3.69999999999999991e-202 < x.im < 3.29999999999999998e-180 or 4.1999999999999998e-159 < x.im < 3.8000000000000002e-138 or 3.3e-102 < x.im < 2.75000000000000003e-73 or 2.20000000000000002e-72 < x.im < 1.22e-46 or 4.60000000000000025e45 < x.im < 2e46 or 4.24999999999999997e52 < x.im < 4e53 or 5.49999999999999997e82 < x.im < 6.5999999999999997e82

    1. Initial program 98.9%

      \[x.re \cdot y.im + x.im \cdot y.re \]
    2. Add Preprocessing
    3. Taylor expanded in x.re around inf 83.6%

      \[\leadsto \color{blue}{x.re \cdot y.im} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.6 \cdot 10^{+53} \lor \neg \left(x.im \leq -9.4 \cdot 10^{+36}\right) \land \left(x.im \leq -8 \cdot 10^{+31} \lor \neg \left(x.im \leq -1.75 \cdot 10^{+20}\right) \land \left(x.im \leq -7.1 \cdot 10^{+14} \lor \neg \left(x.im \leq -3900000\right) \land \left(x.im \leq -3550000 \lor \neg \left(x.im \leq -108000\right) \land \left(x.im \leq -11.5 \lor \neg \left(x.im \leq -5.3 \cdot 10^{-21}\right) \land \left(x.im \leq -3.7 \cdot 10^{-22} \lor \neg \left(x.im \leq -2.1 \cdot 10^{-27}\right) \land \left(x.im \leq -2.4 \cdot 10^{-29} \lor \neg \left(x.im \leq -1.6 \cdot 10^{-33}\right) \land \left(x.im \leq -2.7 \cdot 10^{-35} \lor \neg \left(x.im \leq -6.5 \cdot 10^{-46}\right) \land \left(x.im \leq -2.2 \cdot 10^{-46} \lor \neg \left(x.im \leq -3.05 \cdot 10^{-49}\right) \land \left(x.im \leq -1.5 \cdot 10^{-52} \lor \neg \left(x.im \leq -1.55 \cdot 10^{-54}\right) \land \left(x.im \leq -8.2 \cdot 10^{-64} \lor \neg \left(x.im \leq -1.15 \cdot 10^{-83}\right) \land \left(x.im \leq -7.5 \cdot 10^{-95} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-96}\right) \land \left(x.im \leq -2.15 \cdot 10^{-96} \lor \neg \left(x.im \leq -1.65 \cdot 10^{-103}\right) \land \left(x.im \leq -7 \cdot 10^{-119} \lor \neg \left(x.im \leq -1.38 \cdot 10^{-126}\right) \land \left(x.im \leq -1.22 \cdot 10^{-126} \lor \neg \left(x.im \leq -3.7 \cdot 10^{-165}\right) \land \left(x.im \leq -1.15 \cdot 10^{-167} \lor \neg \left(x.im \leq -1.25 \cdot 10^{-191}\right) \land \left(x.im \leq -1.22 \cdot 10^{-191} \lor \neg \left(x.im \leq -4.4 \cdot 10^{-292}\right) \land \left(x.im \leq -4.2 \cdot 10^{-292} \lor \neg \left(x.im \leq -1.2 \cdot 10^{-298}\right) \land \left(x.im \leq -1.85 \cdot 10^{-301} \lor \neg \left(x.im \leq 6.6 \cdot 10^{-295}\right) \land \left(x.im \leq 6.8 \cdot 10^{-295} \lor \neg \left(x.im \leq 1.15 \cdot 10^{-266}\right) \land \left(x.im \leq 1.16 \cdot 10^{-266} \lor \neg \left(x.im \leq 1.7 \cdot 10^{-230}\right) \land \left(x.im \leq 1.75 \cdot 10^{-230} \lor \neg \left(x.im \leq 3.6 \cdot 10^{-202}\right) \land \left(x.im \leq 3.7 \cdot 10^{-202} \lor \neg \left(x.im \leq 3.3 \cdot 10^{-180}\right) \land \left(x.im \leq 4.2 \cdot 10^{-159} \lor \neg \left(x.im \leq 3.8 \cdot 10^{-138}\right) \land \left(x.im \leq 3.3 \cdot 10^{-102} \lor \neg \left(x.im \leq 2.75 \cdot 10^{-73} \lor \neg \left(x.im \leq 2.2 \cdot 10^{-72}\right) \land \left(x.im \leq 1.22 \cdot 10^{-46} \lor \neg \left(x.im \leq 4.6 \cdot 10^{+45}\right) \land \left(x.im \leq 2 \cdot 10^{+46} \lor \neg \left(x.im \leq 4.25 \cdot 10^{+52}\right) \land \left(x.im \leq 4 \cdot 10^{+53} \lor \neg \left(x.im \leq 5.5 \cdot 10^{+82}\right) \land x.im \leq 6.6 \cdot 10^{+82}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;x.im \cdot y.re\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot y.im\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.6% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x.im \cdot y.re\\


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

    1. Initial program 100.0%

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{x.im \cdot y.re} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \cdot y.re + x.re \cdot y.im \leq \infty:\\ \;\;\;\;x.im \cdot y.re + x.re \cdot y.im\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot y.re\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 51.1% accurate, 2.3× speedup?

\[\begin{array}{l} \\ x.im \cdot y.re \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (* x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im * y_46_re;
}
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_46re
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_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return x_46_im * y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(x_46_im * y_46_re)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = x_46_im * y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im * y$46$re), $MachinePrecision]
\begin{array}{l}

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

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

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

Reproduce

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