| Alternative 1 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 19584 |
\[\frac{-1}{\frac{\log 0.1}{\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 (* (/ -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)
Results
Initial program 49.7%
Simplified99.1%
[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}
\] |
Applied egg-rr99.0%
Simplified99.0%
[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}}
\] |
Applied egg-rr99.0%
Simplified99.0%
[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}
\] |
Applied egg-rr99.3%
Final simplification99.3%
| Alternative 1 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 19584 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 19520 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 19456 |
| Alternative 4 | |
|---|---|
| Accuracy | 43.6% |
| Cost | 13517 |
| Alternative 5 | |
|---|---|
| Accuracy | 43.5% |
| Cost | 13517 |
| Alternative 6 | |
|---|---|
| Accuracy | 43.6% |
| Cost | 13453 |
| Alternative 7 | |
|---|---|
| Accuracy | 43.6% |
| Cost | 13453 |
| Alternative 8 | |
|---|---|
| Accuracy | 3.0% |
| Cost | 12992 |
| Alternative 9 | |
|---|---|
| Accuracy | 27.5% |
| Cost | 12992 |
| Alternative 10 | |
|---|---|
| Accuracy | 2.5% |
| Cost | 7104 |
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)))