Average Error: 37.5 → 13.3
Time: 13.1s
Precision: 64
Internal Precision: 3648
\[0.5 \cdot \sqrt{2.0 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)}\]
\[\sqrt{\left(\sqrt{re^2 + im^2}^* - re\right) \cdot 2.0} \cdot 0.5\]

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.5

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

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

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

Runtime

Time bar (total: 13.1s)Debug logProfile

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