Average Error: 29.3 → 0.0
Time: 2.8s
Precision: 64
Internal Precision: 128
\[\sqrt{re \cdot re + im \cdot im}\]
\[\sqrt{re^2 + im^2}^*\]

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 29.3

    \[\sqrt{re \cdot re + im \cdot im}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\sqrt{re^2 + im^2}^*}\]
  3. Final simplification0.0

    \[\leadsto \sqrt{re^2 + im^2}^*\]

Reproduce

herbie shell --seed 2019002 +o rules:numerics
(FPCore (re im)
  :name "math.abs on complex"
  (sqrt (+ (* re re) (* im im))))

Details

Time bar (total: 2.4s)Debug log

sample31.0ms

Algorithm
intervals

simplify5.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

5.0ms
(sqrt (+ (* re re) (* im im)))

prune14.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize7.0ms

Local error

Found 1 expressions with local error:

0.0b
(hypot re im)

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
1 → 10
Calls

1 calls. Slowest were:

0.0ms
(hypot re im)

series38.0ms

Counts
1 → 3
Calls

1 calls. Slowest were:

37.0ms
(hypot re im)

simplify3.0ms

Counts
3 → 13
Calls

3 calls. Slowest were:

2.0ms
(* -1 re)
0.0ms
im
0.0ms
re

prune101.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize6.0ms

Local error

Found 4 expressions with local error:

0.6b
(* (sqrt (hypot re im)) (sqrt (hypot re im)))
0.0b
(sqrt (hypot re im))
0.0b
(sqrt (hypot re im))
0.0b
(hypot re im)

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

5.0ms
(* (sqrt (hypot re im)) (sqrt (hypot re im)))
1.0ms
(sqrt (hypot re im))
1.0ms
(sqrt (hypot re im))

series195.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

67.0ms
(sqrt (hypot re im))
55.0ms
(sqrt (hypot re im))
39.0ms
(hypot re im)
33.0ms
(* (sqrt (hypot re im)) (sqrt (hypot re im)))

simplify85.0ms

Counts
41 → 82
Calls

41 calls. Slowest were:

37.0ms
(* (* (* (sqrt (hypot re im)) (sqrt (hypot re im))) (sqrt (hypot re im))) (* (* (sqrt (hypot re im)) (sqrt (hypot re im))) (sqrt (hypot re im))))
3.0ms
(sqrt (* (cbrt (hypot re im)) (cbrt (hypot re im))))
2.0ms
(+ 1 1)

prune639.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes414.0ms

Accuracy

0% (0.0b remaining)

Error of 0.0b against oracle of 0.0b and baseline of 0.0b

bsearch0.0ms

end0.0ms

sample850.0ms

Algorithm
intervals