Average Error: 37.8 → 13.7
Time: 28.5s
Precision: 64
Internal Precision: 3392
\[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^2 + im^2}^* - re\right)}\]

Error

Bits error versus re

Bits error versus im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 37.8

    \[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)}\]
  2. Applied simplify13.7

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

Runtime

Time bar (total: 28.5s)Debug logProfile

herbie shell --seed 2018207 +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)))))