| Alternative 1 | |
|---|---|
| Accuracy | 99.2% |
| Cost | 580 |
(FPCore (i) :precision binary64 (/ (/ (* (* i i) (* i i)) (* (* 2.0 i) (* 2.0 i))) (- (* (* 2.0 i) (* 2.0 i)) 1.0)))
(FPCore (i) :precision binary64 (/ i (+ (* i 16.0) (/ -4.0 i))))
double code(double i) {
return (((i * i) * (i * i)) / ((2.0 * i) * (2.0 * i))) / (((2.0 * i) * (2.0 * i)) - 1.0);
}
double code(double i) {
return i / ((i * 16.0) + (-4.0 / i));
}
real(8) function code(i)
real(8), intent (in) :: i
code = (((i * i) * (i * i)) / ((2.0d0 * i) * (2.0d0 * i))) / (((2.0d0 * i) * (2.0d0 * i)) - 1.0d0)
end function
real(8) function code(i)
real(8), intent (in) :: i
code = i / ((i * 16.0d0) + ((-4.0d0) / i))
end function
public static double code(double i) {
return (((i * i) * (i * i)) / ((2.0 * i) * (2.0 * i))) / (((2.0 * i) * (2.0 * i)) - 1.0);
}
public static double code(double i) {
return i / ((i * 16.0) + (-4.0 / i));
}
def code(i): return (((i * i) * (i * i)) / ((2.0 * i) * (2.0 * i))) / (((2.0 * i) * (2.0 * i)) - 1.0)
def code(i): return i / ((i * 16.0) + (-4.0 / i))
function code(i) return Float64(Float64(Float64(Float64(i * i) * Float64(i * i)) / Float64(Float64(2.0 * i) * Float64(2.0 * i))) / Float64(Float64(Float64(2.0 * i) * Float64(2.0 * i)) - 1.0)) end
function code(i) return Float64(i / Float64(Float64(i * 16.0) + Float64(-4.0 / i))) end
function tmp = code(i) tmp = (((i * i) * (i * i)) / ((2.0 * i) * (2.0 * i))) / (((2.0 * i) * (2.0 * i)) - 1.0); end
function tmp = code(i) tmp = i / ((i * 16.0) + (-4.0 / i)); end
code[i_] := N[(N[(N[(N[(i * i), $MachinePrecision] * N[(i * i), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * i), $MachinePrecision] * N[(2.0 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(2.0 * i), $MachinePrecision] * N[(2.0 * i), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
code[i_] := N[(i / N[(N[(i * 16.0), $MachinePrecision] + N[(-4.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}
\frac{i}{i \cdot 16 + \frac{-4}{i}}
Results
Initial program 26.7%
Simplified35.0%
[Start]26.7 | \[ \frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}
\] |
|---|---|
associate-/r* [=>]50.5 | \[ \frac{\color{blue}{\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{2 \cdot i}}{2 \cdot i}}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}
\] |
associate-/l/ [=>]50.5 | \[ \color{blue}{\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{2 \cdot i}}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot i\right)}}
\] |
*-commutative [=>]50.5 | \[ \frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{i \cdot 2}}}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot i\right)}
\] |
times-frac [=>]58.9 | \[ \frac{\color{blue}{\frac{i \cdot i}{i} \cdot \frac{i \cdot i}{2}}}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot i\right)}
\] |
times-frac [=>]74.7 | \[ \color{blue}{\frac{\frac{i \cdot i}{i}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \cdot \frac{\frac{i \cdot i}{2}}{2 \cdot i}}
\] |
associate-/r* [<=]74.7 | \[ \frac{\frac{i \cdot i}{i}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \cdot \color{blue}{\frac{i \cdot i}{2 \cdot \left(2 \cdot i\right)}}
\] |
*-commutative [<=]74.7 | \[ \frac{\frac{i \cdot i}{i}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \cdot \frac{i \cdot i}{\color{blue}{\left(2 \cdot i\right) \cdot 2}}
\] |
Applied egg-rr51.0%
Simplified75.5%
[Start]51.0 | \[ e^{\mathsf{log1p}\left(\frac{\frac{i \cdot i}{4}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]74.9 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\frac{i \cdot i}{4}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)\right)}
\] |
expm1-log1p [=>]74.9 | \[ \color{blue}{\frac{\frac{i \cdot i}{4}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}}
\] |
associate-/l/ [=>]74.8 | \[ \color{blue}{\frac{i \cdot i}{\mathsf{fma}\left(i, i \cdot 4, -1\right) \cdot 4}}
\] |
associate-/l* [=>]75.5 | \[ \color{blue}{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right) \cdot 4}{i}}}
\] |
associate-*l/ [<=]75.5 | \[ \frac{i}{\color{blue}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot 4}}
\] |
associate-/r* [=>]75.5 | \[ \color{blue}{\frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}}{4}}
\] |
metadata-eval [<=]75.5 | \[ \frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}}{\color{blue}{\frac{1}{0.25}}}
\] |
metadata-eval [<=]75.5 | \[ \frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}}{\frac{1}{\color{blue}{\frac{1}{4}}}}
\] |
*-inverses [<=]75.5 | \[ \frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}}{\frac{1}{\frac{\color{blue}{\frac{i}{i}}}{4}}}
\] |
associate-/r* [<=]75.5 | \[ \frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}}{\frac{1}{\color{blue}{\frac{i}{i \cdot 4}}}}
\] |
associate-/l* [<=]75.5 | \[ \color{blue}{\frac{\frac{i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}} \cdot \frac{i}{i \cdot 4}}{1}}
\] |
times-frac [<=]74.8 | \[ \frac{\color{blue}{\frac{i \cdot i}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)}}}{1}
\] |
associate-/r* [<=]74.8 | \[ \color{blue}{\frac{i \cdot i}{\left(\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)\right) \cdot 1}}
\] |
*-inverses [<=]74.8 | \[ \frac{i \cdot i}{\left(\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)\right) \cdot \color{blue}{\frac{i}{i}}}
\] |
associate-/l* [=>]75.5 | \[ \color{blue}{\frac{i}{\frac{\left(\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)\right) \cdot \frac{i}{i}}{i}}}
\] |
*-inverses [=>]75.5 | \[ \frac{i}{\frac{\left(\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)\right) \cdot \color{blue}{1}}{i}}
\] |
associate-/l* [=>]75.5 | \[ \frac{i}{\color{blue}{\frac{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i} \cdot \left(i \cdot 4\right)}{\frac{i}{1}}}}
\] |
Taylor expanded in i around 0 99.7%
Simplified99.7%
[Start]99.7 | \[ \frac{i}{16 \cdot i - 4 \cdot \frac{1}{i}}
\] |
|---|---|
*-commutative [=>]99.7 | \[ \frac{i}{\color{blue}{i \cdot 16} - 4 \cdot \frac{1}{i}}
\] |
cancel-sign-sub-inv [=>]99.7 | \[ \frac{i}{\color{blue}{i \cdot 16 + \left(-4\right) \cdot \frac{1}{i}}}
\] |
metadata-eval [=>]99.7 | \[ \frac{i}{i \cdot 16 + \color{blue}{-4} \cdot \frac{1}{i}}
\] |
associate-*r/ [=>]99.7 | \[ \frac{i}{i \cdot 16 + \color{blue}{\frac{-4 \cdot 1}{i}}}
\] |
metadata-eval [=>]99.7 | \[ \frac{i}{i \cdot 16 + \frac{\color{blue}{-4}}{i}}
\] |
Final simplification99.7%
| Alternative 1 | |
|---|---|
| Accuracy | 99.2% |
| Cost | 580 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.5% |
| Cost | 576 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.0% |
| Cost | 452 |
| Alternative 4 | |
|---|---|
| Accuracy | 50.3% |
| Cost | 64 |
herbie shell --seed 2023125
(FPCore (i)
:name "Octave 3.8, jcobi/4, as called"
:precision binary64
:pre (> i 0.0)
(/ (/ (* (* i i) (* i i)) (* (* 2.0 i) (* 2.0 i))) (- (* (* 2.0 i) (* 2.0 i)) 1.0)))