Average Error: 47.2 → 0.9
Time: 4.0s
Precision: binary64
Cost: 580
\[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} \]
\[\begin{array}{l} \mathbf{if}\;i \leq 2.6384356558157094 \cdot 10^{-7}:\\ \;\;\;\;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
 (if (<= i 2.6384356558157094e-7)
   (* i (* i -0.25))
   (+ 0.0625 (/ (/ 0.015625 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) {
	double tmp;
	if (i <= 2.6384356558157094e-7) {
		tmp = i * (i * -0.25);
	} else {
		tmp = 0.0625 + ((0.015625 / i) / i);
	}
	return tmp;
}
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
    real(8) :: tmp
    if (i <= 2.6384356558157094d-7) then
        tmp = i * (i * (-0.25d0))
    else
        tmp = 0.0625d0 + ((0.015625d0 / i) / i)
    end if
    code = tmp
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) {
	double tmp;
	if (i <= 2.6384356558157094e-7) {
		tmp = i * (i * -0.25);
	} else {
		tmp = 0.0625 + ((0.015625 / i) / i);
	}
	return tmp;
}
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):
	tmp = 0
	if i <= 2.6384356558157094e-7:
		tmp = i * (i * -0.25)
	else:
		tmp = 0.0625 + ((0.015625 / i) / i)
	return tmp
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)
	tmp = 0.0
	if (i <= 2.6384356558157094e-7)
		tmp = Float64(i * Float64(i * -0.25));
	else
		tmp = Float64(0.0625 + Float64(Float64(0.015625 / i) / i));
	end
	return tmp
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_2 = code(i)
	tmp = 0.0;
	if (i <= 2.6384356558157094e-7)
		tmp = i * (i * -0.25);
	else
		tmp = 0.0625 + ((0.015625 / i) / i);
	end
	tmp_2 = tmp;
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_] := If[LessEqual[i, 2.6384356558157094e-7], N[(i * N[(i * -0.25), $MachinePrecision]), $MachinePrecision], N[(0.0625 + N[(N[(0.015625 / i), $MachinePrecision] / i), $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}
\begin{array}{l}
\mathbf{if}\;i \leq 2.6384356558157094 \cdot 10^{-7}:\\
\;\;\;\;i \cdot \left(i \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;0.0625 + \frac{\frac{0.015625}{i}}{i}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if i < 2.63843565581570943e-7

    1. Initial program 47.5

      \[\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. Taylor expanded in i around 0 0.0

      \[\leadsto \color{blue}{-0.25 \cdot {i}^{2}} \]
    3. Simplified0.0

      \[\leadsto \color{blue}{i \cdot \left(i \cdot -0.25\right)} \]
      Proof
      (*.f64 i (*.f64 i -1/4)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 i i) -1/4)): 1 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 i 2)) -1/4): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 -1/4 (pow.f64 i 2))): 0 points increase in error, 0 points decrease in error

    if 2.63843565581570943e-7 < i

    1. Initial program 46.9

      \[\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. Taylor expanded in i around inf 1.6

      \[\leadsto \color{blue}{0.0625 + 0.015625 \cdot \frac{1}{{i}^{2}}} \]
    3. Simplified1.6

      \[\leadsto \color{blue}{0.0625 + \frac{\frac{0.015625}{i}}{i}} \]
      Proof
      (+.f64 1/16 (/.f64 (/.f64 1/64 i) i)): 0 points increase in error, 0 points decrease in error
      (+.f64 1/16 (Rewrite<= associate-/r*_binary64 (/.f64 1/64 (*.f64 i i)))): 4 points increase in error, 13 points decrease in error
      (+.f64 1/16 (/.f64 (Rewrite<= metadata-eval (*.f64 1/64 1)) (*.f64 i i))): 0 points increase in error, 0 points decrease in error
      (+.f64 1/16 (/.f64 (*.f64 1/64 1) (Rewrite<= unpow2_binary64 (pow.f64 i 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1/16 (Rewrite<= associate-*r/_binary64 (*.f64 1/64 (/.f64 1 (pow.f64 i 2))))): 1 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 2.6384356558157094 \cdot 10^{-7}:\\ \;\;\;\;i \cdot \left(i \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{\frac{0.015625}{i}}{i}\\ \end{array} \]

Alternatives

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

Error

Reproduce

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