Average Error: 46.4 → 0.1
Time: 5.5s
Precision: binary64
Cost: 704
\[i > 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} \]
\[\frac{i \cdot 0.25}{i \cdot 4 + \frac{-1}{i}} \]
(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 0.25) (+ (* i 4.0) (/ -1.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 * 0.25) / ((i * 4.0) + (-1.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 * 0.25d0) / ((i * 4.0d0) + ((-1.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 * 0.25) / ((i * 4.0) + (-1.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 * 0.25) / ((i * 4.0) + (-1.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(Float64(i * 0.25) / Float64(Float64(i * 4.0) + Float64(-1.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 * 0.25) / ((i * 4.0) + (-1.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[(N[(i * 0.25), $MachinePrecision] / N[(N[(i * 4.0), $MachinePrecision] + N[(-1.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 \cdot 0.25}{i \cdot 4 + \frac{-1}{i}}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 46.4

    \[\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} \]
  2. Applied egg-rr31.2

    \[\leadsto \color{blue}{\frac{i \cdot i}{\mathsf{fma}\left(i, i \cdot 4, -1\right)} \cdot \frac{i \cdot i}{i \cdot \left(i \cdot 4\right)}} \]
  3. Applied egg-rr15.6

    \[\leadsto \color{blue}{\frac{i \cdot 0.25}{\frac{\mathsf{fma}\left(i, i \cdot 4, -1\right)}{i}}} \]
  4. Taylor expanded in i around 0 0.1

    \[\leadsto \frac{i \cdot 0.25}{\color{blue}{4 \cdot i - \frac{1}{i}}} \]
  5. Final simplification0.1

    \[\leadsto \frac{i \cdot 0.25}{i \cdot 4 + \frac{-1}{i}} \]

Alternatives

Alternative 1
Error0.5
Cost580
\[\begin{array}{l} \mathbf{if}\;i \leq 0.49995021202956225:\\ \;\;\;\;i \cdot \left(i \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{\frac{0.015625}{i}}{i}\\ \end{array} \]
Alternative 2
Error0.3
Cost576
\[\frac{0.25}{4 + \frac{-1}{i \cdot i}} \]
Alternative 3
Error0.7
Cost452
\[\begin{array}{l} \mathbf{if}\;i \leq 0.49995021202956225:\\ \;\;\;\;i \cdot \left(i \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \]
Alternative 4
Error31.1
Cost64
\[0.0625 \]

Error

Reproduce

herbie shell --seed 2022325 
(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)))