Average Error: 31.0 → 0.5
Time: 48.1s
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{1}{\log base} \cdot \frac{1}{\frac{1}{\log \left(\sqrt{re^2 + im^2}^*\right)}}\]

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

    \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re^2 + im^2}^*\right)}{\log base}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.4

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

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

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

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

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

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

Reproduce

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

sample1.1s

Algorithm
intervals

simplify42.0ms

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

prune29.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize25.0ms

Local error

Found 2 expressions with local error:

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

rewrite6.0ms

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

series112.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
87.0ms
(/ (log (hypot re im)) (log base))
25.0ms
(hypot re im)

simplify469.0ms

Counts
37 → 49
Calls
37 calls:
Slowest
250.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
103.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)))) (* (cbrt (log base)) (cbrt (log base))))
15.0ms
(/ (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))) 1)
8.0ms
(/ (log (/ 1 re)) (log (/ 1 base)))

prune631.0ms

Pruning

12 alts after pruning (12 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)

rewrite6.0ms

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

series323.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
201.0ms
(/ 1 (log base))
83.0ms
(* (log (hypot re im)) (/ 1 (log base)))
39.0ms
(hypot re im)

simplify643.0ms

Counts
25 → 61
Calls
25 calls:
Slowest
277.0ms
(* (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))) (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))))
222.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
41.0ms
(/ 1 (- (log -1) (log (/ -1 base))))
33.0ms
(+ (log (log (hypot re im))) (log (/ 1 (log base))))
29.0ms
(* (log (hypot re im)) (/ 1 (log base)))

prune653.0ms

Pruning

14 alts after pruning (13 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 3 expressions with local error:

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

rewrite12.0ms

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

series332.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
159.0ms
(/ (log base) (log (hypot re im)))
144.0ms
(/ 1 (/ (log base) (log (hypot re im))))
29.0ms
(hypot re im)

simplify1.5s

Counts
59 → 85
Calls
59 calls:
Slowest
1.0s
(* -1 (/ (- (log -1) (log (/ -1 base))) (log (/ -1 re))))
226.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
123.0ms
(/ (* (* (log base) (log base)) (log base)) (* (* (log (hypot re im)) (log (hypot re im))) (log (hypot re im))))
20.0ms
(/ (* (cbrt (log base)) (cbrt (log base))) (* (cbrt (log (hypot re im))) (cbrt (log (hypot re im)))))
16.0ms
(/ (* (cbrt (log base)) (cbrt (log base))) 1)

prune1.0s

Pruning

14 alts after pruning (13 fresh and 1 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Rules
16×add-cube-cbrt
16×times-frac
16×*-un-lft-identity
16×add-sqr-sqrt
14×add-exp-log
13×div-inv
11×associate-/r*
pow1
add-cbrt-cube
rec-exp
add-log-exp
associate-/l*
log1p-expm1-u
div-exp
expm1-log1p-u
frac-2neg
clear-num
inv-pow
pow-flip
associate-/l/
log-pow
associate-/r/
hypot-udef
cbrt-undiv
Counts
4 → 90
Calls
4 calls:
Slowest
8.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
2.0ms
(/ 1 (log (hypot re im)))
2.0ms
(/ 1 (log base))
0.0ms
(hypot re im)

series456.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
176.0ms
(/ 1 (log base))
162.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
79.0ms
(/ 1 (log (hypot re im)))
38.0ms
(hypot re im)

simplify2.1s

Counts
65 → 102
Calls
65 calls:
Slowest
1.1s
(/ (* (* (/ 1 (log base)) (/ 1 (log base))) (/ 1 (log base))) (* (* (/ 1 (log (hypot re im))) (/ 1 (log (hypot re im)))) (/ 1 (log (hypot re im)))))
203.0ms
(* -1 (/ (log (/ -1 re)) (- (log -1) (log (/ -1 base)))))
93.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
58.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))
57.0ms
(/ (/ 1 (log base)) (/ 1 (log (hypot re im))))

prune923.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0b

regimes427.0ms

Accuracy

0% (0.4b remaining)

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

bsearch2.0ms

end0.0ms

sample35.7s

Algorithm
intervals