Average Error: 31.3 → 0.4
Time: 46.0s
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.3

    \[\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. Simplified0.4

    \[\leadsto \color{blue}{\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 associate-/r/0.4

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

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

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

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

Reproduce

herbie shell --seed 2019016 +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: 44.6s)Debug log

sample1.1s

Algorithm
intervals
Results
941×(pre true 80)
457×(body nan 80)
256×(body real 80)
228×(body exit 10240)

simplify83.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
83.0ms
(/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0)))

prune27.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize26.0ms

Local error

Found 1 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
12×times-frac
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
pow1
associate-/l*
log-pow
add-exp-log
add-cbrt-cube
associate-/r*
add-log-exp
div-inv
log1p-expm1-u
div-exp
frac-2neg
clear-num
cbrt-undiv
expm1-log1p-u
Counts
1 → 33
Calls
1 calls:
Slowest
10.0ms
(/ (log (hypot re im)) (log base))

series138.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
138.0ms
(/ (log (hypot re im)) (log base))

simplify503.0ms

Counts
34 → 36
Calls
34 calls:
Slowest
275.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
107.0ms
(/ (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))) (* (* (log base) (log base)) (log base)))
18.0ms
(/ (log (/ 1 re)) (log (/ 1 base)))
17.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) (* (cbrt (log base)) (cbrt (log base))))
11.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) 1)

prune404.0ms

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 2 expressions with local error:

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

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
24×times-frac
20×associate-/r*
19×add-cube-cbrt
19×*-un-lft-identity
19×add-sqr-sqrt
10×pow1
log-pow
add-exp-log
add-cbrt-cube
associate-/l*
div-inv
add-log-exp
log1p-expm1-u
div-exp
frac-2neg
clear-num
rec-exp
expm1-log1p-u
inv-pow
pow-flip
associate-/r/
cbrt-undiv
Counts
2 → 66
Calls
2 calls:
Slowest
4.0ms
(/ (log base) (log (hypot re im)))
2.0ms
(/ 1 (/ (log base) (log (hypot re im))))

series316.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
167.0ms
(/ 1 (/ (log base) (log (hypot re im))))
149.0ms
(/ (log base) (log (hypot re im)))

simplify1.4s

Counts
56 → 72
Calls
56 calls:
Slowest
933.0ms
(* -1 (/ (- (log -1) (log (/ -1 base))) (log (/ -1 re))))
215.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
124.0ms
(/ (* (* (log base) (log base)) (log base)) (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))))
17.0ms
(/ (log (/ 1 re)) (log (/ 1 base)))
17.0ms
(/ (* (cbrt (log base)) (cbrt (log base))) (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))))

prune873.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize7.0ms

Local error

Found 2 expressions with local error:

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

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
add-exp-log
*-un-lft-identity
add-sqr-sqrt
log-prod
pow1
associate-*l*
associate-*r*
add-cbrt-cube
distribute-lft-in
associate-/r*
distribute-rgt-in
add-log-exp
div-inv
log1p-expm1-u
prod-exp
rec-exp
expm1-log1p-u
inv-pow
pow-flip
cbrt-unprod
*-commutative
log-pow
associate-*l/
pow-prod-down
frac-2neg
clear-num
Counts
2 → 47
Calls
2 calls:
Slowest
5.0ms
(* (/ 1 (log base)) (log (hypot re im)))
1.0ms
(/ 1 (log base))

series326.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
205.0ms
(/ 1 (log base))
121.0ms
(* (/ 1 (log base)) (log (hypot re im)))

simplify621.0ms

Counts
27 → 53
Calls
27 calls:
Slowest
238.0ms
(* (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))) (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))))
163.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
40.0ms
(/ 1 (- (log -1) (log (/ -1 base))))
22.0ms
(* (log (cbrt (hypot re im))) (/ 1 (log base)))
20.0ms
(+ (log (/ 1 (log base))) (log (log (hypot re im))))

prune707.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0b

localize1.0ms

Local error

Found 1 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
12×times-frac
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
pow1
associate-/l*
log-pow
add-exp-log
add-cbrt-cube
associate-/r*
add-log-exp
div-inv
log1p-expm1-u
div-exp
frac-2neg
clear-num
cbrt-undiv
expm1-log1p-u
Counts
1 → 33
Calls
1 calls:
Slowest
11.0ms
(/ (log (hypot re im)) (log base))

series113.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
113.0ms
(/ (log (hypot re im)) (log base))

simplify438.0ms

Counts
34 → 36
Calls
34 calls:
Slowest
201.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
92.0ms
(/ (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))) (* (* (log base) (log base)) (log base)))
20.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) 1)
17.0ms
(/ (log (/ 1 re)) (log (/ 1 base)))
16.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) (* (cbrt (log base)) (cbrt (log base))))

prune407.0ms

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0b

regimes457.0ms

Accuracy

0% (0.3b remaining)

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

bsearch1.0ms

end0.0ms

sample36.6s

Algorithm
intervals
Results
31577×(pre true 80)
15613×(body nan 80)
8000×(body real 80)
7964×(body exit 10240)