?

Average Accuracy: 50.3% → 99.7%
Time: 12.8s
Precision: binary64
Cost: 38656

?

\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10} \]
\[\log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{-2}}\right)}\right) \]
(FPCore (re im)
 :precision binary64
 (/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
(FPCore (re im)
 :precision binary64
 (log (pow (hypot re im) (sqrt (pow (log 10.0) -2.0)))))
double code(double re, double im) {
	return log(sqrt(((re * re) + (im * im)))) / log(10.0);
}
double code(double re, double im) {
	return log(pow(hypot(re, im), sqrt(pow(log(10.0), -2.0))));
}
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 Math.log(Math.pow(Math.hypot(re, im), Math.sqrt(Math.pow(Math.log(10.0), -2.0))));
}
def code(re, im):
	return math.log(math.sqrt(((re * re) + (im * im)))) / math.log(10.0)
def code(re, im):
	return math.log(math.pow(math.hypot(re, im), math.sqrt(math.pow(math.log(10.0), -2.0))))
function code(re, im)
	return Float64(log(sqrt(Float64(Float64(re * re) + Float64(im * im)))) / log(10.0))
end
function code(re, im)
	return log((hypot(re, im) ^ sqrt((log(10.0) ^ -2.0))))
end
function tmp = code(re, im)
	tmp = log(sqrt(((re * re) + (im * im)))) / log(10.0);
end
function tmp = code(re, im)
	tmp = log((hypot(re, im) ^ sqrt((log(10.0) ^ -2.0))));
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[Log[N[Power[N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision], N[Sqrt[N[Power[N[Log[10.0], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{-2}}\right)}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 50.3%

    \[\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]50.3

    \[ \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-rr98.5%

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

    [Start]99.1

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

    add-log-exp [=>]99.1

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

    div-inv [=>]98.5

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

    exp-to-pow [=>]98.5

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

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

    [Start]98.5

    \[ \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\frac{1}{\log 10}\right)}\right) \]

    add-sqr-sqrt [=>]99.7

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

    sqrt-unprod [=>]98.5

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

    inv-pow [=>]98.5

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

    metadata-eval [<=]98.5

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

    inv-pow [=>]98.5

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

    metadata-eval [<=]98.5

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

    pow-sqr [=>]99.7

    \[ \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{\color{blue}{{\log 10}^{\left(2 \cdot \left(-1\right)\right)}}}\right)}\right) \]

    metadata-eval [=>]99.7

    \[ \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{\left(2 \cdot \color{blue}{-1}\right)}}\right)}\right) \]

    metadata-eval [=>]99.7

    \[ \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{\color{blue}{-2}}}\right)}\right) \]
  5. Final simplification99.7%

    \[\leadsto \log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{-2}}\right)}\right) \]

Alternatives

Alternative 1
Accuracy42.5%
Cost19852
\[\begin{array}{l} t_0 := \frac{-\log \left(\frac{-1}{re}\right)}{\log 10}\\ \mathbf{if}\;re \leq -2.6 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;re \leq -1.5 \cdot 10^{-143}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \mathbf{elif}\;re \leq -4.2 \cdot 10^{-215}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\log \left({im}^{\left(\frac{-1}{\log 0.1}\right)}\right)\\ \end{array} \]
Alternative 2
Accuracy99.1%
Cost19456
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10} \]
Alternative 3
Accuracy42.5%
Cost13580
\[\begin{array}{l} t_0 := \frac{-\log \left(\frac{-1}{re}\right)}{\log 10}\\ \mathbf{if}\;re \leq -3.1 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;re \leq -4.8 \cdot 10^{-144}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \mathbf{elif}\;re \leq -4 \cdot 10^{-215}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-\frac{\log im}{\log 0.1}\\ \end{array} \]
Alternative 4
Accuracy42.5%
Cost13516
\[\begin{array}{l} t_0 := \frac{\log \left(\frac{-1}{re}\right)}{\log 0.1}\\ \mathbf{if}\;re \leq -2.85 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;re \leq -3.5 \cdot 10^{-144}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \mathbf{elif}\;re \leq -4.2 \cdot 10^{-215}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-\frac{\log im}{\log 0.1}\\ \end{array} \]
Alternative 5
Accuracy3.1%
Cost12992
\[\frac{\log im}{\log 0.1} \]
Alternative 6
Accuracy27.3%
Cost12992
\[\frac{\log im}{\log 10} \]

Error

Reproduce?

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