Average Error: 37.0 → 13.4
Time: 13.3s
Precision: 64
Internal Precision: 3648
\[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)}\]
\[0.5 \cdot \left(\sqrt{2.0} \cdot \sqrt{\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.0

    \[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)}\]
  2. Initial simplification13.1

    \[\leadsto 0.5 \cdot \sqrt{\left(\sqrt{re^2 + im^2}^* - re\right) \cdot 2.0}\]
  3. Using strategy rm
  4. Applied sqrt-prod13.4

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

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

Runtime

Time bar (total: 13.3s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes13.413.412.80.60%
herbie shell --seed 2018290 +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)))))