math.cube on complex, imaginary part

?

Percentage Accurate: 81.9% → 99.3%
Time: 8.1s
Precision: binary64
Cost: 7305

?

\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
\[\begin{array}{l} \mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3 - {x.im}^{3}\\ \end{array} \]
(FPCore (x.re x.im)
 :precision binary64
 (+
  (* (- (* x.re x.re) (* x.im x.im)) x.im)
  (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
(FPCore (x.re x.im)
 :precision binary64
 (if (or (<= x.im -1.25e+117) (not (<= x.im 4e+94)))
   (+ (* x.im (* (- x.re x.im) (+ x.im x.re))) (+ x.im x.im))
   (- (* (* x.re (* x.im x.re)) 3.0) (pow x.im 3.0))))
double code(double x_46_re, double x_46_im) {
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -1.25e+117) || !(x_46_im <= 4e+94)) {
		tmp = (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re))) + (x_46_im + x_46_im);
	} else {
		tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - pow(x_46_im, 3.0);
	}
	return tmp;
}
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
end function
real(8) function code(x_46re, x_46im)
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8) :: tmp
    if ((x_46im <= (-1.25d+117)) .or. (.not. (x_46im <= 4d+94))) then
        tmp = (x_46im * ((x_46re - x_46im) * (x_46im + x_46re))) + (x_46im + x_46im)
    else
        tmp = ((x_46re * (x_46im * x_46re)) * 3.0d0) - (x_46im ** 3.0d0)
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
public static double code(double x_46_re, double x_46_im) {
	double tmp;
	if ((x_46_im <= -1.25e+117) || !(x_46_im <= 4e+94)) {
		tmp = (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re))) + (x_46_im + x_46_im);
	} else {
		tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - Math.pow(x_46_im, 3.0);
	}
	return tmp;
}
def code(x_46_re, x_46_im):
	return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
def code(x_46_re, x_46_im):
	tmp = 0
	if (x_46_im <= -1.25e+117) or not (x_46_im <= 4e+94):
		tmp = (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re))) + (x_46_im + x_46_im)
	else:
		tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - math.pow(x_46_im, 3.0)
	return tmp
function code(x_46_re, x_46_im)
	return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re))
end
function code(x_46_re, x_46_im)
	tmp = 0.0
	if ((x_46_im <= -1.25e+117) || !(x_46_im <= 4e+94))
		tmp = Float64(Float64(x_46_im * Float64(Float64(x_46_re - x_46_im) * Float64(x_46_im + x_46_re))) + Float64(x_46_im + x_46_im));
	else
		tmp = Float64(Float64(Float64(x_46_re * Float64(x_46_im * x_46_re)) * 3.0) - (x_46_im ^ 3.0));
	end
	return tmp
end
function tmp = code(x_46_re, x_46_im)
	tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
end
function tmp_2 = code(x_46_re, x_46_im)
	tmp = 0.0;
	if ((x_46_im <= -1.25e+117) || ~((x_46_im <= 4e+94)))
		tmp = (x_46_im * ((x_46_re - x_46_im) * (x_46_im + x_46_re))) + (x_46_im + x_46_im);
	else
		tmp = ((x_46_re * (x_46_im * x_46_re)) * 3.0) - (x_46_im ^ 3.0);
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.25e+117], N[Not[LessEqual[x$46$im, 4e+94]], $MachinePrecision]], N[(N[(x$46$im * N[(N[(x$46$re - x$46$im), $MachinePrecision] * N[(x$46$im + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$im + x$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision]]
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\

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


\end{array}

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.

Herbie found 12 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original81.9%
Target90.8%
Herbie99.3%
\[\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right) \]

Derivation?

  1. Split input into 2 regimes
  2. if x.im < -1.24999999999999996e117 or 4.0000000000000001e94 < x.im

    1. Initial program 68.9%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    2. Applied egg-rr86.5%

      \[\leadsto \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.im + x.im\right)} \]
      Step-by-step derivation

      [Start]68.9%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]

      *-commutative [<=]68.9%

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

      flip-+ [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) - \left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}} \cdot x.re \]

      +-inverses [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{\color{blue}{0}}{x.re \cdot x.im - x.re \cdot x.im} \cdot x.re \]

      +-inverses [<=]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{\color{blue}{x.im \cdot x.im - x.im \cdot x.im}}{x.re \cdot x.im - x.re \cdot x.im} \cdot x.re \]

      +-inverses [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{0}} \cdot x.re \]

      +-inverses [<=]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \cdot x.re \]

      flip-+ [<=]79.7%

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

      *-commutative [<=]79.7%

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

      distribute-lft-in [=>]79.7%

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

      flip-+ [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\frac{\left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right) - \left(x.re \cdot x.im\right) \cdot \left(x.re \cdot x.im\right)}{x.re \cdot x.im - x.re \cdot x.im}} \]

      +-inverses [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{\color{blue}{0}}{x.re \cdot x.im - x.re \cdot x.im} \]

      +-inverses [<=]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{\color{blue}{x.im \cdot x.im - x.im \cdot x.im}}{x.re \cdot x.im - x.re \cdot x.im} \]

      +-inverses [=>]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{0}} \]

      +-inverses [<=]0.0%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \frac{x.im \cdot x.im - x.im \cdot x.im}{\color{blue}{x.im - x.im}} \]

      flip-+ [<=]86.5%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \color{blue}{\left(x.im + x.im\right)} \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(\left(x.re - x.im\right) \cdot \left(x.re + x.im\right)\right)} \cdot x.im + \left(x.im + x.im\right) \]
      Step-by-step derivation

      [Start]86.5%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.im + x.im\right) \]

      difference-of-squares [=>]100.0%

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

      *-commutative [=>]100.0%

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

    if -1.24999999999999996e117 < x.im < 4.0000000000000001e94

    1. Initial program 92.1%

      \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]
    2. Simplified99.8%

      \[\leadsto \color{blue}{\left(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 - {x.im}^{3}} \]
      Step-by-step derivation

      [Start]92.1%

      \[ \left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re \]

      +-commutative [=>]92.1%

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

      *-commutative [=>]92.1%

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

      sub-neg [=>]92.1%

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

      distribute-lft-in [=>]92.1%

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

      associate-+r+ [=>]92.1%

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

      distribute-rgt-neg-out [=>]92.1%

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

      unsub-neg [=>]92.1%

      \[ \color{blue}{\left(\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re + x.im \cdot \left(x.re \cdot x.re\right)\right) - x.im \cdot \left(x.im \cdot x.im\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3 - {x.im}^{3}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy99.3%
Cost7305
\[\begin{array}{l} \mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.re \cdot \left(x.im \cdot x.re\right)\right) \cdot 3 - {x.im}^{3}\\ \end{array} \]
Alternative 2
Accuracy99.3%
Cost7305
\[\begin{array}{l} \mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(\left(x.im \cdot x.re\right) \cdot 3\right) - {x.im}^{3}\\ \end{array} \]
Alternative 3
Accuracy99.3%
Cost7305
\[\begin{array}{l} \mathbf{if}\;x.im \leq -1.25 \cdot 10^{+117} \lor \neg \left(x.im \leq 4 \cdot 10^{+94}\right):\\ \;\;\;\;x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im \cdot x.re\right) \cdot \left(x.re \cdot 3\right) - {x.im}^{3}\\ \end{array} \]
Alternative 4
Accuracy98.0%
Cost1744
\[\begin{array}{l} t_0 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\ t_1 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{if}\;x.im \leq -5 \cdot 10^{+157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.im \leq -1.25 \cdot 10^{-98}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 7.8 \cdot 10^{-109}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 3000000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy90.7%
Cost1228
\[\begin{array}{l} t_0 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{if}\;x.im \leq -22000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 2.1 \cdot 10^{-19}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 310000:\\ \;\;\;\;\left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Accuracy91.1%
Cost1228
\[\begin{array}{l} t_0 := x.im \cdot \left(\left(x.re - x.im\right) \cdot \left(x.im + x.re\right)\right) + \left(x.im + x.im\right)\\ \mathbf{if}\;x.im \leq -22000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.im \leq 1.35 \cdot 10^{-82}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \mathbf{elif}\;x.im \leq 200000000:\\ \;\;\;\;x.im \cdot x.re + x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Accuracy79.0%
Cost978
\[\begin{array}{l} \mathbf{if}\;x.re \leq -5.6 \cdot 10^{+167} \lor \neg \left(x.re \leq -2.1 \cdot 10^{+140}\right) \land \left(x.re \leq -1.1 \cdot 10^{+93} \lor \neg \left(x.re \leq 2.05 \cdot 10^{-82}\right)\right):\\ \;\;\;\;x.re \cdot \left(\left(x.im \cdot x.re\right) \cdot 3\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \end{array} \]
Alternative 8
Accuracy79.0%
Cost976
\[\begin{array}{l} t_0 := x.re \cdot \left(\left(x.im \cdot x.re\right) \cdot 3\right)\\ t_1 := \left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \mathbf{if}\;x.re \leq -5.6 \cdot 10^{+167}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq -6 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x.re \leq -1.1 \cdot 10^{+93}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x.re \leq 2.05 \cdot 10^{-82}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\ \end{array} \]
Alternative 9
Accuracy71.6%
Cost649
\[\begin{array}{l} \mathbf{if}\;x.re \leq -5.8 \cdot 10^{+167} \lor \neg \left(x.re \leq 2.4 \cdot 10^{+124}\right):\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x.im \cdot x.im\right) \cdot \left(-x.im\right)\\ \end{array} \]
Alternative 10
Accuracy35.5%
Cost452
\[\begin{array}{l} \mathbf{if}\;x.im \leq 2.8 \cdot 10^{+137}:\\ \;\;\;\;x.im \cdot \left(x.re \cdot x.re\right)\\ \mathbf{else}:\\ \;\;\;\;x.im \cdot x.re\\ \end{array} \]
Alternative 11
Accuracy20.3%
Cost192
\[x.im \cdot x.re \]
Alternative 12
Accuracy2.7%
Cost64
\[-3 \]

Reproduce?

herbie shell --seed 2023165 
(FPCore (x.re x.im)
  :name "math.cube on complex, imaginary part"
  :precision binary64

  :herbie-target
  (+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))

  (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))