cos2 (problem 3.4.1)

Percentage Accurate: 50.8% → 99.8%
Time: 10.3s
Alternatives: 10
Speedup: 17.8×

Specification

?
\[\begin{array}{l} \\ \frac{1 - \cos x}{x \cdot x} \end{array} \]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
double code(double x) {
	return (1.0 - cos(x)) / (x * x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 - cos(x)) / (x * x)
end function
public static double code(double x) {
	return (1.0 - Math.cos(x)) / (x * x);
}
def code(x):
	return (1.0 - math.cos(x)) / (x * x)
function code(x)
	return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
function tmp = code(x)
	tmp = (1.0 - cos(x)) / (x * x);
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1 - \cos x}{x \cdot x}
\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 10 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: 50.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1 - \cos x}{x \cdot x} \end{array} \]
(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
double code(double x) {
	return (1.0 - cos(x)) / (x * x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 - cos(x)) / (x * x)
end function
public static double code(double x) {
	return (1.0 - Math.cos(x)) / (x * x);
}
def code(x):
	return (1.0 - math.cos(x)) / (x * x)
function code(x)
	return Float64(Float64(1.0 - cos(x)) / Float64(x * x))
end
function tmp = code(x)
	tmp = (1.0 - cos(x)) / (x * x);
end
code[x_] := N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1 - \cos x}{x \cdot x}
\end{array}

Alternative 1: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x} \end{array} \]
(FPCore (x) :precision binary64 (* (/ (sin x) x) (/ (tan (/ x 2.0)) x)))
double code(double x) {
	return (sin(x) / x) * (tan((x / 2.0)) / x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (sin(x) / x) * (tan((x / 2.0d0)) / x)
end function
public static double code(double x) {
	return (Math.sin(x) / x) * (Math.tan((x / 2.0)) / x);
}
def code(x):
	return (math.sin(x) / x) * (math.tan((x / 2.0)) / x)
function code(x)
	return Float64(Float64(sin(x) / x) * Float64(tan(Float64(x / 2.0)) / x))
end
function tmp = code(x)
	tmp = (sin(x) / x) * (tan((x / 2.0)) / x);
end
code[x_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[(N[Tan[N[(x / 2.0), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}
\end{array}
Derivation
  1. Initial program 50.4%

    \[\frac{1 - \cos x}{x \cdot x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. flip--N/A

      \[\leadsto \frac{\frac{1 \cdot 1 - \cos x \cdot \cos x}{1 + \cos x}}{\color{blue}{x} \cdot x} \]
    2. associate-/l/N/A

      \[\leadsto \frac{1 \cdot 1 - \cos x \cdot \cos x}{\color{blue}{\left(x \cdot x\right) \cdot \left(1 + \cos x\right)}} \]
    3. metadata-evalN/A

      \[\leadsto \frac{1 - \cos x \cdot \cos x}{\left(\color{blue}{x} \cdot x\right) \cdot \left(1 + \cos x\right)} \]
    4. 1-sub-cosN/A

      \[\leadsto \frac{\sin x \cdot \sin x}{\color{blue}{\left(x \cdot x\right)} \cdot \left(1 + \cos x\right)} \]
    5. times-fracN/A

      \[\leadsto \frac{\sin x}{x \cdot x} \cdot \color{blue}{\frac{\sin x}{1 + \cos x}} \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin x}{x \cdot x}\right), \color{blue}{\left(\frac{\sin x}{1 + \cos x}\right)}\right) \]
    7. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin x, \left(x \cdot x\right)\right), \left(\frac{\color{blue}{\sin x}}{1 + \cos x}\right)\right) \]
    8. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), \left(x \cdot x\right)\right), \left(\frac{\sin \color{blue}{x}}{1 + \cos x}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), \mathsf{*.f64}\left(x, x\right)\right), \left(\frac{\sin x}{1 + \cos x}\right)\right) \]
    10. hang-0p-tanN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), \mathsf{*.f64}\left(x, x\right)\right), \tan \left(\frac{x}{2}\right)\right) \]
    11. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), \mathsf{*.f64}\left(x, x\right)\right), \mathsf{tan.f64}\left(\left(\frac{x}{2}\right)\right)\right) \]
    12. /-lowering-/.f6476.0%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), \mathsf{*.f64}\left(x, x\right)\right), \mathsf{tan.f64}\left(\mathsf{/.f64}\left(x, 2\right)\right)\right) \]
  4. Applied egg-rr76.0%

    \[\leadsto \color{blue}{\frac{\sin x}{x \cdot x} \cdot \tan \left(\frac{x}{2}\right)} \]
  5. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \frac{\sin x \cdot \tan \left(\frac{x}{2}\right)}{\color{blue}{x \cdot x}} \]
    2. times-fracN/A

      \[\leadsto \frac{\sin x}{x} \cdot \color{blue}{\frac{\tan \left(\frac{x}{2}\right)}{x}} \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin x}{x}\right), \color{blue}{\left(\frac{\tan \left(\frac{x}{2}\right)}{x}\right)}\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\sin x, x\right), \left(\frac{\color{blue}{\tan \left(\frac{x}{2}\right)}}{x}\right)\right) \]
    5. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), x\right), \left(\frac{\tan \color{blue}{\left(\frac{x}{2}\right)}}{x}\right)\right) \]
    6. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), x\right), \mathsf{/.f64}\left(\tan \left(\frac{x}{2}\right), \color{blue}{x}\right)\right) \]
    7. tan-lowering-tan.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), x\right), \mathsf{/.f64}\left(\mathsf{tan.f64}\left(\left(\frac{x}{2}\right)\right), x\right)\right) \]
    8. /-lowering-/.f6499.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{sin.f64}\left(x\right), x\right), \mathsf{/.f64}\left(\mathsf{tan.f64}\left(\mathsf{/.f64}\left(x, 2\right)\right), x\right)\right) \]
  6. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\frac{\sin x}{x} \cdot \frac{\tan \left(\frac{x}{2}\right)}{x}} \]
  7. Add Preprocessing

Alternative 2: 75.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.033:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{x}{1 - \cos x}}}{x}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.033)
   (+
    0.5
    (* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
   (/ (/ 1.0 (/ x (- 1.0 (cos x)))) x)))
double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = (1.0 / (x / (1.0 - cos(x)))) / x;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.033d0) then
        tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
    else
        tmp = (1.0d0 / (x / (1.0d0 - cos(x)))) / x
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = (1.0 / (x / (1.0 - Math.cos(x)))) / x;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.033:
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)))
	else:
		tmp = (1.0 / (x / (1.0 - math.cos(x)))) / x
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.033)
		tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889))));
	else
		tmp = Float64(Float64(1.0 / Float64(x / Float64(1.0 - cos(x)))) / x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.033)
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	else
		tmp = (1.0 / (x / (1.0 - cos(x)))) / x;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(x / N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{1 - \cos x}}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.033000000000000002

    1. Initial program 35.4%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)}\right)\right) \]
      3. unpow2N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{-1}{24} + \color{blue}{\frac{1}{720} \cdot {x}^{2}}\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {x}^{2}\right)}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{720}\right)\right)\right)\right) \]
      12. *-lowering-*.f6466.5%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{720}\right)\right)\right)\right) \]
    5. Simplified66.5%

      \[\leadsto \color{blue}{0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)} \]

    if 0.033000000000000002 < x

    1. Initial program 98.7%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
      3. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
      6. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
    5. Simplified99.3%

      \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{x}{1 - \cos x}}\right), x\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{x}{1 - \cos x}\right)\right), x\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \left(1 - \cos x\right)\right)\right), x\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \cos x\right)\right)\right), x\right) \]
      5. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right)\right)\right), x\right) \]
    7. Applied egg-rr99.2%

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x}{1 - \cos x}}}}{x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 75.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.033:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.033)
   (+
    0.5
    (* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
   (/ (/ (- 1.0 (cos x)) x) x)))
double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = ((1.0 - cos(x)) / x) / x;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.033d0) then
        tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
    else
        tmp = ((1.0d0 - cos(x)) / x) / x
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = ((1.0 - Math.cos(x)) / x) / x;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.033:
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)))
	else:
		tmp = ((1.0 - math.cos(x)) / x) / x
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.033)
		tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889))));
	else
		tmp = Float64(Float64(Float64(1.0 - cos(x)) / x) / x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.033)
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	else
		tmp = ((1.0 - cos(x)) / x) / x;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.033000000000000002

    1. Initial program 35.4%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)}\right)\right) \]
      3. unpow2N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{-1}{24} + \color{blue}{\frac{1}{720} \cdot {x}^{2}}\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {x}^{2}\right)}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{720}\right)\right)\right)\right) \]
      12. *-lowering-*.f6466.5%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{720}\right)\right)\right)\right) \]
    5. Simplified66.5%

      \[\leadsto \color{blue}{0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)} \]

    if 0.033000000000000002 < x

    1. Initial program 98.7%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
      3. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
      6. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
    5. Simplified99.3%

      \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 75.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.033:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \cos x}{x \cdot x}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x 0.033)
   (+
    0.5
    (* (* x x) (+ -0.041666666666666664 (* (* x x) 0.001388888888888889))))
   (/ (- 1.0 (cos x)) (* x x))))
double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = (1.0 - cos(x)) / (x * x);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 0.033d0) then
        tmp = 0.5d0 + ((x * x) * ((-0.041666666666666664d0) + ((x * x) * 0.001388888888888889d0)))
    else
        tmp = (1.0d0 - cos(x)) / (x * x)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 0.033) {
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	} else {
		tmp = (1.0 - Math.cos(x)) / (x * x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 0.033:
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)))
	else:
		tmp = (1.0 - math.cos(x)) / (x * x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 0.033)
		tmp = Float64(0.5 + Float64(Float64(x * x) * Float64(-0.041666666666666664 + Float64(Float64(x * x) * 0.001388888888888889))));
	else
		tmp = Float64(Float64(1.0 - cos(x)) / Float64(x * x));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 0.033)
		tmp = 0.5 + ((x * x) * (-0.041666666666666664 + ((x * x) * 0.001388888888888889)));
	else
		tmp = (1.0 - cos(x)) / (x * x);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 0.033], N[(0.5 + N[(N[(x * x), $MachinePrecision] * N[(-0.041666666666666664 + N[(N[(x * x), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[Cos[x], $MachinePrecision]), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.033:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos x}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.033000000000000002

    1. Initial program 35.4%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\left(\frac{1}{720} \cdot {x}^{2} - \frac{1}{24}\right)}\right)\right) \]
      3. unpow2N/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{-1}{24} + \color{blue}{\frac{1}{720} \cdot {x}^{2}}\right)\right)\right) \]
      8. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \color{blue}{\left(\frac{1}{720} \cdot {x}^{2}\right)}\right)\right)\right) \]
      9. *-commutativeN/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left({x}^{2}\right), \color{blue}{\frac{1}{720}}\right)\right)\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{720}\right)\right)\right)\right) \]
      12. *-lowering-*.f6466.5%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{720}\right)\right)\right)\right) \]
    5. Simplified66.5%

      \[\leadsto \color{blue}{0.5 + \left(x \cdot x\right) \cdot \left(-0.041666666666666664 + \left(x \cdot x\right) \cdot 0.001388888888888889\right)} \]

    if 0.033000000000000002 < x

    1. Initial program 98.7%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 64.5% accurate, 8.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.2:\\
\;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\

\mathbf{else}:\\
\;\;\;\;\frac{6}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.2000000000000002

    1. Initial program 35.4%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2} + \frac{-1}{24} \cdot {x}^{2}} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{24}, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{24}, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      4. *-lowering-*.f6466.2%

        \[\leadsto \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{24}, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    5. Simplified66.2%

      \[\leadsto \color{blue}{0.5 + -0.041666666666666664 \cdot \left(x \cdot x\right)} \]

    if 3.2000000000000002 < x

    1. Initial program 98.7%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
      2. associate-/r*N/A

        \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
      3. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
      6. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
    5. Simplified99.3%

      \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{x}{1 - \cos x}}\right), x\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{x}{1 - \cos x}\right)\right), x\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \left(1 - \cos x\right)\right)\right), x\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \cos x\right)\right)\right), x\right) \]
      5. cos-lowering-cos.f6499.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right)\right)\right), x\right) \]
    7. Applied egg-rr99.2%

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x}{1 - \cos x}}}}{x} \]
    8. Taylor expanded in x around 0

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{2 + \frac{1}{6} \cdot {x}^{2}}{x}\right)}\right), x\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 + \frac{1}{6} \cdot {x}^{2}\right), x\right)\right), x\right) \]
      2. +-lowering-+.f64N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
      6. *-lowering-*.f6463.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
    10. Simplified63.6%

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}{x}}}}{x} \]
    11. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{6}{{x}^{2}}} \]
    12. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(6, \color{blue}{\left({x}^{2}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(6, \left(x \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f6463.6%

        \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right) \]
    13. Simplified63.6%

      \[\leadsto \color{blue}{\frac{6}{x \cdot x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.2:\\ \;\;\;\;0.5 + \left(x \cdot x\right) \cdot -0.041666666666666664\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{x \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 78.7% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{x}{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}}{x} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (/ x (+ 2.0 (* (* x x) 0.16666666666666666))) x))
double code(double x) {
	return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (x / (2.0d0 + ((x * x) * 0.16666666666666666d0))) / x
end function
public static double code(double x) {
	return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x;
}
def code(x):
	return (x / (2.0 + ((x * x) * 0.16666666666666666))) / x
function code(x)
	return Float64(Float64(x / Float64(2.0 + Float64(Float64(x * x) * 0.16666666666666666))) / x)
end
function tmp = code(x)
	tmp = (x / (2.0 + ((x * x) * 0.16666666666666666))) / x;
end
code[x_] := N[(N[(x / N[(2.0 + N[(N[(x * x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{x}{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}}{x}
\end{array}
Derivation
  1. Initial program 50.4%

    \[\frac{1 - \cos x}{x \cdot x} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
    2. associate-/r*N/A

      \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
    3. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
    5. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
    6. cos-lowering-cos.f6451.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
  5. Simplified51.5%

    \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{x}{1 - \cos x}}\right), x\right) \]
    2. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{x}{1 - \cos x}\right)\right), x\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \left(1 - \cos x\right)\right)\right), x\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \cos x\right)\right)\right), x\right) \]
    5. cos-lowering-cos.f6451.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right)\right)\right), x\right) \]
  7. Applied egg-rr51.5%

    \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x}{1 - \cos x}}}}{x} \]
  8. Taylor expanded in x around 0

    \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{2 + \frac{1}{6} \cdot {x}^{2}}{x}\right)}\right), x\right) \]
  9. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 + \frac{1}{6} \cdot {x}^{2}\right), x\right)\right), x\right) \]
    2. +-lowering-+.f64N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
    6. *-lowering-*.f6476.9%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
  10. Simplified76.9%

    \[\leadsto \frac{\frac{1}{\color{blue}{\frac{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}{x}}}}{x} \]
  11. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{2 + \left(x \cdot x\right) \cdot \frac{1}{6}}{x}}\right), \color{blue}{x}\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{x}{2 + \left(x \cdot x\right) \cdot \frac{1}{6}}\right), x\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \left(2 + \left(x \cdot x\right) \cdot \frac{1}{6}\right)\right), x\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(2, \left(\left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right), x\right) \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{6}\right)\right)\right), x\right) \]
    6. *-lowering-*.f6477.1%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(x, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{6}\right)\right)\right), x\right) \]
  12. Applied egg-rr77.1%

    \[\leadsto \color{blue}{\frac{\frac{x}{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}}{x}} \]
  13. Add Preprocessing

Alternative 7: 78.5% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{1}{x \cdot 0.16666666666666666 + \frac{2}{x}}}{x} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ (/ 1.0 (+ (* x 0.16666666666666666) (/ 2.0 x))) x))
double code(double x) {
	return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (1.0d0 / ((x * 0.16666666666666666d0) + (2.0d0 / x))) / x
end function
public static double code(double x) {
	return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x;
}
def code(x):
	return (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x
function code(x)
	return Float64(Float64(1.0 / Float64(Float64(x * 0.16666666666666666) + Float64(2.0 / x))) / x)
end
function tmp = code(x)
	tmp = (1.0 / ((x * 0.16666666666666666) + (2.0 / x))) / x;
end
code[x_] := N[(N[(1.0 / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{1}{x \cdot 0.16666666666666666 + \frac{2}{x}}}{x}
\end{array}
Derivation
  1. Initial program 50.4%

    \[\frac{1 - \cos x}{x \cdot x} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
  4. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
    2. associate-/r*N/A

      \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
    3. /-lowering-/.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
    5. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
    6. cos-lowering-cos.f6451.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
  5. Simplified51.5%

    \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
  6. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{x}{1 - \cos x}}\right), x\right) \]
    2. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{x}{1 - \cos x}\right)\right), x\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \left(1 - \cos x\right)\right)\right), x\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \cos x\right)\right)\right), x\right) \]
    5. cos-lowering-cos.f6451.5%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right)\right)\right), x\right) \]
  7. Applied egg-rr51.5%

    \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x}{1 - \cos x}}}}{x} \]
  8. Taylor expanded in x around 0

    \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{2 + \frac{1}{6} \cdot {x}^{2}}{x}\right)}\right), x\right) \]
  9. Step-by-step derivation
    1. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 + \frac{1}{6} \cdot {x}^{2}\right), x\right)\right), x\right) \]
    2. +-lowering-+.f64N/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
    6. *-lowering-*.f6476.9%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
  10. Simplified76.9%

    \[\leadsto \frac{\frac{1}{\color{blue}{\frac{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}{x}}}}{x} \]
  11. Taylor expanded in x around 0

    \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{2 + \frac{1}{6} \cdot {x}^{2}}{x}\right)}\right), x\right) \]
  12. Step-by-step derivation
    1. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2 \cdot 1 + \frac{1}{6} \cdot {x}^{2}}{x}\right)\right), x\right) \]
    2. fma-undefineN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\mathsf{fma}\left(2, 1, \frac{1}{6} \cdot {x}^{2}\right)}{x}\right)\right), x\right) \]
    3. lft-mult-inverseN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\mathsf{fma}\left(2, \frac{1}{{x}^{2}} \cdot {x}^{2}, \frac{1}{6} \cdot {x}^{2}\right)}{x}\right)\right), x\right) \]
    4. fma-defineN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2 \cdot \left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right) + \frac{1}{6} \cdot {x}^{2}}{x}\right)\right), x\right) \]
    5. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(2 \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2} + \frac{1}{6} \cdot {x}^{2}}{x}\right)\right), x\right) \]
    6. distribute-rgt-inN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}}{x}\right)\right), x\right) \]
    9. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right) \cdot \frac{{x}^{2}}{x}\right)\right), x\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right) \cdot \frac{x \cdot x}{x}\right)\right), x\right) \]
    11. associate-/l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right) \cdot \left(x \cdot \frac{x}{x}\right)\right)\right), x\right) \]
    12. *-inversesN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right) \cdot \left(x \cdot 1\right)\right)\right), x\right) \]
    13. *-rgt-identityN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x \cdot \left(\frac{1}{6} + 2 \cdot \frac{1}{{x}^{2}}\right)\right)\right), x\right) \]
    15. distribute-rgt-inN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{6} \cdot x + \left(2 \cdot \frac{1}{{x}^{2}}\right) \cdot x\right)\right), x\right) \]
    16. +-lowering-+.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\left(x \cdot \frac{1}{6}\right), \left(\left(2 \cdot \frac{1}{{x}^{2}}\right) \cdot x\right)\right)\right), x\right) \]
    18. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{6}\right), \left(\left(2 \cdot \frac{1}{{x}^{2}}\right) \cdot x\right)\right)\right), x\right) \]
    19. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{6}\right), \left(2 \cdot \left(\frac{1}{{x}^{2}} \cdot x\right)\right)\right)\right), x\right) \]
    20. unpow2N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, \frac{1}{6}\right), \left(2 \cdot \left(\frac{\frac{1}{x}}{x} \cdot x\right)\right)\right)\right), x\right) \]
  13. Simplified76.9%

    \[\leadsto \frac{\frac{1}{\color{blue}{x \cdot 0.16666666666666666 + \frac{2}{x}}}}{x} \]
  14. Add Preprocessing

Alternative 8: 64.8% accurate, 10.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.4:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{6}{x \cdot x}\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x 3.4) 0.5 (/ 6.0 (* x x))))
double code(double x) {
	double tmp;
	if (x <= 3.4) {
		tmp = 0.5;
	} else {
		tmp = 6.0 / (x * x);
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 3.4d0) then
        tmp = 0.5d0
    else
        tmp = 6.0d0 / (x * x)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 3.4) {
		tmp = 0.5;
	} else {
		tmp = 6.0 / (x * x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 3.4:
		tmp = 0.5
	else:
		tmp = 6.0 / (x * x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 3.4)
		tmp = 0.5;
	else
		tmp = Float64(6.0 / Float64(x * x));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 3.4)
		tmp = 0.5;
	else
		tmp = 6.0 / (x * x);
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 3.4], 0.5, N[(6.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4:\\
\;\;\;\;0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{6}{x \cdot x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 3.39999999999999991

    1. Initial program 35.4%

      \[\frac{1 - \cos x}{x \cdot x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{2}} \]
    4. Step-by-step derivation
      1. Simplified67.0%

        \[\leadsto \color{blue}{0.5} \]

      if 3.39999999999999991 < x

      1. Initial program 98.7%

        \[\frac{1 - \cos x}{x \cdot x} \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{1 - \cos x}{{x}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \frac{1 - \cos x}{x \cdot \color{blue}{x}} \]
        2. associate-/r*N/A

          \[\leadsto \frac{\frac{1 - \cos x}{x}}{\color{blue}{x}} \]
        3. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(1 - \cos x\right), x\right), x\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \cos x\right), x\right), x\right) \]
        6. cos-lowering-cos.f6499.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right), x\right), x\right) \]
      5. Simplified99.3%

        \[\leadsto \color{blue}{\frac{\frac{1 - \cos x}{x}}{x}} \]
      6. Step-by-step derivation
        1. clear-numN/A

          \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{\frac{x}{1 - \cos x}}\right), x\right) \]
        2. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{x}{1 - \cos x}\right)\right), x\right) \]
        3. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \left(1 - \cos x\right)\right)\right), x\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \cos x\right)\right)\right), x\right) \]
        5. cos-lowering-cos.f6499.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{cos.f64}\left(x\right)\right)\right)\right), x\right) \]
      7. Applied egg-rr99.2%

        \[\leadsto \frac{\color{blue}{\frac{1}{\frac{x}{1 - \cos x}}}}{x} \]
      8. Taylor expanded in x around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{2 + \frac{1}{6} \cdot {x}^{2}}{x}\right)}\right), x\right) \]
      9. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 + \frac{1}{6} \cdot {x}^{2}\right), x\right)\right), x\right) \]
        2. +-lowering-+.f64N/A

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left({x}^{2}\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
        5. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\left(x \cdot x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
        6. *-lowering-*.f6463.6%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \frac{1}{6}\right)\right), x\right)\right), x\right) \]
      10. Simplified63.6%

        \[\leadsto \frac{\frac{1}{\color{blue}{\frac{2 + \left(x \cdot x\right) \cdot 0.16666666666666666}{x}}}}{x} \]
      11. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{6}{{x}^{2}}} \]
      12. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(6, \color{blue}{\left({x}^{2}\right)}\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(6, \left(x \cdot \color{blue}{x}\right)\right) \]
        3. *-lowering-*.f6463.6%

          \[\leadsto \mathsf{/.f64}\left(6, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right) \]
      13. Simplified63.6%

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

    Alternative 9: 63.7% accurate, 17.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.65 \cdot 10^{+77}:\\ \;\;\;\;0.5\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (x) :precision binary64 (if (<= x 1.65e+77) 0.5 0.0))
    double code(double x) {
    	double tmp;
    	if (x <= 1.65e+77) {
    		tmp = 0.5;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: tmp
        if (x <= 1.65d+77) then
            tmp = 0.5d0
        else
            tmp = 0.0d0
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double tmp;
    	if (x <= 1.65e+77) {
    		tmp = 0.5;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(x):
    	tmp = 0
    	if x <= 1.65e+77:
    		tmp = 0.5
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(x)
    	tmp = 0.0
    	if (x <= 1.65e+77)
    		tmp = 0.5;
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	tmp = 0.0;
    	if (x <= 1.65e+77)
    		tmp = 0.5;
    	else
    		tmp = 0.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := If[LessEqual[x, 1.65e+77], 0.5, 0.0]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 1.65 \cdot 10^{+77}:\\
    \;\;\;\;0.5\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 1.6499999999999999e77

      1. Initial program 40.4%

        \[\frac{1 - \cos x}{x \cdot x} \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{1}{2}} \]
      4. Step-by-step derivation
        1. Simplified62.2%

          \[\leadsto \color{blue}{0.5} \]

        if 1.6499999999999999e77 < x

        1. Initial program 98.8%

          \[\frac{1 - \cos x}{x \cdot x} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. div-subN/A

            \[\leadsto \frac{1}{x \cdot x} - \color{blue}{\frac{\cos x}{x \cdot x}} \]
          2. associate-/r*N/A

            \[\leadsto \frac{1}{x \cdot x} - \frac{\frac{\cos x}{x}}{\color{blue}{x}} \]
          3. frac-subN/A

            \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{\color{blue}{\left(x \cdot x\right) \cdot x}} \]
          4. pow3N/A

            \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{{x}^{\color{blue}{3}}} \]
          5. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}\right), \color{blue}{\left({x}^{3}\right)}\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(1 \cdot x\right), \left(\left(x \cdot x\right) \cdot \frac{\cos x}{x}\right)\right), \left({\color{blue}{x}}^{3}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \left(\left(x \cdot x\right) \cdot \frac{\cos x}{x}\right)\right), \left({x}^{3}\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{\cos x}{x}\right)\right)\right), \left({x}^{3}\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{\cos x}{x}\right)\right)\right), \left({x}^{3}\right)\right) \]
          10. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\cos x, x\right)\right)\right), \left({x}^{3}\right)\right) \]
          11. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{3}\right)\right) \]
          12. metadata-evalN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{\left(1 + \color{blue}{2}\right)}\right)\right) \]
          13. pow-prod-upN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{1} \cdot \color{blue}{{x}^{2}}\right)\right) \]
          14. unpow1N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left(x \cdot {\color{blue}{x}}^{2}\right)\right) \]
          15. pow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left(x \cdot \left(x \cdot \color{blue}{x}\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(x \cdot x\right)}\right)\right) \]
          17. *-lowering-*.f647.7%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
        4. Applied egg-rr7.7%

          \[\leadsto \color{blue}{\frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{x \cdot \left(x \cdot x\right)}} \]
        5. Taylor expanded in x around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\color{blue}{1}, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
        6. Step-by-step derivation
          1. Simplified1.3%

            \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\color{blue}{1}}{x}}{x \cdot \left(x \cdot x\right)} \]
          2. Taylor expanded in x around 0

            \[\leadsto \color{blue}{0} \]
          3. Step-by-step derivation
            1. Simplified80.0%

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

          Alternative 10: 27.8% accurate, 107.0× speedup?

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

            \[\frac{1 - \cos x}{x \cdot x} \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. div-subN/A

              \[\leadsto \frac{1}{x \cdot x} - \color{blue}{\frac{\cos x}{x \cdot x}} \]
            2. associate-/r*N/A

              \[\leadsto \frac{1}{x \cdot x} - \frac{\frac{\cos x}{x}}{\color{blue}{x}} \]
            3. frac-subN/A

              \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{\color{blue}{\left(x \cdot x\right) \cdot x}} \]
            4. pow3N/A

              \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{{x}^{\color{blue}{3}}} \]
            5. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\left(1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}\right), \color{blue}{\left({x}^{3}\right)}\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(1 \cdot x\right), \left(\left(x \cdot x\right) \cdot \frac{\cos x}{x}\right)\right), \left({\color{blue}{x}}^{3}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \left(\left(x \cdot x\right) \cdot \frac{\cos x}{x}\right)\right), \left({x}^{3}\right)\right) \]
            8. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\left(x \cdot x\right), \left(\frac{\cos x}{x}\right)\right)\right), \left({x}^{3}\right)\right) \]
            9. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{\cos x}{x}\right)\right)\right), \left({x}^{3}\right)\right) \]
            10. /-lowering-/.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\cos x, x\right)\right)\right), \left({x}^{3}\right)\right) \]
            11. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{3}\right)\right) \]
            12. metadata-evalN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{\left(1 + \color{blue}{2}\right)}\right)\right) \]
            13. pow-prod-upN/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left({x}^{1} \cdot \color{blue}{{x}^{2}}\right)\right) \]
            14. unpow1N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left(x \cdot {\color{blue}{x}}^{2}\right)\right) \]
            15. pow2N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \left(x \cdot \left(x \cdot \color{blue}{x}\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \mathsf{*.f64}\left(x, \color{blue}{\left(x \cdot x\right)}\right)\right) \]
            17. *-lowering-*.f6421.4%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(x\right), x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
          4. Applied egg-rr21.4%

            \[\leadsto \color{blue}{\frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\cos x}{x}}{x \cdot \left(x \cdot x\right)}} \]
          5. Taylor expanded in x around 0

            \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\color{blue}{1}, x\right)\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
          6. Step-by-step derivation
            1. Simplified2.8%

              \[\leadsto \frac{1 \cdot x - \left(x \cdot x\right) \cdot \frac{\color{blue}{1}}{x}}{x \cdot \left(x \cdot x\right)} \]
            2. Taylor expanded in x around 0

              \[\leadsto \color{blue}{0} \]
            3. Step-by-step derivation
              1. Simplified25.6%

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

              Reproduce

              ?
              herbie shell --seed 2024139 
              (FPCore (x)
                :name "cos2 (problem 3.4.1)"
                :precision binary64
                (/ (- 1.0 (cos x)) (* x x)))