?

Average Accuracy: 49.6% → 99.5%
Time: 12.6s
Precision: binary64
Cost: 38848

?

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

    \[\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.6

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

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

    [Start]99.1

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

    *-un-lft-identity [=>]99.1

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

    add-sqr-sqrt [=>]99.1

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

    times-frac [=>]99.1

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

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

    [Start]99.1

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

    clear-num [=>]99.1

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

    un-div-inv [=>]99.1

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

    pow1/2 [=>]99.1

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

    pow-flip [=>]99.1

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

    metadata-eval [=>]99.1

    \[ \frac{{\log 10}^{\color{blue}{-0.5}}}{\frac{\sqrt{\log 10}}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}} \]
  5. Simplified99.5%

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

    [Start]99.1

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

    associate-/r/ [=>]99.5

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

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

Alternatives

Alternative 1
Accuracy99.1%
Cost19456
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10} \]
Alternative 2
Accuracy44.7%
Cost13444
\[\begin{array}{l} \mathbf{if}\;re \leq -3.2 \cdot 10^{-102}:\\ \;\;\;\;1 + \left(-1 - \frac{\log \left(-re\right)}{\log 0.1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \end{array} \]
Alternative 3
Accuracy44.7%
Cost13252
\[\begin{array}{l} \mathbf{if}\;re \leq -3.2 \cdot 10^{-102}:\\ \;\;\;\;\frac{-\log \left(-re\right)}{\log 0.1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \end{array} \]
Alternative 4
Accuracy44.7%
Cost13188
\[\begin{array}{l} \mathbf{if}\;re \leq -4.2 \cdot 10^{-103}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log 10}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \end{array} \]
Alternative 5
Accuracy35.1%
Cost13124
\[\begin{array}{l} \mathbf{if}\;im \leq 2.6 \cdot 10^{-270}:\\ \;\;\;\;101\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log 10}\\ \end{array} \]
Alternative 6
Accuracy5.1%
Cost64
\[-3 \]
Alternative 7
Accuracy11.4%
Cost64
\[2 \]
Alternative 8
Accuracy11.6%
Cost64
\[3 \]
Alternative 9
Accuracy11.7%
Cost64
\[4 \]
Alternative 10
Accuracy11.8%
Cost64
\[5 \]
Alternative 11
Accuracy12.1%
Cost64
\[8 \]
Alternative 12
Accuracy12.3%
Cost64
\[10 \]
Alternative 13
Accuracy12.3%
Cost64
\[11 \]
Alternative 14
Accuracy12.4%
Cost64
\[12 \]
Alternative 15
Accuracy12.8%
Cost64
\[20 \]
Alternative 16
Accuracy13.1%
Cost64
\[28 \]
Alternative 17
Accuracy14.4%
Cost64
\[81 \]
Alternative 18
Accuracy14.6%
Cost64
\[100 \]
Alternative 19
Accuracy14.7%
Cost64
\[101 \]

Error

Reproduce?

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