Octave 3.8, jcobi/4, as called

Percentage Accurate: 28.3% → 100.0%
Time: 6.4s
Alternatives: 8
Speedup: 71.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 8 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: 28.3% 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: 100.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 4000000:\\ \;\;\;\;\frac{\left(0.25 \cdot i\right) \cdot i}{\mathsf{fma}\left(i \cdot i, 4, -1\right)}\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
(FPCore (i)
 :precision binary64
 (if (<= i 4000000.0) (/ (* (* 0.25 i) i) (fma (* i i) 4.0 -1.0)) 0.0625))
double code(double i) {
	double tmp;
	if (i <= 4000000.0) {
		tmp = ((0.25 * i) * i) / fma((i * i), 4.0, -1.0);
	} else {
		tmp = 0.0625;
	}
	return tmp;
}
function code(i)
	tmp = 0.0
	if (i <= 4000000.0)
		tmp = Float64(Float64(Float64(0.25 * i) * i) / fma(Float64(i * i), 4.0, -1.0));
	else
		tmp = 0.0625;
	end
	return tmp
end
code[i_] := If[LessEqual[i, 4000000.0], N[(N[(N[(0.25 * i), $MachinePrecision] * i), $MachinePrecision] / N[(N[(i * i), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision]), $MachinePrecision], 0.0625]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 4000000:\\
\;\;\;\;\frac{\left(0.25 \cdot i\right) \cdot i}{\mathsf{fma}\left(i \cdot i, 4, -1\right)}\\

\mathbf{else}:\\
\;\;\;\;0.0625\\


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

    1. Initial program 35.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\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. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\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} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{\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} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{\left(i \cdot i\right) \cdot \left(i \cdot i\right)}{\color{blue}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \]
      5. times-fracN/A

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

        \[\leadsto \color{blue}{\frac{i \cdot i}{2 \cdot i} \cdot \frac{\frac{i \cdot i}{2 \cdot i}}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1}} \]
      7. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{i \cdot i}{2 \cdot i}}{\frac{2 \cdot i}{i \cdot i} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}} \]
      9. clear-numN/A

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

        \[\leadsto \frac{\color{blue}{\frac{1}{\frac{2 \cdot i}{i \cdot i}}}}{\frac{2 \cdot i}{i \cdot i} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)} \]
      11. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{\frac{i \cdot i}{2 \cdot i}}{\frac{2 \cdot i}{i \cdot i} \cdot \left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right)}} \]
    4. Applied rewrites99.7%

      \[\leadsto \color{blue}{\frac{0.5 \cdot i}{\frac{2}{i} \cdot \mathsf{fma}\left(4, i \cdot i, -1\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{2}{i}} \cdot \frac{i}{\mathsf{fma}\left(4, i \cdot i, -1\right)}} \]
      5. lift-fma.f64N/A

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

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

        \[\leadsto \frac{\frac{1}{2}}{\frac{2}{i}} \cdot \frac{i}{\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)} + -1} \]
      8. swap-sqrN/A

        \[\leadsto \frac{\frac{1}{2}}{\frac{2}{i}} \cdot \frac{i}{\color{blue}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)} + -1} \]
      9. metadata-evalN/A

        \[\leadsto \frac{\frac{1}{2}}{\frac{2}{i}} \cdot \frac{i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}} \]
      10. sub-negN/A

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(\frac{\frac{1}{2}}{2} \cdot i\right)} \cdot i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \]
      16. metadata-evalN/A

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

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

        \[\leadsto \frac{\left(\frac{1}{4} \cdot i\right) \cdot i}{\color{blue}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) + \left(\mathsf{neg}\left(1\right)\right)}} \]
      19. swap-sqrN/A

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

        \[\leadsto \frac{\left(\frac{1}{4} \cdot i\right) \cdot i}{\color{blue}{4} \cdot \left(i \cdot i\right) + \left(\mathsf{neg}\left(1\right)\right)} \]
      21. lift-*.f64N/A

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

        \[\leadsto \frac{\left(\frac{1}{4} \cdot i\right) \cdot i}{\color{blue}{\left(i \cdot i\right) \cdot 4} + \left(\mathsf{neg}\left(1\right)\right)} \]
    6. Applied rewrites100.0%

      \[\leadsto \color{blue}{\frac{\left(0.25 \cdot i\right) \cdot i}{\mathsf{fma}\left(i \cdot i, 4, -1\right)}} \]

    if 4e6 < i

    1. Initial program 23.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. Add Preprocessing
    3. Taylor expanded in i around inf

      \[\leadsto \color{blue}{\frac{1}{16}} \]
    4. Step-by-step derivation
      1. Applied rewrites100.0%

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

    Alternative 2: 100.0% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 4000000:\\ \;\;\;\;\frac{i \cdot i}{4 \cdot \mathsf{fma}\left(4, i \cdot i, -1\right)}\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
    (FPCore (i)
     :precision binary64
     (if (<= i 4000000.0) (/ (* i i) (* 4.0 (fma 4.0 (* i i) -1.0))) 0.0625))
    double code(double i) {
    	double tmp;
    	if (i <= 4000000.0) {
    		tmp = (i * i) / (4.0 * fma(4.0, (i * i), -1.0));
    	} else {
    		tmp = 0.0625;
    	}
    	return tmp;
    }
    
    function code(i)
    	tmp = 0.0
    	if (i <= 4000000.0)
    		tmp = Float64(Float64(i * i) / Float64(4.0 * fma(4.0, Float64(i * i), -1.0)));
    	else
    		tmp = 0.0625;
    	end
    	return tmp
    end
    
    code[i_] := If[LessEqual[i, 4000000.0], N[(N[(i * i), $MachinePrecision] / N[(4.0 * N[(4.0 * N[(i * i), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0625]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;i \leq 4000000:\\
    \;\;\;\;\frac{i \cdot i}{4 \cdot \mathsf{fma}\left(4, i \cdot i, -1\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;0.0625\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if i < 4e6

      1. Initial program 35.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. Add Preprocessing
      3. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\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. lift-/.f64N/A

          \[\leadsto \frac{\color{blue}{\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} \]
        3. associate-/l/N/A

          \[\leadsto \color{blue}{\frac{\left(i \cdot i\right) \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. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{\left(i \cdot i\right) \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)} \]
        5. times-fracN/A

          \[\leadsto \color{blue}{\frac{i \cdot i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1} \cdot \frac{i \cdot i}{\left(2 \cdot i\right) \cdot \left(2 \cdot i\right)}} \]
        6. clear-numN/A

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

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

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

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

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

          \[\leadsto \frac{i \cdot i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \frac{\left(2 \cdot i\right) \cdot \color{blue}{\left(2 \cdot i\right)}}{i \cdot i}} \]
        12. swap-sqrN/A

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

          \[\leadsto \frac{i \cdot i}{\left(\left(2 \cdot i\right) \cdot \left(2 \cdot i\right) - 1\right) \cdot \frac{\left(2 \cdot 2\right) \cdot \color{blue}{\left(i \cdot i\right)}}{i \cdot i}} \]
      4. Applied rewrites100.0%

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

      if 4e6 < i

      1. Initial program 23.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. Add Preprocessing
      3. Taylor expanded in i around inf

        \[\leadsto \color{blue}{\frac{1}{16}} \]
      4. Step-by-step derivation
        1. Applied rewrites100.0%

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

      Alternative 3: 99.5% accurate, 2.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\mathsf{fma}\left(i \cdot i, i, i \cdot 0.25\right) \cdot \left(-i\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.015625}{i \cdot i} + 0.0625\\ \end{array} \end{array} \]
      (FPCore (i)
       :precision binary64
       (if (<= i 0.5)
         (* (fma (* i i) i (* i 0.25)) (- i))
         (+ (/ 0.015625 (* i i)) 0.0625)))
      double code(double i) {
      	double tmp;
      	if (i <= 0.5) {
      		tmp = fma((i * i), i, (i * 0.25)) * -i;
      	} else {
      		tmp = (0.015625 / (i * i)) + 0.0625;
      	}
      	return tmp;
      }
      
      function code(i)
      	tmp = 0.0
      	if (i <= 0.5)
      		tmp = Float64(fma(Float64(i * i), i, Float64(i * 0.25)) * Float64(-i));
      	else
      		tmp = Float64(Float64(0.015625 / Float64(i * i)) + 0.0625);
      	end
      	return tmp
      end
      
      code[i_] := If[LessEqual[i, 0.5], N[(N[(N[(i * i), $MachinePrecision] * i + N[(i * 0.25), $MachinePrecision]), $MachinePrecision] * (-i)), $MachinePrecision], N[(N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision] + 0.0625), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;i \leq 0.5:\\
      \;\;\;\;\mathsf{fma}\left(i \cdot i, i, i \cdot 0.25\right) \cdot \left(-i\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{0.015625}{i \cdot i} + 0.0625\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if i < 0.5

        1. Initial program 31.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. Add Preprocessing
        3. Taylor expanded in i around 0

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

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

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

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

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

            \[\leadsto \left(i \cdot \left(\color{blue}{\left(\mathsf{neg}\left({i}^{2}\right)\right)} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \cdot i \]
          6. distribute-neg-inN/A

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

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

            \[\leadsto \left(i \cdot \left(\mathsf{neg}\left(\color{blue}{\left({i}^{2} - \frac{-1}{4}\right)}\right)\right)\right) \cdot i \]
          9. distribute-rgt-neg-outN/A

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

            \[\leadsto \color{blue}{\mathsf{neg}\left(\left(i \cdot \left({i}^{2} - \frac{-1}{4}\right)\right) \cdot i\right)} \]
          11. distribute-rgt-neg-inN/A

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

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

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

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

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

            \[\leadsto \left(\left({i}^{2} + \color{blue}{\frac{1}{4}}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
          17. unpow2N/A

            \[\leadsto \left(\left(\color{blue}{i \cdot i} + \frac{1}{4}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
          18. lower-fma.f64N/A

            \[\leadsto \left(\color{blue}{\mathsf{fma}\left(i, i, \frac{1}{4}\right)} \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
          19. lower-neg.f6499.9

            \[\leadsto \left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \color{blue}{\left(-i\right)} \]
        5. Applied rewrites99.9%

          \[\leadsto \color{blue}{\left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \left(-i\right)} \]
        6. Step-by-step derivation
          1. Applied rewrites99.9%

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

          if 0.5 < i

          1. Initial program 28.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. Add Preprocessing
          3. Taylor expanded in i around inf

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

              \[\leadsto \color{blue}{\frac{1}{64} \cdot \frac{1}{{i}^{2}} + \frac{1}{16}} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{1}{64} \cdot \frac{1}{{i}^{2}} + \frac{1}{16}} \]
            3. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{64} \cdot 1}{{i}^{2}}} + \frac{1}{16} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{\frac{1}{64}}}{{i}^{2}} + \frac{1}{16} \]
            5. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{64}}{{i}^{2}}} + \frac{1}{16} \]
            6. unpow2N/A

              \[\leadsto \frac{\frac{1}{64}}{\color{blue}{i \cdot i}} + \frac{1}{16} \]
            7. lower-*.f6499.0

              \[\leadsto \frac{0.015625}{\color{blue}{i \cdot i}} + 0.0625 \]
          5. Applied rewrites99.0%

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

        Alternative 4: 99.5% accurate, 2.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \left(-i\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.015625}{i \cdot i} + 0.0625\\ \end{array} \end{array} \]
        (FPCore (i)
         :precision binary64
         (if (<= i 0.5)
           (* (* (fma i i 0.25) i) (- i))
           (+ (/ 0.015625 (* i i)) 0.0625)))
        double code(double i) {
        	double tmp;
        	if (i <= 0.5) {
        		tmp = (fma(i, i, 0.25) * i) * -i;
        	} else {
        		tmp = (0.015625 / (i * i)) + 0.0625;
        	}
        	return tmp;
        }
        
        function code(i)
        	tmp = 0.0
        	if (i <= 0.5)
        		tmp = Float64(Float64(fma(i, i, 0.25) * i) * Float64(-i));
        	else
        		tmp = Float64(Float64(0.015625 / Float64(i * i)) + 0.0625);
        	end
        	return tmp
        end
        
        code[i_] := If[LessEqual[i, 0.5], N[(N[(N[(i * i + 0.25), $MachinePrecision] * i), $MachinePrecision] * (-i)), $MachinePrecision], N[(N[(0.015625 / N[(i * i), $MachinePrecision]), $MachinePrecision] + 0.0625), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;i \leq 0.5:\\
        \;\;\;\;\left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \left(-i\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{0.015625}{i \cdot i} + 0.0625\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if i < 0.5

          1. Initial program 31.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. Add Preprocessing
          3. Taylor expanded in i around 0

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

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

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

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

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

              \[\leadsto \left(i \cdot \left(\color{blue}{\left(\mathsf{neg}\left({i}^{2}\right)\right)} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \cdot i \]
            6. distribute-neg-inN/A

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

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

              \[\leadsto \left(i \cdot \left(\mathsf{neg}\left(\color{blue}{\left({i}^{2} - \frac{-1}{4}\right)}\right)\right)\right) \cdot i \]
            9. distribute-rgt-neg-outN/A

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(\left(i \cdot \left({i}^{2} - \frac{-1}{4}\right)\right) \cdot i\right)} \]
            11. distribute-rgt-neg-inN/A

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

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

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

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

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

              \[\leadsto \left(\left({i}^{2} + \color{blue}{\frac{1}{4}}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            17. unpow2N/A

              \[\leadsto \left(\left(\color{blue}{i \cdot i} + \frac{1}{4}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            18. lower-fma.f64N/A

              \[\leadsto \left(\color{blue}{\mathsf{fma}\left(i, i, \frac{1}{4}\right)} \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            19. lower-neg.f6499.9

              \[\leadsto \left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \color{blue}{\left(-i\right)} \]
          5. Applied rewrites99.9%

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

          if 0.5 < i

          1. Initial program 28.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. Add Preprocessing
          3. Taylor expanded in i around inf

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

              \[\leadsto \color{blue}{\frac{1}{64} \cdot \frac{1}{{i}^{2}} + \frac{1}{16}} \]
            2. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{1}{64} \cdot \frac{1}{{i}^{2}} + \frac{1}{16}} \]
            3. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{64} \cdot 1}{{i}^{2}}} + \frac{1}{16} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\color{blue}{\frac{1}{64}}}{{i}^{2}} + \frac{1}{16} \]
            5. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\frac{1}{64}}{{i}^{2}}} + \frac{1}{16} \]
            6. unpow2N/A

              \[\leadsto \frac{\frac{1}{64}}{\color{blue}{i \cdot i}} + \frac{1}{16} \]
            7. lower-*.f6499.0

              \[\leadsto \frac{0.015625}{\color{blue}{i \cdot i}} + 0.0625 \]
          5. Applied rewrites99.0%

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

        Alternative 5: 99.2% accurate, 2.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \left(-i\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
        (FPCore (i)
         :precision binary64
         (if (<= i 0.5) (* (* (fma i i 0.25) i) (- i)) 0.0625))
        double code(double i) {
        	double tmp;
        	if (i <= 0.5) {
        		tmp = (fma(i, i, 0.25) * i) * -i;
        	} else {
        		tmp = 0.0625;
        	}
        	return tmp;
        }
        
        function code(i)
        	tmp = 0.0
        	if (i <= 0.5)
        		tmp = Float64(Float64(fma(i, i, 0.25) * i) * Float64(-i));
        	else
        		tmp = 0.0625;
        	end
        	return tmp
        end
        
        code[i_] := If[LessEqual[i, 0.5], N[(N[(N[(i * i + 0.25), $MachinePrecision] * i), $MachinePrecision] * (-i)), $MachinePrecision], 0.0625]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;i \leq 0.5:\\
        \;\;\;\;\left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \left(-i\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;0.0625\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if i < 0.5

          1. Initial program 31.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. Add Preprocessing
          3. Taylor expanded in i around 0

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

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

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

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

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

              \[\leadsto \left(i \cdot \left(\color{blue}{\left(\mathsf{neg}\left({i}^{2}\right)\right)} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \cdot i \]
            6. distribute-neg-inN/A

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

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

              \[\leadsto \left(i \cdot \left(\mathsf{neg}\left(\color{blue}{\left({i}^{2} - \frac{-1}{4}\right)}\right)\right)\right) \cdot i \]
            9. distribute-rgt-neg-outN/A

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(\left(i \cdot \left({i}^{2} - \frac{-1}{4}\right)\right) \cdot i\right)} \]
            11. distribute-rgt-neg-inN/A

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

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

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

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

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

              \[\leadsto \left(\left({i}^{2} + \color{blue}{\frac{1}{4}}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            17. unpow2N/A

              \[\leadsto \left(\left(\color{blue}{i \cdot i} + \frac{1}{4}\right) \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            18. lower-fma.f64N/A

              \[\leadsto \left(\color{blue}{\mathsf{fma}\left(i, i, \frac{1}{4}\right)} \cdot i\right) \cdot \left(\mathsf{neg}\left(i\right)\right) \]
            19. lower-neg.f6499.9

              \[\leadsto \left(\mathsf{fma}\left(i, i, 0.25\right) \cdot i\right) \cdot \color{blue}{\left(-i\right)} \]
          5. Applied rewrites99.9%

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

          if 0.5 < i

          1. Initial program 28.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. Add Preprocessing
          3. Taylor expanded in i around inf

            \[\leadsto \color{blue}{\frac{1}{16}} \]
          4. Step-by-step derivation
            1. Applied rewrites97.6%

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

          Alternative 6: 98.9% accurate, 4.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;\left(-0.25 \cdot i\right) \cdot i\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
          (FPCore (i) :precision binary64 (if (<= i 0.5) (* (* -0.25 i) i) 0.0625))
          double code(double i) {
          	double tmp;
          	if (i <= 0.5) {
          		tmp = (-0.25 * i) * i;
          	} 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 = ((-0.25d0) * i) * i
              else
                  tmp = 0.0625d0
              end if
              code = tmp
          end function
          
          public static double code(double i) {
          	double tmp;
          	if (i <= 0.5) {
          		tmp = (-0.25 * i) * i;
          	} else {
          		tmp = 0.0625;
          	}
          	return tmp;
          }
          
          def code(i):
          	tmp = 0
          	if i <= 0.5:
          		tmp = (-0.25 * i) * i
          	else:
          		tmp = 0.0625
          	return tmp
          
          function code(i)
          	tmp = 0.0
          	if (i <= 0.5)
          		tmp = Float64(Float64(-0.25 * i) * i);
          	else
          		tmp = 0.0625;
          	end
          	return tmp
          end
          
          function tmp_2 = code(i)
          	tmp = 0.0;
          	if (i <= 0.5)
          		tmp = (-0.25 * i) * i;
          	else
          		tmp = 0.0625;
          	end
          	tmp_2 = tmp;
          end
          
          code[i_] := If[LessEqual[i, 0.5], N[(N[(-0.25 * i), $MachinePrecision] * i), $MachinePrecision], 0.0625]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;i \leq 0.5:\\
          \;\;\;\;\left(-0.25 \cdot i\right) \cdot i\\
          
          \mathbf{else}:\\
          \;\;\;\;0.0625\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if i < 0.5

            1. Initial program 31.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. Add Preprocessing
            3. Taylor expanded in i around 0

              \[\leadsto \color{blue}{\frac{-1}{4} \cdot {i}^{2}} \]
            4. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{-1}{4} \cdot {i}^{2}} \]
              2. unpow2N/A

                \[\leadsto \frac{-1}{4} \cdot \color{blue}{\left(i \cdot i\right)} \]
              3. lower-*.f6499.3

                \[\leadsto -0.25 \cdot \color{blue}{\left(i \cdot i\right)} \]
            5. Applied rewrites99.3%

              \[\leadsto \color{blue}{-0.25 \cdot \left(i \cdot i\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites99.3%

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

              if 0.5 < i

              1. Initial program 28.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. Add Preprocessing
              3. Taylor expanded in i around inf

                \[\leadsto \color{blue}{\frac{1}{16}} \]
              4. Step-by-step derivation
                1. Applied rewrites97.6%

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

              Alternative 7: 98.9% accurate, 4.2× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 0.5:\\ \;\;\;\;-0.25 \cdot \left(i \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;0.0625\\ \end{array} \end{array} \]
              (FPCore (i) :precision binary64 (if (<= i 0.5) (* -0.25 (* i i)) 0.0625))
              double code(double i) {
              	double tmp;
              	if (i <= 0.5) {
              		tmp = -0.25 * (i * i);
              	} 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 = (-0.25d0) * (i * i)
                  else
                      tmp = 0.0625d0
                  end if
                  code = tmp
              end function
              
              public static double code(double i) {
              	double tmp;
              	if (i <= 0.5) {
              		tmp = -0.25 * (i * i);
              	} else {
              		tmp = 0.0625;
              	}
              	return tmp;
              }
              
              def code(i):
              	tmp = 0
              	if i <= 0.5:
              		tmp = -0.25 * (i * i)
              	else:
              		tmp = 0.0625
              	return tmp
              
              function code(i)
              	tmp = 0.0
              	if (i <= 0.5)
              		tmp = Float64(-0.25 * Float64(i * i));
              	else
              		tmp = 0.0625;
              	end
              	return tmp
              end
              
              function tmp_2 = code(i)
              	tmp = 0.0;
              	if (i <= 0.5)
              		tmp = -0.25 * (i * i);
              	else
              		tmp = 0.0625;
              	end
              	tmp_2 = tmp;
              end
              
              code[i_] := If[LessEqual[i, 0.5], N[(-0.25 * N[(i * i), $MachinePrecision]), $MachinePrecision], 0.0625]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;i \leq 0.5:\\
              \;\;\;\;-0.25 \cdot \left(i \cdot i\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;0.0625\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if i < 0.5

                1. Initial program 31.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. Add Preprocessing
                3. Taylor expanded in i around 0

                  \[\leadsto \color{blue}{\frac{-1}{4} \cdot {i}^{2}} \]
                4. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot {i}^{2}} \]
                  2. unpow2N/A

                    \[\leadsto \frac{-1}{4} \cdot \color{blue}{\left(i \cdot i\right)} \]
                  3. lower-*.f6499.3

                    \[\leadsto -0.25 \cdot \color{blue}{\left(i \cdot i\right)} \]
                5. Applied rewrites99.3%

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

                if 0.5 < i

                1. Initial program 28.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. Add Preprocessing
                3. Taylor expanded in i around inf

                  \[\leadsto \color{blue}{\frac{1}{16}} \]
                4. Step-by-step derivation
                  1. Applied rewrites97.6%

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

                Alternative 8: 50.5% accurate, 71.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.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. Add Preprocessing
                3. Taylor expanded in i around inf

                  \[\leadsto \color{blue}{\frac{1}{16}} \]
                4. Step-by-step derivation
                  1. Applied rewrites50.9%

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

                  Reproduce

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