Average Error: 31.0 → 0.4
Time: 1.1m
Precision: 64
Internal Precision: 128
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
\[\frac{\log \left(\sqrt{re^2 + im^2}^*\right)}{\log base}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.0

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
  2. Initial simplification0.4

    \[\leadsto \frac{\log \left(\sqrt{re^2 + im^2}^*\right)}{\log base}\]
  3. Using strategy rm
  4. Applied pow10.4

    \[\leadsto \frac{\log \color{blue}{\left({\left(\sqrt{re^2 + im^2}^*\right)}^{1}\right)}}{\log base}\]
  5. Applied log-pow0.4

    \[\leadsto \frac{\color{blue}{1 \cdot \log \left(\sqrt{re^2 + im^2}^*\right)}}{\log base}\]
  6. Applied associate-/l*0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\sqrt{re^2 + im^2}^*\right)}}}\]
  7. Using strategy rm
  8. Applied div-inv0.5

    \[\leadsto \frac{1}{\color{blue}{\log base \cdot \frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}}\]
  9. Applied associate-/r*0.5

    \[\leadsto \color{blue}{\frac{\frac{1}{\log base}}{\frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}}\]
  10. Using strategy rm
  11. Applied div-inv0.5

    \[\leadsto \frac{\frac{1}{\log base}}{\color{blue}{1 \cdot \frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}}\]
  12. Applied *-un-lft-identity0.5

    \[\leadsto \frac{\color{blue}{1 \cdot \frac{1}{\log base}}}{1 \cdot \frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}\]
  13. Applied times-frac0.5

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{1}{\log base}}{\frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}}\]
  14. Simplified0.5

    \[\leadsto \color{blue}{1} \cdot \frac{\frac{1}{\log base}}{\frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}\]
  15. Simplified0.4

    \[\leadsto 1 \cdot \color{blue}{\frac{\log \left(\sqrt{re^2 + im^2}^*\right)}{\log base}}\]
  16. Final simplification0.4

    \[\leadsto \frac{\log \left(\sqrt{re^2 + im^2}^*\right)}{\log base}\]

Reproduce

herbie shell --seed 2018365 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, real part"
  (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0))))

Details

Time bar (total: 12.9s)Debug log

start1.6s

Algorithm
intervals

setup484.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize27.0ms

Local error

Found 2 expressions with local error:

0.4b
(/ (log (hypot re im)) (log base))
0.0b
(hypot re im)

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
2 → 43
Calls

2 calls. Slowest were:

10.0ms
(/ (log (hypot re im)) (log base))
0.0ms
(hypot re im)

series166.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

126.0ms
(/ (log (hypot re im)) (log base))
40.0ms
(hypot re im)

simplify518.0ms

Counts
37 → 49
Calls

37 calls. Slowest were:

234.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
155.0ms
(/ (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))) (* (* (log base) (log base)) (log base)))
26.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) (* (cbrt (log base)) (cbrt (log base))))

prune577.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 3 expressions with local error:

0.3b
(/ (log base) (log (hypot re im)))
0.2b
(/ 1 (/ (log base) (log (hypot re im))))
0.0b
(hypot re im)

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 76
Calls

3 calls. Slowest were:

7.0ms
(/ (log base) (log (hypot re im)))
3.0ms
(/ 1 (/ (log base) (log (hypot re im))))
0.0ms
(hypot re im)

series320.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

156.0ms
(/ (log base) (log (hypot re im)))
133.0ms
(/ 1 (/ (log base) (log (hypot re im))))
31.0ms
(hypot re im)

simplify1.8s

Counts
59 → 85
Calls

59 calls. Slowest were:

1.2s
(* -1 (/ (- (log -1) (log (/ -1 base))) (log (/ -1 re))))
235.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
104.0ms
(/ (* (* (log base) (log base)) (log base)) (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))))

prune1000.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 3 expressions with local error:

0.4b
(* (log (hypot re im)) (/ 1 (log base)))
0.3b
(/ 1 (log base))
0.0b
(hypot re im)

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 52
Calls

3 calls. Slowest were:

9.0ms
(* (log (hypot re im)) (/ 1 (log base)))
2.0ms
(/ 1 (log base))
0.0ms
(hypot re im)

series324.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

181.0ms
(/ 1 (log base))
113.0ms
(* (log (hypot re im)) (/ 1 (log base)))
30.0ms
(hypot re im)

simplify665.0ms

Counts
25 → 61
Calls

25 calls. Slowest were:

316.0ms
(* (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))) (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))))
201.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
52.0ms
(/ 1 (- (log -1) (log (/ -1 base))))

prune729.0ms

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
0.3b
(/ 1 (log (hypot re im)))
0.3b
(/ 1 (log base))
0.0b
(hypot re im)

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 90
Calls

4 calls. Slowest were:

5.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
1.0ms
(/ 1 (log (hypot re im)))
1.0ms
(/ 1 (log base))

series476.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

229.0ms
(/ 1 (log base))
126.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
80.0ms
(/ 1 (log (hypot re im)))
40.0ms
(hypot re im)

simplify2.2s

Counts
65 → 102
Calls

65 calls. Slowest were:

1.2s
(/ (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))) (* (* (/ 1 (log (hypot re im))) (/ 1 (log (hypot re im)))) (/ 1 (log (hypot re im)))))
213.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
99.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))

prune1.3s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

regimes611.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms