Average Error: 30.3 → 16.7
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}\]
\[\begin{array}{l} \mathbf{if}\;re \le -6.766300819866214 \cdot 10^{+134}:\\ \;\;\;\;\log \left(-re\right) \cdot \frac{1}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(im \cdot im + re \cdot re\right)}}\\ \end{array}\]

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. Split input into 2 regimes
  2. if re < -6.766300819866214e+134

    1. Initial program 57.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 simplification57.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac57.0

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified57.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \color{blue}{1}\]
    6. Using strategy rm
    7. Applied div-inv57.0

      \[\leadsto \color{blue}{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \frac{1}{\log base}\right)} \cdot 1\]
    8. Taylor expanded around -inf 7.9

      \[\leadsto \left(\log \color{blue}{\left(-1 \cdot re\right)} \cdot \frac{1}{\log base}\right) \cdot 1\]
    9. Simplified7.9

      \[\leadsto \left(\log \color{blue}{\left(-re\right)} \cdot \frac{1}{\log base}\right) \cdot 1\]

    if -6.766300819866214e+134 < re

    1. Initial program 20.1

      \[\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 simplification20.1

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac20.1

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified20.1

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \color{blue}{1}\]
    6. Using strategy rm
    7. Applied pow1/220.1

      \[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{\frac{1}{2}}\right)}}{\log base} \cdot 1\]
    8. Applied log-pow20.1

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

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}} \cdot 1\]
    10. Using strategy rm
    11. Applied +-commutative20.1

      \[\leadsto \frac{\frac{1}{2}}{\frac{\log base}{\log \color{blue}{\left(im \cdot im + re \cdot re\right)}}} \cdot 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -6.766300819866214 \cdot 10^{+134}:\\ \;\;\;\;\log \left(-re\right) \cdot \frac{1}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(im \cdot im + re \cdot re\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2018362 
(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: 15.4s)Debug log

start1.3s

Algorithm
intervals

setup18.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.3b

localize25.0ms

Local error

Found 4 expressions with local error:

26.0b
(sqrt (+ (* re re) (* im im)))
0.5b
(* (log base) (log base))
0.3b
(* (log (sqrt (+ (* re re) (* im im)))) (log base))
0.3b
(/ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (log base) (log base)))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

24.0ms
(* (log (sqrt (+ (* re re) (* im im)))) (log base))
9.0ms
(/ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (log base) (log base)))
4.0ms
(* (log base) (log base))

series392.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

155.0ms
(* (log base) (log base))
108.0ms
(* (log (sqrt (+ (* re re) (* im im)))) (log base))
107.0ms
(/ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (log base) (log base)))
21.0ms
(sqrt (+ (* re re) (* im im)))

simplify3.6s

Counts
49 → 86
Calls

49 calls. Slowest were:

472.0ms
(- (+ (log (log (sqrt (+ (* re re) (* im im))))) (log (log base))) (log (* (log base) (log base))))
429.0ms
(- (+ (log (log (sqrt (+ (* re re) (* im im))))) (log (log base))) (+ (log (log base)) (log (log base))))
427.0ms
(- (log (* (log (sqrt (+ (* re re) (* im im)))) (log base))) (log (* (log base) (log base))))

prune1.3s

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 7.6b

localize11.0ms

Local error

Found 3 expressions with local error:

26.0b
(sqrt (+ (* re re) (* im im)))
0.4b
(/ (log (sqrt (+ (* re re) (* im im)))) (log base))
0.0b
(+ (* re re) (* im im))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
3 → 62
Calls

3 calls. Slowest were:

10.0ms
(/ (log (sqrt (+ (* re re) (* im im)))) (log base))
3.0ms
(sqrt (+ (* re re) (* im im)))
2.0ms
(+ (* re re) (* im im))

series157.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

114.0ms
(/ (log (sqrt (+ (* re re) (* im im)))) (log base))
21.0ms
(+ (* re re) (* im im))
21.0ms
(sqrt (+ (* re re) (* im im)))

simplify1.0s

Counts
55 → 71
Calls

55 calls. Slowest were:

184.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
173.0ms
(sqrt (- (* (* re re) (* re re)) (* (* im im) (* im im))))
162.0ms
(/ (log (sqrt (- (* (* re re) (* re re)) (* (* im im) (* im im))))) (log base))

prune1.0s

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 7.6b

localize8.0ms

Local error

Found 4 expressions with local error:

26.0b
(sqrt (+ (* re re) (* im im)))
0.4b
(* (log (sqrt (+ (* re re) (* im im)))) (/ 1 (log base)))
0.3b
(/ 1 (log base))
0.0b
(+ (* re re) (* im im))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

5.0ms
(* (log (sqrt (+ (* re re) (* im im)))) (/ 1 (log base)))
2.0ms
(sqrt (+ (* re re) (* im im)))
2.0ms
(+ (* re re) (* im im))

series330.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

165.0ms
(/ 1 (log base))
111.0ms
(* (log (sqrt (+ (* re re) (* im im)))) (/ 1 (log base)))
29.0ms
(sqrt (+ (* re re) (* im im)))
24.0ms
(+ (* re re) (* im im))

simplify980.0ms

Counts
35 → 76
Calls

35 calls. Slowest were:

440.0ms
(* (* (* (log (sqrt (+ (* re re) (* im im)))) (log (sqrt (+ (* re re) (* im im))))) (log (sqrt (+ (* re re) (* im im))))) (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))))
139.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
131.0ms
(sqrt (- (* (* re re) (* re re)) (* (* im im) (* im im))))

prune1.5s

Pruning

15 alts after pruning (14 fresh and 1 done)

Merged error: 7.6b

localize12.0ms

Local error

Found 4 expressions with local error:

27.0b
(log (+ (* re re) (* im im)))
0.4b
(/ (log base) (log (+ (* re re) (* im im))))
0.3b
(/ 1/2 (/ (log base) (log (+ (* re re) (* im im)))))
0.0b
(+ (* re re) (* im im))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 83
Calls

4 calls. Slowest were:

4.0ms
(+ (* re re) (* im im))
4.0ms
(/ (log base) (log (+ (* re re) (* im im))))
2.0ms
(log (+ (* re re) (* im im)))

series325.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

143.0ms
(/ (log base) (log (+ (* re re) (* im im))))
117.0ms
(/ 1/2 (/ (log base) (log (+ (* re re) (* im im)))))
45.0ms
(log (+ (* re re) (* im im)))
20.0ms
(+ (* re re) (* im im))

simplify1.1s

Counts
68 → 95
Calls

68 calls. Slowest were:

274.0ms
(* -1/2 (/ (- (log -1) (log (/ -1 base))) (log (/ -1 re))))
153.0ms
(log (- (* (* re re) (* re re)) (* (* im im) (* im im))))
118.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))

prune1.3s

Pruning

14 alts after pruning (14 fresh and 0 done)

Merged error: 7.5b

regimes663.0ms

Accuracy

59% (9.4b remaining)

Error of 16.7b against oracle of 7.3b and baseline of 30.3b

bsearch206.0ms