?

Average Accuracy: 49.7% → 99.3%
Time: 13.6s
Precision: binary64
Cost: 25984

?

\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]
\[\frac{-3}{\log 0.1} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \]
(FPCore (re im)
 :precision binary64
 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im)
 :precision binary64
 (* (/ -3.0 (log 0.1)) (log (cbrt (hypot re im)))))
double code(double re, double im) {
	return log(sqrt(((re * re) + (im * im)))) / log(10.0);
}
double code(double re, double im) {
	return (-3.0 / log(0.1)) * log(cbrt(hypot(re, im)));
}
public static double code(double re, double im) {
	return Math.log(Math.sqrt(((re * re) + (im * im)))) / Math.log(10.0);
}
public static double code(double re, double im) {
	return (-3.0 / Math.log(0.1)) * Math.log(Math.cbrt(Math.hypot(re, im)));
}
function code(re, im)
	return Float64(log(sqrt(Float64(Float64(re * re) + Float64(im * im)))) / log(10.0))
end
function code(re, im)
	return Float64(Float64(-3.0 / log(0.1)) * log(cbrt(hypot(re, im))))
end
code[re_, im_] := N[(N[Log[N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
code[re_, im_] := N[(N[(-3.0 / N[Log[0.1], $MachinePrecision]), $MachinePrecision] * N[Log[N[Power[N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\frac{-3}{\log 0.1} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 49.7%

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]
  2. Simplified99.1%

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10}} \]
    Proof

    [Start]49.7

    \[ \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]

    hypot-def [=>]99.1

    \[ \frac{\log \color{blue}{\left(\mathsf{hypot}\left(re, im\right)\right)}}{\log 10} \]
  3. Applied egg-rr99.0%

    \[\leadsto \color{blue}{\left(-\log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \frac{1}{\log 0.1}} \]
  4. Simplified99.0%

    \[\leadsto \color{blue}{\frac{-\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 0.1}} \]
    Proof

    [Start]99.0

    \[ \left(-\log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \frac{1}{\log 0.1} \]

    distribute-lft-neg-out [=>]99.0

    \[ \color{blue}{-\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \frac{1}{\log 0.1}} \]

    associate-*r/ [=>]99.0

    \[ -\color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot 1}{\log 0.1}} \]

    *-rgt-identity [=>]99.0

    \[ -\frac{\color{blue}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}{\log 0.1} \]

    distribute-neg-frac [=>]99.0

    \[ \color{blue}{\frac{-\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 0.1}} \]
  5. Applied egg-rr99.0%

    \[\leadsto \frac{-\color{blue}{\left(\log \left({\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{2}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}}{\log 0.1} \]
  6. Simplified99.0%

    \[\leadsto \frac{-\color{blue}{3 \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}{\log 0.1} \]
    Proof

    [Start]99.0

    \[ \frac{-\left(\log \left({\left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}^{2}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}{\log 0.1} \]

    log-pow [=>]99.0

    \[ \frac{-\left(\color{blue}{2 \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)} + \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right)}{\log 0.1} \]

    distribute-lft1-in [=>]99.0

    \[ \frac{-\color{blue}{\left(2 + 1\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}}{\log 0.1} \]

    metadata-eval [=>]99.0

    \[ \frac{-\color{blue}{3} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}{\log 0.1} \]
  7. Applied egg-rr99.3%

    \[\leadsto \color{blue}{\frac{-3}{\log 0.1} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)} \]
  8. Final simplification99.3%

    \[\leadsto \frac{-3}{\log 0.1} \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \]

Alternatives

Alternative 1
Accuracy99.0%
Cost19584
\[\frac{-1}{\frac{\log 0.1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}} \]
Alternative 2
Accuracy99.0%
Cost19520
\[\frac{-\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 0.1} \]
Alternative 3
Accuracy99.1%
Cost19456
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10} \]
Alternative 4
Accuracy43.6%
Cost13517
\[\begin{array}{l} \mathbf{if}\;re \leq -1.8 \cdot 10^{+15} \lor \neg \left(re \leq -620000000000\right) \land re \leq -2.7 \cdot 10^{-170}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{\log 0.1}{\log im}}\\ \end{array} \]
Alternative 5
Accuracy43.5%
Cost13517
\[\begin{array}{l} \mathbf{if}\;re \leq -1.75 \cdot 10^{+15}:\\ \;\;\;\;\frac{-1}{\frac{-\log 0.1}{\log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \leq -16600000000 \lor \neg \left(re \leq -2.7 \cdot 10^{-170}\right):\\ \;\;\;\;\frac{-1}{\frac{\log 0.1}{\log im}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \end{array} \]
Alternative 6
Accuracy43.6%
Cost13453
\[\begin{array}{l} \mathbf{if}\;re \leq -2.1 \cdot 10^{+15} \lor \neg \left(re \leq -11600000000\right) \land re \leq -2.7 \cdot 10^{-170}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \end{array} \]
Alternative 7
Accuracy43.6%
Cost13453
\[\begin{array}{l} \mathbf{if}\;re \leq -2.2 \cdot 10^{+15} \lor \neg \left(re \leq -122000000000\right) \land re \leq -2.7 \cdot 10^{-170}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\log im}{\log 0.1}\\ \end{array} \]
Alternative 8
Accuracy3.0%
Cost12992
\[\frac{\log im}{\log 0.1} \]
Alternative 9
Accuracy27.5%
Cost12992
\[\frac{\log im}{\log 10} \]
Alternative 10
Accuracy2.5%
Cost7104
\[-0.5 \cdot \left(\frac{im}{re} \cdot \frac{\frac{im}{re}}{\log 0.1}\right) \]

Error

Reproduce?

herbie shell --seed 2023122 
(FPCore (re im)
  :name "math.log10 on complex, real part"
  :precision binary64
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))