\[\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}\]
Test:
math.log/2 on complex, real part
Bits:
128 bits
Bits error versus re
Bits error versus im
Bits error versus base
Time: 23.4 s
Input Error: 14.9
Output Error: 5.9
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -7.479207f+13 \\ \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{im}^2 + re \cdot re}}\right) \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base} & \text{when } im \le 4804.8477f0 \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -7.479207f+13

    1. Started with
      \[\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}\]
      25.7
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      25.7
    3. Using strategy rm
      25.7
    4. Applied add-exp-log to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \color{red}{\log base}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \color{blue}{e^{\log \left(\log base\right)}}}\]
      28.6
    5. Applied add-exp-log to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{\log base} \cdot e^{\log \left(\log base\right)}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{e^{\log \left(\log base\right)}} \cdot e^{\log \left(\log base\right)}}\]
      28.7
    6. Applied prod-exp to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{e^{\log \left(\log base\right)} \cdot e^{\log \left(\log base\right)}}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{e^{\log \left(\log base\right) + \log \left(\log base\right)}}}\]
      28.7
    7. Applied add-exp-log to get
      \[\frac{\color{red}{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}}{e^{\log \left(\log base\right) + \log \left(\log base\right)}} \leadsto \frac{\color{blue}{e^{\log \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}}}{e^{\log \left(\log base\right) + \log \left(\log base\right)}}\]
      28.7
    8. Applied div-exp to get
      \[\color{red}{\frac{e^{\log \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}}{e^{\log \left(\log base\right) + \log \left(\log base\right)}}} \leadsto \color{blue}{e^{\log \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) - \left(\log \left(\log base\right) + \log \left(\log base\right)\right)}}\]
      28.7
    9. Applied simplify to get
      \[e^{\color{red}{\log \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) - \left(\log \left(\log base\right) + \log \left(\log base\right)\right)}} \leadsto e^{\color{blue}{\log \left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) - \log \left(\log base\right)}}\]
      28.6
    10. Applied taylor to get
      \[e^{\log \left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) - \log \left(\log base\right)} \leadsto e^{\log \left(\log \left(-1 \cdot im\right)\right) - \log \left(\log base\right)}\]
      15.6
    11. Taylor expanded around -inf to get
      \[e^{\log \left(\log \color{red}{\left(-1 \cdot im\right)}\right) - \log \left(\log base\right)} \leadsto e^{\log \left(\log \color{blue}{\left(-1 \cdot im\right)}\right) - \log \left(\log base\right)}\]
      15.6
    12. Applied simplify to get
      \[e^{\log \left(\log \left(-1 \cdot im\right)\right) - \log \left(\log base\right)} \leadsto \frac{\log \left(-im\right)}{\log base}\]
      0.4

    13. Applied final simplification

    if -7.479207f+13 < im < 4804.8477f0

    1. Started with
      \[\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}\]
      9.5
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      9.5
    3. Using strategy rm
      9.5
    4. Applied add-cube-cbrt to get
      \[\frac{\log base \cdot \log \color{red}{\left(\sqrt{{re}^2 + im \cdot im}\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)} + 0}{\log base \cdot \log base}\]
      9.5
    5. Using strategy rm
      9.5
    6. Applied cube-mult to get
      \[\frac{\log base \cdot \log \color{red}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.5
    7. Applied log-prod to get
      \[\frac{\log base \cdot \color{red}{\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \color{blue}{\left(\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.5
    8. Applied distribute-lft-in to get
      \[\frac{\color{red}{\log base \cdot \left(\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.5
    9. Applied simplify to get
      \[\frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{red}{\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{blue}{\log \left(\sqrt[3]{\sqrt{im \cdot im + re \cdot re}}\right) \cdot \left(\log base + \log base\right)}\right) + 0}{\log base \cdot \log base}\]
      9.5
    10. Applied simplify to get
      \[\frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{red}{\log \left(\sqrt[3]{\sqrt{im \cdot im + re \cdot re}}\right)} \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base} \leadsto \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{blue}{\log \left(\sqrt[3]{\sqrt{{im}^2 + re \cdot re}}\right)} \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base}\]
      9.5

    if 4804.8477f0 < im

    1. Started with
      \[\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}\]
      21.5
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      21.5
    3. Applied taylor to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log im + 0}{\log base \cdot \log base}\]
      0.4
    4. Taylor expanded around 0 to get
      \[\frac{\log base \cdot \log \color{red}{im} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{im} + 0}{\log base \cdot \log base}\]
      0.4
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log im + 0}{\log base \cdot \log base}} \leadsto \color{blue}{\frac{\log im}{\log base}}\]
      0.4

  1. Removed slow pow expressions

Original test:


(lambda ((re default) (im default) (base default))
  #: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))))