Average Error: 6.7 → 0.3
Time: 3.5m
Precision: 64
Internal Precision: 320
\[\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\]
\[\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.7
Target0.3
Herbie0.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. Initial program 6.7

    \[\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. Using strategy rm
  3. Applied difference-of-squares6.7

    \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  4. Applied associate-*l*0.3

    \[\leadsto \color{blue}{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  5. Final simplification0.3

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

Runtime

Time bar (total: 3.5m)Debug logProfile

BaselineHerbieOracleSpan%
Regimes0.30.30.00.20%
herbie shell --seed 2018296 
(FPCore (x.re x.im)
  :name "math.cube on complex, imaginary part"

  :herbie-target
  (+ (* (* x.re x.im) (* 2 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)))