Octave 3.8, jcobi/4, as called

Percentage Accurate: 27.5% → 99.6%
Time: 7.9s
Alternatives: 7
Speedup: 25.0×

Specification

?
\[i > 0\]
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\\ \frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{t\_0}}{t\_0 - 1} \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (let* ((t_0 (* (* 2.0 i) (* 2.0 i))))
   (/ (/ (* (* i i) (* i i)) t_0) (- t_0 1.0))))
double code(double i) {
	double t_0 = (2.0 * i) * (2.0 * i);
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
}
real(8) function code(i)
    real(8), intent (in) :: i
    real(8) :: t_0
    t_0 = (2.0d0 * i) * (2.0d0 * i)
    code = (((i * i) * (i * i)) / t_0) / (t_0 - 1.0d0)
end function
public static double code(double i) {
	double t_0 = (2.0 * i) * (2.0 * i);
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
}
def code(i):
	t_0 = (2.0 * i) * (2.0 * i)
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0)
function code(i)
	t_0 = Float64(Float64(2.0 * i) * Float64(2.0 * i))
	return Float64(Float64(Float64(Float64(i * i) * Float64(i * i)) / t_0) / Float64(t_0 - 1.0))
end
function tmp = code(i)
	t_0 = (2.0 * i) * (2.0 * i);
	tmp = (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
end
code[i_] := Block[{t$95$0 = N[(N[(2.0 * i), $MachinePrecision] * N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(i * i), $MachinePrecision] * N[(i * i), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\\
\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{t\_0}}{t\_0 - 1}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 27.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\\ \frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{t\_0}}{t\_0 - 1} \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (let* ((t_0 (* (* 2.0 i) (* 2.0 i))))
   (/ (/ (* (* i i) (* i i)) t_0) (- t_0 1.0))))
double code(double i) {
	double t_0 = (2.0 * i) * (2.0 * i);
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
}
real(8) function code(i)
    real(8), intent (in) :: i
    real(8) :: t_0
    t_0 = (2.0d0 * i) * (2.0d0 * i)
    code = (((i * i) * (i * i)) / t_0) / (t_0 - 1.0d0)
end function
public static double code(double i) {
	double t_0 = (2.0 * i) * (2.0 * i);
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
}
def code(i):
	t_0 = (2.0 * i) * (2.0 * i)
	return (((i * i) * (i * i)) / t_0) / (t_0 - 1.0)
function code(i)
	t_0 = Float64(Float64(2.0 * i) * Float64(2.0 * i))
	return Float64(Float64(Float64(Float64(i * i) * Float64(i * i)) / t_0) / Float64(t_0 - 1.0))
end
function tmp = code(i)
	t_0 = (2.0 * i) * (2.0 * i);
	tmp = (((i * i) * (i * i)) / t_0) / (t_0 - 1.0);
end
code[i_] := Block[{t$95$0 = N[(N[(2.0 * i), $MachinePrecision] * N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(i * i), $MachinePrecision] * N[(i * i), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\\
\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{t\_0}}{t\_0 - 1}
\end{array}
\end{array}

Alternative 1: 99.6% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \frac{i}{i \cdot 16 + \frac{-4}{i}} \end{array} \]
(FPCore (i) :precision binary64 (/ i (+ (* i 16.0) (/ -4.0 i))))
double code(double i) {
	return i / ((i * 16.0) + (-4.0 / i));
}
real(8) function code(i)
    real(8), intent (in) :: i
    code = i / ((i * 16.0d0) + ((-4.0d0) / i))
end function
public static double code(double i) {
	return i / ((i * 16.0) + (-4.0 / i));
}
def code(i):
	return i / ((i * 16.0) + (-4.0 / i))
function code(i)
	return Float64(i / Float64(Float64(i * 16.0) + Float64(-4.0 / i)))
end
function tmp = code(i)
	tmp = i / ((i * 16.0) + (-4.0 / i));
end
code[i_] := N[(i / N[(N[(i * 16.0), $MachinePrecision] + N[(-4.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{i}{i \cdot 16 + \frac{-4}{i}}
\end{array}
Derivation
  1. Initial program 29.3%

    \[\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. Step-by-step derivation
    1. associate-/l/N/A

      \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
    2. associate-*l*N/A

      \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
    3. associate-/l*N/A

      \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
    5. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
    6. associate-*r*N/A

      \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
    7. times-fracN/A

      \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
    8. *-inversesN/A

      \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
    9. *-rgt-identityN/A

      \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
  3. Simplified74.5%

    \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto i \cdot \frac{1}{\color{blue}{\frac{\left(i \cdot i\right) \cdot 16 + -4}{i}}} \]
    2. un-div-invN/A

      \[\leadsto \frac{i}{\color{blue}{\frac{\left(i \cdot i\right) \cdot 16 + -4}{i}}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(i, \color{blue}{\left(\frac{\left(i \cdot i\right) \cdot 16 + -4}{i}\right)}\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{/.f64}\left(\left(\left(i \cdot i\right) \cdot 16 + -4\right), \color{blue}{i}\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\left(i \cdot i\right) \cdot 16\right), -4\right), i\right)\right) \]
    6. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(i \cdot \left(i \cdot 16\right)\right), -4\right), i\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(i, \left(i \cdot 16\right)\right), -4\right), i\right)\right) \]
    8. *-lowering-*.f6474.5%

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, 16\right)\right), -4\right), i\right)\right) \]
  6. Applied egg-rr74.5%

    \[\leadsto \color{blue}{\frac{i}{\frac{i \cdot \left(i \cdot 16\right) + -4}{i}}} \]
  7. Taylor expanded in i around 0

    \[\leadsto \mathsf{/.f64}\left(i, \color{blue}{\left(\frac{16 \cdot {i}^{2} - 4}{i}\right)}\right) \]
  8. Step-by-step derivation
    1. div-subN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(\frac{16 \cdot {i}^{2}}{i} - \color{blue}{\frac{4}{i}}\right)\right) \]
    2. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \frac{{i}^{2}}{i} - \frac{\color{blue}{4}}{i}\right)\right) \]
    3. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \frac{i \cdot i}{i} - \frac{4}{i}\right)\right) \]
    4. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \left(i \cdot \frac{i}{i}\right) - \frac{4}{i}\right)\right) \]
    5. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \left(i \cdot \frac{i \cdot 1}{i}\right) - \frac{4}{i}\right)\right) \]
    6. associate-*r/N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \left(i \cdot \left(i \cdot \frac{1}{i}\right)\right) - \frac{4}{i}\right)\right) \]
    7. rgt-mult-inverseN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot \left(i \cdot 1\right) - \frac{4}{i}\right)\right) \]
    8. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{i}\right)\right) \]
    9. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{i \cdot \color{blue}{1}}\right)\right) \]
    10. rgt-mult-inverseN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{i \cdot \left(i \cdot \color{blue}{\frac{1}{i}}\right)}\right)\right) \]
    11. associate-*r/N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{i \cdot \frac{i \cdot 1}{\color{blue}{i}}}\right)\right) \]
    12. *-rgt-identityN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{i \cdot \frac{i}{i}}\right)\right) \]
    13. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{\frac{i \cdot i}{\color{blue}{i}}}\right)\right) \]
    14. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{\frac{{i}^{2}}{i}}\right)\right) \]
    15. associate-/r/N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4}{{i}^{2}} \cdot \color{blue}{i}\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \frac{4 \cdot 1}{{i}^{2}} \cdot i\right)\right) \]
    17. associate-*r/N/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i - \left(4 \cdot \frac{1}{{i}^{2}}\right) \cdot i\right)\right) \]
    18. unsub-negN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i + \color{blue}{\left(\mathsf{neg}\left(\left(4 \cdot \frac{1}{{i}^{2}}\right) \cdot i\right)\right)}\right)\right) \]
    19. distribute-lft-neg-outN/A

      \[\leadsto \mathsf{/.f64}\left(i, \left(16 \cdot i + \left(\mathsf{neg}\left(4 \cdot \frac{1}{{i}^{2}}\right)\right) \cdot \color{blue}{i}\right)\right) \]
    20. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(i, \mathsf{+.f64}\left(\left(16 \cdot i\right), \color{blue}{\left(\left(\mathsf{neg}\left(4 \cdot \frac{1}{{i}^{2}}\right)\right) \cdot i\right)}\right)\right) \]
  9. Simplified99.9%

    \[\leadsto \frac{i}{\color{blue}{i \cdot 16 + \frac{-4}{i}}} \]
  10. Add Preprocessing

Alternative 2: 99.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\left(i \cdot i\right) \cdot \left(-0.25 - i \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\ \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (if (<= i 0.5) (* (* i i) (- -0.25 (* i i))) (+ 0.0625 (/ 0.015625 (* i i)))))
double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = (i * i) * (-0.25 - (i * i));
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
real(8) function code(i)
    real(8), intent (in) :: i
    real(8) :: tmp
    if (i <= 0.5d0) then
        tmp = (i * i) * ((-0.25d0) - (i * i))
    else
        tmp = 0.0625d0 + (0.015625d0 / (i * i))
    end if
    code = tmp
end function
public static double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = (i * i) * (-0.25 - (i * i));
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
def code(i):
	tmp = 0
	if i <= 0.5:
		tmp = (i * i) * (-0.25 - (i * i))
	else:
		tmp = 0.0625 + (0.015625 / (i * i))
	return tmp
function code(i)
	tmp = 0.0
	if (i <= 0.5)
		tmp = Float64(Float64(i * i) * Float64(-0.25 - Float64(i * i)));
	else
		tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i)));
	end
	return tmp
end
function tmp_2 = code(i)
	tmp = 0.0;
	if (i <= 0.5)
		tmp = (i * i) * (-0.25 - (i * i));
	else
		tmp = 0.0625 + (0.015625 / (i * i));
	end
	tmp_2 = tmp;
end
code[i_] := If[LessEqual[i, 0.5], N[(N[(i * i), $MachinePrecision] * N[(-0.25 - N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 0.5:\\
\;\;\;\;\left(i \cdot i\right) \cdot \left(-0.25 - i \cdot i\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 0.5

    1. Initial program 36.2%

      \[\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. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      2. associate-*l*N/A

        \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
      3. associate-/l*N/A

        \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around 0

      \[\leadsto \color{blue}{{i}^{2} \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)} \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \left(i \cdot i\right) \cdot \left(\color{blue}{-1 \cdot {i}^{2}} - \frac{1}{4}\right) \]
      2. associate-*l*N/A

        \[\leadsto i \cdot \color{blue}{\left(i \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(i \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \color{blue}{\left(-1 \cdot {i}^{2} - \frac{1}{4}\right)}\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(-1 \cdot {i}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(-1 \cdot {i}^{2} + \frac{-1}{4}\right)\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} + \color{blue}{-1 \cdot {i}^{2}}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} + \left(\mathsf{neg}\left({i}^{2}\right)\right)\right)\right)\right) \]
      9. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} - \color{blue}{{i}^{2}}\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \color{blue}{\left({i}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \left(i \cdot \color{blue}{i}\right)\right)\right)\right) \]
      12. *-lowering-*.f6499.6%

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right)\right)\right) \]
    7. Simplified99.6%

      \[\leadsto \color{blue}{i \cdot \left(i \cdot \left(-0.25 - i \cdot i\right)\right)} \]
    8. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \left(i \cdot i\right) \cdot \color{blue}{\left(\frac{-1}{4} - i \cdot i\right)} \]
      2. *-commutativeN/A

        \[\leadsto \left(\frac{-1}{4} - i \cdot i\right) \cdot \color{blue}{\left(i \cdot i\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{-1}{4} - i \cdot i\right), \color{blue}{\left(i \cdot i\right)}\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{-1}{4}, \left(i \cdot i\right)\right), \left(\color{blue}{i} \cdot i\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(i, i\right)\right), \left(i \cdot i\right)\right) \]
      6. *-lowering-*.f6499.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(i, i\right)\right), \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right) \]
    9. Applied egg-rr99.6%

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

    if 0.5 < i

    1. Initial program 22.2%

      \[\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. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      2. associate-*l*N/A

        \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
      3. associate-/l*N/A

        \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
    3. Simplified48.3%

      \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around inf

      \[\leadsto \color{blue}{\frac{1}{16} + \frac{1}{64} \cdot \frac{1}{{i}^{2}}} \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \color{blue}{\left(\frac{1}{64} \cdot \frac{1}{{i}^{2}}\right)}\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64} \cdot 1}{\color{blue}{{i}^{2}}}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64}}{{\color{blue}{i}}^{2}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \color{blue}{\left({i}^{2}\right)}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \left(i \cdot \color{blue}{i}\right)\right)\right) \]
      6. *-lowering-*.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right)\right) \]
    7. Simplified99.3%

      \[\leadsto \color{blue}{0.0625 + \frac{0.015625}{i \cdot i}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\left(i \cdot i\right) \cdot \left(-0.25 - i \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;i \cdot \left(i \cdot \left(-0.25 - i \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\ \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (if (<= i 0.5) (* i (* i (- -0.25 (* i i)))) (+ 0.0625 (/ 0.015625 (* i i)))))
double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = i * (i * (-0.25 - (i * i)));
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
real(8) function code(i)
    real(8), intent (in) :: i
    real(8) :: tmp
    if (i <= 0.5d0) then
        tmp = i * (i * ((-0.25d0) - (i * i)))
    else
        tmp = 0.0625d0 + (0.015625d0 / (i * i))
    end if
    code = tmp
end function
public static double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = i * (i * (-0.25 - (i * i)));
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
def code(i):
	tmp = 0
	if i <= 0.5:
		tmp = i * (i * (-0.25 - (i * i)))
	else:
		tmp = 0.0625 + (0.015625 / (i * i))
	return tmp
function code(i)
	tmp = 0.0
	if (i <= 0.5)
		tmp = Float64(i * Float64(i * Float64(-0.25 - Float64(i * i))));
	else
		tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i)));
	end
	return tmp
end
function tmp_2 = code(i)
	tmp = 0.0;
	if (i <= 0.5)
		tmp = i * (i * (-0.25 - (i * i)));
	else
		tmp = 0.0625 + (0.015625 / (i * i));
	end
	tmp_2 = tmp;
end
code[i_] := If[LessEqual[i, 0.5], N[(i * N[(i * N[(-0.25 - N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 0.5:\\
\;\;\;\;i \cdot \left(i \cdot \left(-0.25 - i \cdot i\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 0.5

    1. Initial program 36.2%

      \[\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. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      2. associate-*l*N/A

        \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
      3. associate-/l*N/A

        \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around 0

      \[\leadsto \color{blue}{{i}^{2} \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)} \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \left(i \cdot i\right) \cdot \left(\color{blue}{-1 \cdot {i}^{2}} - \frac{1}{4}\right) \]
      2. associate-*l*N/A

        \[\leadsto i \cdot \color{blue}{\left(i \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(i \cdot \left(-1 \cdot {i}^{2} - \frac{1}{4}\right)\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \color{blue}{\left(-1 \cdot {i}^{2} - \frac{1}{4}\right)}\right)\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(-1 \cdot {i}^{2} + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right)}\right)\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(-1 \cdot {i}^{2} + \frac{-1}{4}\right)\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} + \color{blue}{-1 \cdot {i}^{2}}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} + \left(\mathsf{neg}\left({i}^{2}\right)\right)\right)\right)\right) \]
      9. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \left(\frac{-1}{4} - \color{blue}{{i}^{2}}\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \color{blue}{\left({i}^{2}\right)}\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \left(i \cdot \color{blue}{i}\right)\right)\right)\right) \]
      12. *-lowering-*.f6499.6%

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{*.f64}\left(i, \mathsf{\_.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right)\right)\right) \]
    7. Simplified99.6%

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

    if 0.5 < i

    1. Initial program 22.2%

      \[\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. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      2. associate-*l*N/A

        \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
      3. associate-/l*N/A

        \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
    3. Simplified48.3%

      \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around inf

      \[\leadsto \color{blue}{\frac{1}{16} + \frac{1}{64} \cdot \frac{1}{{i}^{2}}} \]
    6. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \color{blue}{\left(\frac{1}{64} \cdot \frac{1}{{i}^{2}}\right)}\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64} \cdot 1}{\color{blue}{{i}^{2}}}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64}}{{\color{blue}{i}}^{2}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \color{blue}{\left({i}^{2}\right)}\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \left(i \cdot \color{blue}{i}\right)\right)\right) \]
      6. *-lowering-*.f6499.3%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right)\right) \]
    7. Simplified99.3%

      \[\leadsto \color{blue}{0.0625 + \frac{0.015625}{i \cdot i}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 99.2% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;i \cdot \frac{i}{-4}\\ \mathbf{else}:\\ \;\;\;\;0.0625 + \frac{0.015625}{i \cdot i}\\ \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (if (<= i 0.5) (* i (/ i -4.0)) (+ 0.0625 (/ 0.015625 (* i i)))))
double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = i * (i / -4.0);
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
real(8) function code(i)
    real(8), intent (in) :: i
    real(8) :: tmp
    if (i <= 0.5d0) then
        tmp = i * (i / (-4.0d0))
    else
        tmp = 0.0625d0 + (0.015625d0 / (i * i))
    end if
    code = tmp
end function
public static double code(double i) {
	double tmp;
	if (i <= 0.5) {
		tmp = i * (i / -4.0);
	} else {
		tmp = 0.0625 + (0.015625 / (i * i));
	}
	return tmp;
}
def code(i):
	tmp = 0
	if i <= 0.5:
		tmp = i * (i / -4.0)
	else:
		tmp = 0.0625 + (0.015625 / (i * i))
	return tmp
function code(i)
	tmp = 0.0
	if (i <= 0.5)
		tmp = Float64(i * Float64(i / -4.0));
	else
		tmp = Float64(0.0625 + Float64(0.015625 / Float64(i * i)));
	end
	return tmp
end
function tmp_2 = code(i)
	tmp = 0.0;
	if (i <= 0.5)
		tmp = i * (i / -4.0);
	else
		tmp = 0.0625 + (0.015625 / (i * i));
	end
	tmp_2 = tmp;
end
code[i_] := If[LessEqual[i, 0.5], N[(i * N[(i / -4.0), $MachinePrecision]), $MachinePrecision], N[(0.0625 + N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 0.5:\\
\;\;\;\;i \cdot \frac{i}{-4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 0.5

    1. Initial program 36.2%

      \[\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. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      2. associate-*l*N/A

        \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
      3. associate-/l*N/A

        \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
      7. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
      8. *-inversesN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
      9. *-rgt-identityN/A

        \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around 0

      \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{-4}\right)\right) \]
    6. Step-by-step derivation
      1. Simplified99.1%

        \[\leadsto i \cdot \frac{i}{\color{blue}{-4}} \]

      if 0.5 < i

      1. Initial program 22.2%

        \[\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. Step-by-step derivation
        1. associate-/l/N/A

          \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
        2. associate-*l*N/A

          \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
        3. associate-/l*N/A

          \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
        5. swap-sqrN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
        6. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
        7. times-fracN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
        8. *-inversesN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
        9. *-rgt-identityN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
        10. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
      3. Simplified48.3%

        \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
      4. Add Preprocessing
      5. Taylor expanded in i around inf

        \[\leadsto \color{blue}{\frac{1}{16} + \frac{1}{64} \cdot \frac{1}{{i}^{2}}} \]
      6. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \color{blue}{\left(\frac{1}{64} \cdot \frac{1}{{i}^{2}}\right)}\right) \]
        2. associate-*r/N/A

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64} \cdot 1}{\color{blue}{{i}^{2}}}\right)\right) \]
        3. metadata-evalN/A

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \left(\frac{\frac{1}{64}}{{\color{blue}{i}}^{2}}\right)\right) \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \color{blue}{\left({i}^{2}\right)}\right)\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \left(i \cdot \color{blue}{i}\right)\right)\right) \]
        6. *-lowering-*.f6499.3%

          \[\leadsto \mathsf{+.f64}\left(\frac{1}{16}, \mathsf{/.f64}\left(\frac{1}{64}, \mathsf{*.f64}\left(i, \color{blue}{i}\right)\right)\right) \]
      7. Simplified99.3%

        \[\leadsto \color{blue}{0.0625 + \frac{0.015625}{i \cdot i}} \]
    7. Recombined 2 regimes into one program.
    8. Add Preprocessing

    Alternative 5: 99.0% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;i \cdot \frac{i}{-4}\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
    (FPCore (i) :precision binary64 (if (<= i 0.5) (* i (/ i -4.0)) 0.0625))
    double code(double i) {
    	double tmp;
    	if (i <= 0.5) {
    		tmp = i * (i / -4.0);
    	} else {
    		tmp = 0.0625;
    	}
    	return tmp;
    }
    
    real(8) function code(i)
        real(8), intent (in) :: i
        real(8) :: tmp
        if (i <= 0.5d0) then
            tmp = i * (i / (-4.0d0))
        else
            tmp = 0.0625d0
        end if
        code = tmp
    end function
    
    public static double code(double i) {
    	double tmp;
    	if (i <= 0.5) {
    		tmp = i * (i / -4.0);
    	} else {
    		tmp = 0.0625;
    	}
    	return tmp;
    }
    
    def code(i):
    	tmp = 0
    	if i <= 0.5:
    		tmp = i * (i / -4.0)
    	else:
    		tmp = 0.0625
    	return tmp
    
    function code(i)
    	tmp = 0.0
    	if (i <= 0.5)
    		tmp = Float64(i * Float64(i / -4.0));
    	else
    		tmp = 0.0625;
    	end
    	return tmp
    end
    
    function tmp_2 = code(i)
    	tmp = 0.0;
    	if (i <= 0.5)
    		tmp = i * (i / -4.0);
    	else
    		tmp = 0.0625;
    	end
    	tmp_2 = tmp;
    end
    
    code[i_] := If[LessEqual[i, 0.5], N[(i * N[(i / -4.0), $MachinePrecision]), $MachinePrecision], 0.0625]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;i \leq 0.5:\\
    \;\;\;\;i \cdot \frac{i}{-4}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.0625\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if i < 0.5

      1. Initial program 36.2%

        \[\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. Step-by-step derivation
        1. associate-/l/N/A

          \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
        2. associate-*l*N/A

          \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
        3. associate-/l*N/A

          \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
        5. swap-sqrN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
        6. associate-*r*N/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
        7. times-fracN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
        8. *-inversesN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
        9. *-rgt-identityN/A

          \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
        10. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
      3. Simplified100.0%

        \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
      4. Add Preprocessing
      5. Taylor expanded in i around 0

        \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{-4}\right)\right) \]
      6. Step-by-step derivation
        1. Simplified99.1%

          \[\leadsto i \cdot \frac{i}{\color{blue}{-4}} \]

        if 0.5 < i

        1. Initial program 22.2%

          \[\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. Step-by-step derivation
          1. associate-/l/N/A

            \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
          2. associate-*l*N/A

            \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
          3. associate-/l*N/A

            \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
          5. swap-sqrN/A

            \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
          6. associate-*r*N/A

            \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
          7. times-fracN/A

            \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
          8. *-inversesN/A

            \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
          9. *-rgt-identityN/A

            \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
        3. Simplified48.3%

          \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
        4. Add Preprocessing
        5. Taylor expanded in i around inf

          \[\leadsto \color{blue}{\frac{1}{16}} \]
        6. Step-by-step derivation
          1. Simplified98.5%

            \[\leadsto \color{blue}{0.0625} \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 6: 52.9% accurate, 3.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;i \cdot -0.125\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
        (FPCore (i) :precision binary64 (if (<= i 0.5) (* i -0.125) 0.0625))
        double code(double i) {
        	double tmp;
        	if (i <= 0.5) {
        		tmp = i * -0.125;
        	} else {
        		tmp = 0.0625;
        	}
        	return tmp;
        }
        
        real(8) function code(i)
            real(8), intent (in) :: i
            real(8) :: tmp
            if (i <= 0.5d0) then
                tmp = i * (-0.125d0)
            else
                tmp = 0.0625d0
            end if
            code = tmp
        end function
        
        public static double code(double i) {
        	double tmp;
        	if (i <= 0.5) {
        		tmp = i * -0.125;
        	} else {
        		tmp = 0.0625;
        	}
        	return tmp;
        }
        
        def code(i):
        	tmp = 0
        	if i <= 0.5:
        		tmp = i * -0.125
        	else:
        		tmp = 0.0625
        	return tmp
        
        function code(i)
        	tmp = 0.0
        	if (i <= 0.5)
        		tmp = Float64(i * -0.125);
        	else
        		tmp = 0.0625;
        	end
        	return tmp
        end
        
        function tmp_2 = code(i)
        	tmp = 0.0;
        	if (i <= 0.5)
        		tmp = i * -0.125;
        	else
        		tmp = 0.0625;
        	end
        	tmp_2 = tmp;
        end
        
        code[i_] := If[LessEqual[i, 0.5], N[(i * -0.125), $MachinePrecision], 0.0625]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;i \leq 0.5:\\
        \;\;\;\;i \cdot -0.125\\
        
        \mathbf{else}:\\
        \;\;\;\;0.0625\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if i < 0.5

          1. Initial program 36.2%

            \[\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. Add Preprocessing
          3. Step-by-step derivation
            1. difference-of-sqr-1N/A

              \[\leadsto \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 + 1\right) \cdot \color{blue}{\left(2 \cdot i - 1\right)}} \]
            2. associate-/r*N/A

              \[\leadsto \frac{\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}{2 \cdot i + 1}}{\color{blue}{2 \cdot i - 1}} \]
            3. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}{2 \cdot i + 1}\right), \color{blue}{\left(2 \cdot i - 1\right)}\right) \]
          4. Applied egg-rr100.0%

            \[\leadsto \color{blue}{\frac{\frac{\frac{i}{4} \cdot i}{i \cdot 2 + 1}}{i \cdot 2 + -1}} \]
          5. Taylor expanded in i around inf

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(\frac{1}{8} \cdot i\right)}, \mathsf{+.f64}\left(\mathsf{*.f64}\left(i, 2\right), -1\right)\right) \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \mathsf{/.f64}\left(\left(i \cdot \frac{1}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(i, 2\right)}, -1\right)\right) \]
            2. *-lowering-*.f647.1%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(i, \frac{1}{8}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(i, 2\right)}, -1\right)\right) \]
          7. Simplified7.1%

            \[\leadsto \frac{\color{blue}{i \cdot 0.125}}{i \cdot 2 + -1} \]
          8. Taylor expanded in i around 0

            \[\leadsto \color{blue}{\frac{-1}{8} \cdot i} \]
          9. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto i \cdot \color{blue}{\frac{-1}{8}} \]
            2. *-lowering-*.f647.1%

              \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\frac{-1}{8}}\right) \]
          10. Simplified7.1%

            \[\leadsto \color{blue}{i \cdot -0.125} \]

          if 0.5 < i

          1. Initial program 22.2%

            \[\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. Step-by-step derivation
            1. associate-/l/N/A

              \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
            2. associate-*l*N/A

              \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
            3. associate-/l*N/A

              \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
            5. swap-sqrN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
            6. associate-*r*N/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
            7. times-fracN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
            8. *-inversesN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
            9. *-rgt-identityN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
            10. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
          3. Simplified48.3%

            \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
          4. Add Preprocessing
          5. Taylor expanded in i around inf

            \[\leadsto \color{blue}{\frac{1}{16}} \]
          6. Step-by-step derivation
            1. Simplified98.5%

              \[\leadsto \color{blue}{0.0625} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 7: 50.7% accurate, 25.0× speedup?

          \[\begin{array}{l} \\ 0.0625 \end{array} \]
          (FPCore (i) :precision binary64 0.0625)
          double code(double i) {
          	return 0.0625;
          }
          
          real(8) function code(i)
              real(8), intent (in) :: i
              code = 0.0625d0
          end function
          
          public static double code(double i) {
          	return 0.0625;
          }
          
          def code(i):
          	return 0.0625
          
          function code(i)
          	return 0.0625
          end
          
          function tmp = code(i)
          	tmp = 0.0625;
          end
          
          code[i_] := 0.0625
          
          \begin{array}{l}
          
          \\
          0.0625
          \end{array}
          
          Derivation
          1. Initial program 29.3%

            \[\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. Step-by-step derivation
            1. associate-/l/N/A

              \[\leadsto \frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
            2. associate-*l*N/A

              \[\leadsto \frac{i \cdot \left(i \cdot \left(i \cdot i\right)\right)}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)} \]
            3. associate-/l*N/A

              \[\leadsto i \cdot \color{blue}{\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}} \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(i, \color{blue}{\left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)\right)}\right)}\right) \]
            5. swap-sqrN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}\right)}\right)\right) \]
            6. associate-*r*N/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i \cdot \left(i \cdot i\right)}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right) \cdot \color{blue}{\left(i \cdot i\right)}}\right)\right) \]
            7. times-fracN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot \color{blue}{\frac{i \cdot i}{i \cdot i}}\right)\right) \]
            8. *-inversesN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)} \cdot 1\right)\right) \]
            9. *-rgt-identityN/A

              \[\leadsto \mathsf{*.f64}\left(i, \left(\frac{i}{\color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)}}\right)\right) \]
            10. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \color{blue}{\left(\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \left(2 \cdot 2\right)\right)}\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{*.f64}\left(i, \mathsf{/.f64}\left(i, \left(\left(2 \cdot 2\right) \cdot \color{blue}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}\right)\right)\right) \]
          3. Simplified74.5%

            \[\leadsto \color{blue}{i \cdot \frac{i}{\left(i \cdot i\right) \cdot 16 + -4}} \]
          4. Add Preprocessing
          5. Taylor expanded in i around inf

            \[\leadsto \color{blue}{\frac{1}{16}} \]
          6. Step-by-step derivation
            1. Simplified49.8%

              \[\leadsto \color{blue}{0.0625} \]
            2. Add Preprocessing

            Reproduce

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