Average Error: 29.9 → 0.1
Time: 34.1s
Precision: 64
Internal Precision: 4480
\[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re - im \cdot im} + re\right)}\]
\[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re + im} \cdot \sqrt{re - im} + re\right)}\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Initial program 29.9

    \[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re - im \cdot im} + re\right)}\]
  2. Using strategy rm
  3. Applied difference-of-squares29.9

    \[\leadsto 0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{\color{blue}{\left(re + im\right) \cdot \left(re - im\right)}} + re\right)}\]
  4. Applied sqrt-prod0.1

    \[\leadsto 0.5 \cdot \sqrt{2.0 \cdot \left(\color{blue}{\sqrt{re + im} \cdot \sqrt{re - im}} + re\right)}\]

Runtime

Time bar (total: 34.1s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +o rules:numerics
(FPCore (re im)
  :name "math.sqrt on complex, imaginary part, im greater than 0 branch"
  (* 0.5 (sqrt (* 2.0 (+ (sqrt (- (* re re) (* im im))) re)))))