math.sqrt on complex, imaginary part, im greater than 0 branch

Percentage Accurate: 41.6% → 88.6%
Time: 7.1s
Alternatives: 6
Speedup: TODO×

Specification

?
\[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1?

\[\begin{array}{l} \mathbf{if}\;re \leq 2.7 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if re < 2.6999999999999997e27

    1. Initial program 48.2%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Step-by-step derivation
      1. hypot-def92.6%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right)} \]
    3. Simplified92.6%

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]

    if 2.6999999999999997e27 < re

    1. Initial program 6.7%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow252.7%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Taylor expanded in im around 0 83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\frac{1}{re}} \cdot im\right)} \]
    6. Step-by-step derivation
      1. *-commutative83.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \sqrt{\frac{1}{re}}\right)} \]
      2. unpow1/283.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{\left(\frac{1}{re}\right)}^{0.5}}\right) \]
      3. unpow-183.2%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left({re}^{-1}\right)}}^{0.5}\right) \]
      4. exp-to-pow78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left(e^{\log re \cdot -1}\right)}}^{0.5}\right) \]
      5. *-commutative78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-1 \cdot \log re}}\right)}^{0.5}\right) \]
      6. neg-mul-178.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-\log re}}\right)}^{0.5}\right) \]
      7. exp-prod78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{e^{\left(-\log re\right) \cdot 0.5}}\right) \]
      8. distribute-lft-neg-out78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{-\log re \cdot 0.5}}\right) \]
      9. distribute-rgt-neg-in78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{\log re \cdot \left(-0.5\right)}}\right) \]
      10. metadata-eval78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\log re \cdot \color{blue}{-0.5}}\right) \]
      11. exp-to-pow83.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{re}^{-0.5}}\right) \]
    7. Simplified83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot {re}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 2.7 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]

Alternative 2?

\[\begin{array}{l} \mathbf{if}\;re \leq -2.2 \cdot 10^{+68}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\ \mathbf{elif}\;re \leq 6.1 \cdot 10^{-33}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(im - re\right)}\\ \mathbf{elif}\;re \leq 2800000000000:\\ \;\;\;\;0.5 \cdot \frac{im}{\sqrt{re}}\\ \mathbf{elif}\;re \leq 1.22 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]
Derivation
  1. Split input into 5 regimes
  2. if re < -2.19999999999999987e68

    1. Initial program 24.6%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around -inf 81.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(-2 \cdot re\right)}} \]
    3. Step-by-step derivation
      1. *-commutative81.4%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(re \cdot -2\right)}} \]
    4. Simplified81.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(re \cdot -2\right)}} \]

    if -2.19999999999999987e68 < re < 6.1000000000000001e-33

    1. Initial program 60.1%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around 0 80.5%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(\color{blue}{im} - re\right)} \]

    if 6.1000000000000001e-33 < re < 2.8e12

    1. Initial program 14.0%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 43.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow243.4%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified43.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u43.4%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(0.5 \cdot \frac{im \cdot im}{re}\right)}\right)\right)} \]
      2. expm1-udef5.0%

        \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(0.5 \cdot \frac{im \cdot im}{re}\right)}\right)} - 1\right)} \]
      3. associate-*r*5.0%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(2 \cdot 0.5\right) \cdot \frac{im \cdot im}{re}}}\right)} - 1\right) \]
      4. metadata-eval5.0%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{1} \cdot \frac{im \cdot im}{re}}\right)} - 1\right) \]
      5. *-un-lft-identity5.0%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{im \cdot im}{re}}}\right)} - 1\right) \]
      6. sqrt-div5.0%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{im \cdot im}}{\sqrt{re}}}\right)} - 1\right) \]
      7. sqrt-prod5.3%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{im} \cdot \sqrt{im}}}{\sqrt{re}}\right)} - 1\right) \]
      8. add-sqr-sqrt5.3%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{im}}{\sqrt{re}}\right)} - 1\right) \]
    6. Applied egg-rr5.3%

      \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{im}{\sqrt{re}}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def72.1%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{im}{\sqrt{re}}\right)\right)} \]
      2. expm1-log1p72.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{im}{\sqrt{re}}} \]
    8. Simplified72.1%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{im}{\sqrt{re}}} \]

    if 2.8e12 < re < 1.2200000000000001e27

    1. Initial program 4.1%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Step-by-step derivation
      1. *-commutative4.1%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\sqrt{re \cdot re + im \cdot im} - re\right) \cdot 2}} \]
      2. hypot-udef100.0%

        \[\leadsto 0.5 \cdot \sqrt{\left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right) \cdot 2} \]
      3. *-commutative100.0%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]
      4. add-sqr-sqrt99.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)} \]
      5. pow299.1%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)}^{2}} \]
      6. pow1/299.1%

        \[\leadsto 0.5 \cdot {\left(\sqrt{\color{blue}{{\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.5}}}\right)}^{2} \]
      7. sqrt-pow199.1%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
      8. metadata-eval99.1%

        \[\leadsto 0.5 \cdot {\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    3. Applied egg-rr99.1%

      \[\leadsto 0.5 \cdot \color{blue}{{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in re around 0 99.1%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
    5. Taylor expanded in im around 0 89.9%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(e^{0.25 \cdot \left(\log 2 + \log im\right)}\right)}^{2}} \]
    6. Step-by-step derivation
      1. log-prod89.9%

        \[\leadsto 0.5 \cdot {\left(e^{0.25 \cdot \color{blue}{\log \left(2 \cdot im\right)}}\right)}^{2} \]
      2. *-commutative89.9%

        \[\leadsto 0.5 \cdot {\left(e^{\color{blue}{\log \left(2 \cdot im\right) \cdot 0.25}}\right)}^{2} \]
      3. exp-to-pow99.1%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
      4. unpow299.1%

        \[\leadsto 0.5 \cdot \color{blue}{\left({\left(2 \cdot im\right)}^{0.25} \cdot {\left(2 \cdot im\right)}^{0.25}\right)} \]
      5. pow-sqr100.0%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(2 \cdot im\right)}^{\left(2 \cdot 0.25\right)}} \]
      6. metadata-eval100.0%

        \[\leadsto 0.5 \cdot {\left(2 \cdot im\right)}^{\color{blue}{0.5}} \]
      7. unpow1/2100.0%

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
    7. Simplified100.0%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]

    if 1.2200000000000001e27 < re

    1. Initial program 6.7%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow252.7%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Taylor expanded in im around 0 83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\frac{1}{re}} \cdot im\right)} \]
    6. Step-by-step derivation
      1. *-commutative83.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \sqrt{\frac{1}{re}}\right)} \]
      2. unpow1/283.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{\left(\frac{1}{re}\right)}^{0.5}}\right) \]
      3. unpow-183.2%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left({re}^{-1}\right)}}^{0.5}\right) \]
      4. exp-to-pow78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left(e^{\log re \cdot -1}\right)}}^{0.5}\right) \]
      5. *-commutative78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-1 \cdot \log re}}\right)}^{0.5}\right) \]
      6. neg-mul-178.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-\log re}}\right)}^{0.5}\right) \]
      7. exp-prod78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{e^{\left(-\log re\right) \cdot 0.5}}\right) \]
      8. distribute-lft-neg-out78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{-\log re \cdot 0.5}}\right) \]
      9. distribute-rgt-neg-in78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{\log re \cdot \left(-0.5\right)}}\right) \]
      10. metadata-eval78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\log re \cdot \color{blue}{-0.5}}\right) \]
      11. exp-to-pow83.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{re}^{-0.5}}\right) \]
    7. Simplified83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot {re}^{-0.5}\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification81.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -2.2 \cdot 10^{+68}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\ \mathbf{elif}\;re \leq 6.1 \cdot 10^{-33}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(im - re\right)}\\ \mathbf{elif}\;re \leq 2800000000000:\\ \;\;\;\;0.5 \cdot \frac{im}{\sqrt{re}}\\ \mathbf{elif}\;re \leq 1.22 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]

Alternative 3?

\[\begin{array}{l} \mathbf{if}\;re \leq -3.7 \cdot 10^{+68}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\ \mathbf{elif}\;re \leq 3.7 \cdot 10^{+26}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if re < -3.69999999999999998e68

    1. Initial program 24.6%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around -inf 81.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(-2 \cdot re\right)}} \]
    3. Step-by-step derivation
      1. *-commutative81.4%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(re \cdot -2\right)}} \]
    4. Simplified81.4%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(re \cdot -2\right)}} \]

    if -3.69999999999999998e68 < re < 3.69999999999999988e26

    1. Initial program 55.4%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Step-by-step derivation
      1. *-commutative55.4%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\sqrt{re \cdot re + im \cdot im} - re\right) \cdot 2}} \]
      2. hypot-udef90.4%

        \[\leadsto 0.5 \cdot \sqrt{\left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right) \cdot 2} \]
      3. *-commutative90.4%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]
      4. add-sqr-sqrt89.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)} \]
      5. pow289.7%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)}^{2}} \]
      6. pow1/289.7%

        \[\leadsto 0.5 \cdot {\left(\sqrt{\color{blue}{{\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.5}}}\right)}^{2} \]
      7. sqrt-pow189.7%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
      8. metadata-eval89.7%

        \[\leadsto 0.5 \cdot {\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    3. Applied egg-rr89.7%

      \[\leadsto 0.5 \cdot \color{blue}{{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in re around 0 75.8%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
    5. Taylor expanded in im around 0 70.7%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(e^{0.25 \cdot \left(\log 2 + \log im\right)}\right)}^{2}} \]
    6. Step-by-step derivation
      1. log-prod71.0%

        \[\leadsto 0.5 \cdot {\left(e^{0.25 \cdot \color{blue}{\log \left(2 \cdot im\right)}}\right)}^{2} \]
      2. *-commutative71.0%

        \[\leadsto 0.5 \cdot {\left(e^{\color{blue}{\log \left(2 \cdot im\right) \cdot 0.25}}\right)}^{2} \]
      3. exp-to-pow75.8%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
      4. unpow275.8%

        \[\leadsto 0.5 \cdot \color{blue}{\left({\left(2 \cdot im\right)}^{0.25} \cdot {\left(2 \cdot im\right)}^{0.25}\right)} \]
      5. pow-sqr76.4%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(2 \cdot im\right)}^{\left(2 \cdot 0.25\right)}} \]
      6. metadata-eval76.4%

        \[\leadsto 0.5 \cdot {\left(2 \cdot im\right)}^{\color{blue}{0.5}} \]
      7. unpow1/276.4%

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
    7. Simplified76.4%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]

    if 3.69999999999999988e26 < re

    1. Initial program 6.7%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow252.7%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Taylor expanded in im around 0 83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\frac{1}{re}} \cdot im\right)} \]
    6. Step-by-step derivation
      1. *-commutative83.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \sqrt{\frac{1}{re}}\right)} \]
      2. unpow1/283.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{\left(\frac{1}{re}\right)}^{0.5}}\right) \]
      3. unpow-183.2%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left({re}^{-1}\right)}}^{0.5}\right) \]
      4. exp-to-pow78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left(e^{\log re \cdot -1}\right)}}^{0.5}\right) \]
      5. *-commutative78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-1 \cdot \log re}}\right)}^{0.5}\right) \]
      6. neg-mul-178.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-\log re}}\right)}^{0.5}\right) \]
      7. exp-prod78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{e^{\left(-\log re\right) \cdot 0.5}}\right) \]
      8. distribute-lft-neg-out78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{-\log re \cdot 0.5}}\right) \]
      9. distribute-rgt-neg-in78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{\log re \cdot \left(-0.5\right)}}\right) \]
      10. metadata-eval78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\log re \cdot \color{blue}{-0.5}}\right) \]
      11. exp-to-pow83.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{re}^{-0.5}}\right) \]
    7. Simplified83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot {re}^{-0.5}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -3.7 \cdot 10^{+68}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re \cdot -2\right)}\\ \mathbf{elif}\;re \leq 3.7 \cdot 10^{+26}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]

Alternative 4?

\[\begin{array}{l} \mathbf{if}\;re \leq 1.2 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if re < 1.19999999999999999e27

    1. Initial program 48.2%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Step-by-step derivation
      1. *-commutative48.2%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\sqrt{re \cdot re + im \cdot im} - re\right) \cdot 2}} \]
      2. hypot-udef92.6%

        \[\leadsto 0.5 \cdot \sqrt{\left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right) \cdot 2} \]
      3. *-commutative92.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]
      4. add-sqr-sqrt91.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)} \]
      5. pow291.9%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)}^{2}} \]
      6. pow1/291.9%

        \[\leadsto 0.5 \cdot {\left(\sqrt{\color{blue}{{\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.5}}}\right)}^{2} \]
      7. sqrt-pow191.9%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
      8. metadata-eval91.9%

        \[\leadsto 0.5 \cdot {\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    3. Applied egg-rr91.9%

      \[\leadsto 0.5 \cdot \color{blue}{{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in re around 0 63.7%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
    5. Taylor expanded in im around 0 59.4%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(e^{0.25 \cdot \left(\log 2 + \log im\right)}\right)}^{2}} \]
    6. Step-by-step derivation
      1. log-prod59.7%

        \[\leadsto 0.5 \cdot {\left(e^{0.25 \cdot \color{blue}{\log \left(2 \cdot im\right)}}\right)}^{2} \]
      2. *-commutative59.7%

        \[\leadsto 0.5 \cdot {\left(e^{\color{blue}{\log \left(2 \cdot im\right) \cdot 0.25}}\right)}^{2} \]
      3. exp-to-pow63.7%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
      4. unpow263.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left({\left(2 \cdot im\right)}^{0.25} \cdot {\left(2 \cdot im\right)}^{0.25}\right)} \]
      5. pow-sqr64.1%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(2 \cdot im\right)}^{\left(2 \cdot 0.25\right)}} \]
      6. metadata-eval64.1%

        \[\leadsto 0.5 \cdot {\left(2 \cdot im\right)}^{\color{blue}{0.5}} \]
      7. unpow1/264.1%

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
    7. Simplified64.1%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]

    if 1.19999999999999999e27 < re

    1. Initial program 6.7%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow252.7%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Taylor expanded in im around 0 83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\frac{1}{re}} \cdot im\right)} \]
    6. Step-by-step derivation
      1. *-commutative83.2%

        \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot \sqrt{\frac{1}{re}}\right)} \]
      2. unpow1/283.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{\left(\frac{1}{re}\right)}^{0.5}}\right) \]
      3. unpow-183.2%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left({re}^{-1}\right)}}^{0.5}\right) \]
      4. exp-to-pow78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\color{blue}{\left(e^{\log re \cdot -1}\right)}}^{0.5}\right) \]
      5. *-commutative78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-1 \cdot \log re}}\right)}^{0.5}\right) \]
      6. neg-mul-178.0%

        \[\leadsto 0.5 \cdot \left(im \cdot {\left(e^{\color{blue}{-\log re}}\right)}^{0.5}\right) \]
      7. exp-prod78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{e^{\left(-\log re\right) \cdot 0.5}}\right) \]
      8. distribute-lft-neg-out78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{-\log re \cdot 0.5}}\right) \]
      9. distribute-rgt-neg-in78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\color{blue}{\log re \cdot \left(-0.5\right)}}\right) \]
      10. metadata-eval78.0%

        \[\leadsto 0.5 \cdot \left(im \cdot e^{\log re \cdot \color{blue}{-0.5}}\right) \]
      11. exp-to-pow83.2%

        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{{re}^{-0.5}}\right) \]
    7. Simplified83.2%

      \[\leadsto 0.5 \cdot \color{blue}{\left(im \cdot {re}^{-0.5}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 1.2 \cdot 10^{+27}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot {re}^{-0.5}\right)\\ \end{array} \]

Alternative 5?

\[\begin{array}{l} \mathbf{if}\;re \leq 6.2 \cdot 10^{+28}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{im}{\sqrt{re}}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if re < 6.2000000000000001e28

    1. Initial program 48.2%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Step-by-step derivation
      1. *-commutative48.2%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\sqrt{re \cdot re + im \cdot im} - re\right) \cdot 2}} \]
      2. hypot-udef92.6%

        \[\leadsto 0.5 \cdot \sqrt{\left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right) \cdot 2} \]
      3. *-commutative92.6%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]
      4. add-sqr-sqrt91.9%

        \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)} \]
      5. pow291.9%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)}^{2}} \]
      6. pow1/291.9%

        \[\leadsto 0.5 \cdot {\left(\sqrt{\color{blue}{{\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.5}}}\right)}^{2} \]
      7. sqrt-pow191.9%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
      8. metadata-eval91.9%

        \[\leadsto 0.5 \cdot {\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\color{blue}{0.25}}\right)}^{2} \]
    3. Applied egg-rr91.9%

      \[\leadsto 0.5 \cdot \color{blue}{{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.25}\right)}^{2}} \]
    4. Taylor expanded in re around 0 63.7%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
    5. Taylor expanded in im around 0 59.4%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(e^{0.25 \cdot \left(\log 2 + \log im\right)}\right)}^{2}} \]
    6. Step-by-step derivation
      1. log-prod59.7%

        \[\leadsto 0.5 \cdot {\left(e^{0.25 \cdot \color{blue}{\log \left(2 \cdot im\right)}}\right)}^{2} \]
      2. *-commutative59.7%

        \[\leadsto 0.5 \cdot {\left(e^{\color{blue}{\log \left(2 \cdot im\right) \cdot 0.25}}\right)}^{2} \]
      3. exp-to-pow63.7%

        \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
      4. unpow263.7%

        \[\leadsto 0.5 \cdot \color{blue}{\left({\left(2 \cdot im\right)}^{0.25} \cdot {\left(2 \cdot im\right)}^{0.25}\right)} \]
      5. pow-sqr64.1%

        \[\leadsto 0.5 \cdot \color{blue}{{\left(2 \cdot im\right)}^{\left(2 \cdot 0.25\right)}} \]
      6. metadata-eval64.1%

        \[\leadsto 0.5 \cdot {\left(2 \cdot im\right)}^{\color{blue}{0.5}} \]
      7. unpow1/264.1%

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
    7. Simplified64.1%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]

    if 6.2000000000000001e28 < re

    1. Initial program 6.7%

      \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
    2. Taylor expanded in re around inf 52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{{im}^{2}}{re}\right)}} \]
    3. Step-by-step derivation
      1. unpow252.7%

        \[\leadsto 0.5 \cdot \sqrt{2 \cdot \left(0.5 \cdot \frac{\color{blue}{im \cdot im}}{re}\right)} \]
    4. Simplified52.7%

      \[\leadsto 0.5 \cdot \sqrt{2 \cdot \color{blue}{\left(0.5 \cdot \frac{im \cdot im}{re}\right)}} \]
    5. Step-by-step derivation
      1. expm1-log1p-u52.7%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot \left(0.5 \cdot \frac{im \cdot im}{re}\right)}\right)\right)} \]
      2. expm1-udef26.4%

        \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{2 \cdot \left(0.5 \cdot \frac{im \cdot im}{re}\right)}\right)} - 1\right)} \]
      3. associate-*r*26.4%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\left(2 \cdot 0.5\right) \cdot \frac{im \cdot im}{re}}}\right)} - 1\right) \]
      4. metadata-eval26.4%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{1} \cdot \frac{im \cdot im}{re}}\right)} - 1\right) \]
      5. *-un-lft-identity26.4%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{im \cdot im}{re}}}\right)} - 1\right) \]
      6. sqrt-div26.4%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{\sqrt{im \cdot im}}{\sqrt{re}}}\right)} - 1\right) \]
      7. sqrt-prod35.6%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{im} \cdot \sqrt{im}}}{\sqrt{re}}\right)} - 1\right) \]
      8. add-sqr-sqrt35.6%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{im}}{\sqrt{re}}\right)} - 1\right) \]
    6. Applied egg-rr35.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{im}{\sqrt{re}}\right)} - 1\right)} \]
    7. Step-by-step derivation
      1. expm1-def82.3%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{im}{\sqrt{re}}\right)\right)} \]
      2. expm1-log1p83.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{im}{\sqrt{re}}} \]
    8. Simplified83.1%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{im}{\sqrt{re}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq 6.2 \cdot 10^{+28}:\\ \;\;\;\;0.5 \cdot \sqrt{2 \cdot im}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{im}{\sqrt{re}}\\ \end{array} \]

Alternative 6?

\[0.5 \cdot \sqrt{2 \cdot im} \]
Derivation
  1. Initial program 39.4%

    \[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} - re\right)} \]
  2. Step-by-step derivation
    1. *-commutative39.4%

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\left(\sqrt{re \cdot re + im \cdot im} - re\right) \cdot 2}} \]
    2. hypot-udef81.6%

      \[\leadsto 0.5 \cdot \sqrt{\left(\color{blue}{\mathsf{hypot}\left(re, im\right)} - re\right) \cdot 2} \]
    3. *-commutative81.6%

      \[\leadsto 0.5 \cdot \sqrt{\color{blue}{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \]
    4. add-sqr-sqrt81.0%

      \[\leadsto 0.5 \cdot \color{blue}{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}} \cdot \sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)} \]
    5. pow281.0%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(\sqrt{\sqrt{2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)}}\right)}^{2}} \]
    6. pow1/281.0%

      \[\leadsto 0.5 \cdot {\left(\sqrt{\color{blue}{{\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.5}}}\right)}^{2} \]
    7. sqrt-pow181.0%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
    8. metadata-eval81.0%

      \[\leadsto 0.5 \cdot {\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{\color{blue}{0.25}}\right)}^{2} \]
  3. Applied egg-rr81.0%

    \[\leadsto 0.5 \cdot \color{blue}{{\left({\left(2 \cdot \left(\mathsf{hypot}\left(re, im\right) - re\right)\right)}^{0.25}\right)}^{2}} \]
  4. Taylor expanded in re around 0 54.6%

    \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
  5. Taylor expanded in im around 0 50.9%

    \[\leadsto 0.5 \cdot \color{blue}{{\left(e^{0.25 \cdot \left(\log 2 + \log im\right)}\right)}^{2}} \]
  6. Step-by-step derivation
    1. log-prod51.2%

      \[\leadsto 0.5 \cdot {\left(e^{0.25 \cdot \color{blue}{\log \left(2 \cdot im\right)}}\right)}^{2} \]
    2. *-commutative51.2%

      \[\leadsto 0.5 \cdot {\left(e^{\color{blue}{\log \left(2 \cdot im\right) \cdot 0.25}}\right)}^{2} \]
    3. exp-to-pow54.6%

      \[\leadsto 0.5 \cdot {\color{blue}{\left({\left(2 \cdot im\right)}^{0.25}\right)}}^{2} \]
    4. unpow254.6%

      \[\leadsto 0.5 \cdot \color{blue}{\left({\left(2 \cdot im\right)}^{0.25} \cdot {\left(2 \cdot im\right)}^{0.25}\right)} \]
    5. pow-sqr55.0%

      \[\leadsto 0.5 \cdot \color{blue}{{\left(2 \cdot im\right)}^{\left(2 \cdot 0.25\right)}} \]
    6. metadata-eval55.0%

      \[\leadsto 0.5 \cdot {\left(2 \cdot im\right)}^{\color{blue}{0.5}} \]
    7. unpow1/255.0%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
  7. Simplified55.0%

    \[\leadsto 0.5 \cdot \color{blue}{\sqrt{2 \cdot im}} \]
  8. Final simplification55.0%

    \[\leadsto 0.5 \cdot \sqrt{2 \cdot im} \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (re im)
  :name "math.sqrt on complex, imaginary part, im greater than 0 branch"
  :precision binary64
  :pre (> im 0.0)
  (* 0.5 (sqrt (* 2.0 (- (sqrt (+ (* re re) (* im im))) re)))))