Average Error: 46.1 → 0.0
Time: 2.3s
Precision: binary64
\[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 15556.696512906221:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(i \cdot 0.5\right)}^{2}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + 0.015625 \cdot \sqrt{{i}^{-4}}\\ \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 15556.696512906221)
   (expm1 (log1p (/ (pow (* i 0.5) 2.0) (fma i (* i 4.0) -1.0))))
   (+ 0.0625 (* 0.015625 (sqrt (pow i -4.0))))))
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 <= 15556.696512906221) {
		tmp = expm1(log1p((pow((i * 0.5), 2.0) / fma(i, (i * 4.0), -1.0))));
	} else {
		tmp = 0.0625 + (0.015625 * sqrt(pow(i, -4.0)));
	}
	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 <= 15556.696512906221)
		tmp = expm1(log1p(Float64((Float64(i * 0.5) ^ 2.0) / fma(i, Float64(i * 4.0), -1.0))));
	else
		tmp = Float64(0.0625 + Float64(0.015625 * sqrt((i ^ -4.0))));
	end
	return 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, 15556.696512906221], N[(Exp[N[Log[1 + N[(N[Power[N[(i * 0.5), $MachinePrecision], 2.0], $MachinePrecision] / N[(i * N[(i * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision], N[(0.0625 + N[(0.015625 * N[Sqrt[N[Power[i, -4.0], $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}
\begin{array}{l}
\mathbf{if}\;i \leq 15556.696512906221:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(i \cdot 0.5\right)}^{2}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.0625 + 0.015625 \cdot \sqrt{{i}^{-4}}\\


\end{array}

Error

Bits error versus i

Derivation

  1. Split input into 2 regimes
  2. if i < 15556.696512906221

    1. Initial program 43.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} \]
    2. Taylor expanded in i around 0 0.0

      \[\leadsto \frac{\color{blue}{0.25 \cdot {i}^{2}}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \]
    3. Applied egg-rr0.0

      \[\leadsto \frac{\color{blue}{{\left(i \cdot 0.5\right)}^{2}}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \]
    4. Applied egg-rr0.0

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(i \cdot 0.5\right)}^{2}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)\right)} \]

    if 15556.696512906221 < i

    1. Initial program 48.6

      \[\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 0

      \[\leadsto \color{blue}{0.0625 + 0.015625 \cdot \frac{1}{{i}^{2}}} \]
    3. Applied egg-rr0

      \[\leadsto 0.0625 + 0.015625 \cdot \color{blue}{\sqrt{{i}^{-4}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 15556.696512906221:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(i \cdot 0.5\right)}^{2}}{\mathsf{fma}\left(i, i \cdot 4, -1\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + 0.015625 \cdot \sqrt{{i}^{-4}}\\ \end{array} \]

Reproduce

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