Average Error: 46.3 → 0.0
Time: 2.4s
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 1.5106064694716 \cdot 10^{-16}:\\ \;\;\;\;i \cdot \left(i \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{16 - {i}^{-4}}\right)\right) \cdot \left({i}^{-2} + 4\right)\\ \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 1.5106064694716e-16)
   (* i (* i -0.25))
   (* (log1p (expm1 (/ 0.25 (- 16.0 (pow i -4.0))))) (+ (pow i -2.0) 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 <= 1.5106064694716e-16) {
		tmp = i * (i * -0.25);
	} else {
		tmp = log1p(expm1((0.25 / (16.0 - pow(i, -4.0))))) * (pow(i, -2.0) + 4.0);
	}
	return tmp;
}
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 <= 1.5106064694716e-16) {
		tmp = i * (i * -0.25);
	} else {
		tmp = Math.log1p(Math.expm1((0.25 / (16.0 - Math.pow(i, -4.0))))) * (Math.pow(i, -2.0) + 4.0);
	}
	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 <= 1.5106064694716e-16:
		tmp = i * (i * -0.25)
	else:
		tmp = math.log1p(math.expm1((0.25 / (16.0 - math.pow(i, -4.0))))) * (math.pow(i, -2.0) + 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 <= 1.5106064694716e-16)
		tmp = Float64(i * Float64(i * -0.25));
	else
		tmp = Float64(log1p(expm1(Float64(0.25 / Float64(16.0 - (i ^ -4.0))))) * Float64((i ^ -2.0) + 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, 1.5106064694716e-16], N[(i * N[(i * -0.25), $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(Exp[N[(0.25 / N[(16.0 - N[Power[i, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[(N[Power[i, -2.0], $MachinePrecision] + 4.0), $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 1.5106064694716 \cdot 10^{-16}:\\
\;\;\;\;i \cdot \left(i \cdot -0.25\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{16 - {i}^{-4}}\right)\right) \cdot \left({i}^{-2} + 4\right)\\


\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 < 1.51060646947160006e-16

    1. Initial program 46.8

      \[\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. Simplified10.1

      \[\leadsto \color{blue}{\frac{0.25}{4 - \frac{i}{{i}^{3}}}} \]
    3. Taylor expanded in i around 0 0.0

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

      \[\leadsto \color{blue}{i \cdot \left(i \cdot -0.25\right)} \]

    if 1.51060646947160006e-16 < i

    1. Initial program 45.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. Simplified0.0

      \[\leadsto \color{blue}{\frac{0.25}{4 - \frac{i}{{i}^{3}}}} \]
    3. Applied egg-rr0.0

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

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{16 - {i}^{-4}}\right)\right)} \cdot \left({i}^{-2} + 4\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 1.5106064694716 \cdot 10^{-16}:\\ \;\;\;\;i \cdot \left(i \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{0.25}{16 - {i}^{-4}}\right)\right) \cdot \left({i}^{-2} + 4\right)\\ \end{array} \]

Reproduce

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