| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 580 |
\[\begin{array}{l}
\mathbf{if}\;i \leq 0.5:\\
\;\;\;\;i \cdot \left(i \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;0.0625 + \frac{\frac{0.015625}{i}}{i}\\
\end{array}
\]
(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 (/ 0.25 (+ 4.0 (/ -1.0 (* i 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 0.25 / (4.0 + (-1.0 / (i * 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 = 0.25d0 / (4.0d0 + ((-1.0d0) / (i * 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 0.25 / (4.0 + (-1.0 / (i * 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 0.25 / (4.0 + (-1.0 / (i * 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(0.25 / Float64(4.0 + Float64(-1.0 / Float64(i * 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 = 0.25 / (4.0 + (-1.0 / (i * 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[(0.25 / N[(4.0 + N[(-1.0 / N[(i * i), $MachinePrecision]), $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{0.25}{4 + \frac{-1}{i \cdot i}}
Results
Initial program 47.0
Simplified0.3
[Start]47.0 | \[ \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-*l/ [<=]31.1 | \[ \frac{\color{blue}{\frac{i \cdot i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)} \cdot \left(i \cdot i\right)}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}
\] |
associate-/l* [=>]31.4 | \[ \color{blue}{\frac{\frac{i \cdot i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}}
\] |
associate-*l* [=>]31.4 | \[ \frac{\frac{i \cdot i}{\color{blue}{2 \cdot \left(i \cdot \left(2 \cdot i\right)\right)}}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
*-commutative [=>]31.4 | \[ \frac{\frac{i \cdot i}{\color{blue}{\left(i \cdot \left(2 \cdot i\right)\right) \cdot 2}}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
associate-/r* [=>]31.4 | \[ \frac{\color{blue}{\frac{\frac{i \cdot i}{i \cdot \left(2 \cdot i\right)}}{2}}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
*-commutative [=>]31.4 | \[ \frac{\frac{\frac{i \cdot i}{i \cdot \color{blue}{\left(i \cdot 2\right)}}}{2}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
associate-*r* [=>]31.4 | \[ \frac{\frac{\frac{i \cdot i}{\color{blue}{\left(i \cdot i\right) \cdot 2}}}{2}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
associate-/r* [=>]31.4 | \[ \frac{\frac{\color{blue}{\frac{\frac{i \cdot i}{i \cdot i}}{2}}}{2}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
*-inverses [=>]16.4 | \[ \frac{\frac{\frac{\color{blue}{1}}{2}}{2}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
metadata-eval [=>]16.4 | \[ \frac{\frac{\color{blue}{0.5}}{2}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
metadata-eval [=>]16.4 | \[ \frac{\color{blue}{0.25}}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}{i \cdot i}}
\] |
*-inverses [<=]16.4 | \[ \frac{0.25}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - \color{blue}{\frac{i}{i}}}{i \cdot i}}
\] |
div-sub [=>]31.4 | \[ \frac{0.25}{\color{blue}{\frac{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}{i \cdot i} - \frac{\frac{i}{i}}{i \cdot i}}}
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.5 |
| Cost | 580 |
| Alternative 2 | |
|---|---|
| Error | 0.7 |
| Cost | 452 |
| Alternative 3 | |
|---|---|
| Error | 31.5 |
| Cost | 64 |
herbie shell --seed 2023053
(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)))