Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, A

Percentage Accurate: 77.0% → 99.5%
Time: 9.5s
Alternatives: 6
Speedup: 3.1×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(x \cdot 0.5\right)\\ \frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
	double t_0 = sin((x * 0.5));
	return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sin((x * 0.5d0))
    code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
	double t_0 = Math.sin((x * 0.5));
	return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x):
	t_0 = math.sin((x * 0.5))
	return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x)
	t_0 = sin(Float64(x * 0.5))
	return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x))
end
function tmp = code(x)
	t_0 = sin((x * 0.5));
	tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x);
end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\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 6 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: 77.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(x \cdot 0.5\right)\\ \frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sin (* x 0.5)))) (/ (* (* (/ 8.0 3.0) t_0) t_0) (sin x))))
double code(double x) {
	double t_0 = sin((x * 0.5));
	return (((8.0 / 3.0) * t_0) * t_0) / sin(x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sin((x * 0.5d0))
    code = (((8.0d0 / 3.0d0) * t_0) * t_0) / sin(x)
end function
public static double code(double x) {
	double t_0 = Math.sin((x * 0.5));
	return (((8.0 / 3.0) * t_0) * t_0) / Math.sin(x);
}
def code(x):
	t_0 = math.sin((x * 0.5))
	return (((8.0 / 3.0) * t_0) * t_0) / math.sin(x)
function code(x)
	t_0 = sin(Float64(x * 0.5))
	return Float64(Float64(Float64(Float64(8.0 / 3.0) * t_0) * t_0) / sin(x))
end
function tmp = code(x)
	t_0 = sin((x * 0.5));
	tmp = (((8.0 / 3.0) * t_0) * t_0) / sin(x);
end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(8.0 / 3.0), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\left(\frac{8}{3} \cdot t\_0\right) \cdot t\_0}{\sin x}
\end{array}
\end{array}

Alternative 1: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot x\right)\\ \frac{t\_0}{0.375} \cdot \frac{t\_0}{\sin x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 x)))) (* (/ t_0 0.375) (/ t_0 (sin x)))))
double code(double x) {
	double t_0 = sin((0.5 * x));
	return (t_0 / 0.375) * (t_0 / sin(x));
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sin((0.5d0 * x))
    code = (t_0 / 0.375d0) * (t_0 / sin(x))
end function
public static double code(double x) {
	double t_0 = Math.sin((0.5 * x));
	return (t_0 / 0.375) * (t_0 / Math.sin(x));
}
def code(x):
	t_0 = math.sin((0.5 * x))
	return (t_0 / 0.375) * (t_0 / math.sin(x))
function code(x)
	t_0 = sin(Float64(0.5 * x))
	return Float64(Float64(t_0 / 0.375) * Float64(t_0 / sin(x)))
end
function tmp = code(x)
	t_0 = sin((0.5 * x));
	tmp = (t_0 / 0.375) * (t_0 / sin(x));
end
code[x_] := Block[{t$95$0 = N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 / 0.375), $MachinePrecision] * N[(t$95$0 / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot x\right)\\
\frac{t\_0}{0.375} \cdot \frac{t\_0}{\sin x}
\end{array}
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot \frac{1}{2}\right)\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \]
    2. clear-numN/A

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

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

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

      \[\leadsto \frac{1}{\frac{\sin x}{\color{blue}{\frac{8}{3} \cdot \left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)\right)}}} \]
    6. associate-/r*N/A

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}}} \]
    8. frac-2negN/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\color{blue}{\frac{\mathsf{neg}\left(\sin x\right)}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    9. neg-mul-1N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\color{blue}{-1 \cdot \sin x}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    10. *-commutativeN/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\color{blue}{\sin x \cdot -1}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    11. associate-/l*N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\color{blue}{\sin x \cdot \frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    12. times-fracN/A

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right)}{\sin x} \cdot \frac{\sin \left(x \cdot \frac{1}{2}\right)}{\frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    13. lower-*.f64N/A

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right)}{\sin x} \cdot \frac{\sin \left(x \cdot \frac{1}{2}\right)}{\frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    14. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \cdot \frac{\sin \left(x \cdot \frac{1}{2}\right)}{\frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
  4. Applied rewrites99.5%

    \[\leadsto \color{blue}{\frac{\sin \left(x \cdot 0.5\right)}{\sin x} \cdot \frac{\sin \left(x \cdot 0.5\right)}{0.375}} \]
  5. Final simplification99.5%

    \[\leadsto \frac{\sin \left(0.5 \cdot x\right)}{0.375} \cdot \frac{\sin \left(0.5 \cdot x\right)}{\sin x} \]
  6. Add Preprocessing

Alternative 2: 99.4% accurate, 3.1× speedup?

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

\\
1.3333333333333333 \cdot \tan \left(0.5 \cdot x\right)
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot \frac{1}{2}\right)\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \]
    2. clear-numN/A

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

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

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

      \[\leadsto \frac{1}{\frac{\sin x}{\color{blue}{\frac{8}{3} \cdot \left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)\right)}}} \]
    6. associate-/r*N/A

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}}} \]
    8. lift-sin.f64N/A

      \[\leadsto \frac{\color{blue}{\sin \left(x \cdot \frac{1}{2}\right)} \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}} \]
    9. lift-sin.f64N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \color{blue}{\sin \left(x \cdot \frac{1}{2}\right)}}{\frac{\sin x}{\frac{8}{3}}} \]
    10. sin-multN/A

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    11. div-invN/A

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

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \color{blue}{\frac{1}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    13. frac-2negN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\color{blue}{\frac{\mathsf{neg}\left(\sin x\right)}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    14. neg-mul-1N/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{-1 \cdot \sin x}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    15. *-commutativeN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{\sin x \cdot -1}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
  4. Applied rewrites52.4%

    \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x} \cdot 1.3333333333333333} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x}} \cdot \frac{4}{3} \]
    2. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{1 - \cos x}}{\sin x} \cdot \frac{4}{3} \]
    3. lift-cos.f64N/A

      \[\leadsto \frac{1 - \color{blue}{\cos x}}{\sin x} \cdot \frac{4}{3} \]
    4. lift-sin.f64N/A

      \[\leadsto \frac{1 - \cos x}{\color{blue}{\sin x}} \cdot \frac{4}{3} \]
    5. hang-p0-tanN/A

      \[\leadsto \color{blue}{\tan \left(\frac{x}{2}\right)} \cdot \frac{4}{3} \]
    6. div-invN/A

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    7. metadata-evalN/A

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

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    9. lower-tan.f6499.5

      \[\leadsto \color{blue}{\tan \left(x \cdot 0.5\right)} \cdot 1.3333333333333333 \]
    10. lift-*.f64N/A

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

      \[\leadsto \tan \color{blue}{\left(\frac{1}{2} \cdot x\right)} \cdot \frac{4}{3} \]
    12. lift-*.f6499.5

      \[\leadsto \tan \color{blue}{\left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  6. Applied rewrites99.5%

    \[\leadsto \color{blue}{\tan \left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  7. Final simplification99.5%

    \[\leadsto 1.3333333333333333 \cdot \tan \left(0.5 \cdot x\right) \]
  8. Add Preprocessing

Alternative 3: 50.3% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-6.613756613756614 \cdot 10^{-5}, x \cdot x, -0.002777777777777778\right), x \cdot x, -0.16666666666666666\right), x \cdot x, 2\right)}{x}} \cdot 1.3333333333333333 \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  (/
   1.0
   (/
    (fma
     (fma
      (fma -6.613756613756614e-5 (* x x) -0.002777777777777778)
      (* x x)
      -0.16666666666666666)
     (* x x)
     2.0)
    x))
  1.3333333333333333))
double code(double x) {
	return (1.0 / (fma(fma(fma(-6.613756613756614e-5, (x * x), -0.002777777777777778), (x * x), -0.16666666666666666), (x * x), 2.0) / x)) * 1.3333333333333333;
}
function code(x)
	return Float64(Float64(1.0 / Float64(fma(fma(fma(-6.613756613756614e-5, Float64(x * x), -0.002777777777777778), Float64(x * x), -0.16666666666666666), Float64(x * x), 2.0) / x)) * 1.3333333333333333)
end
code[x_] := N[(N[(1.0 / N[(N[(N[(N[(-6.613756613756614e-5 * N[(x * x), $MachinePrecision] + -0.002777777777777778), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-6.613756613756614 \cdot 10^{-5}, x \cdot x, -0.002777777777777778\right), x \cdot x, -0.16666666666666666\right), x \cdot x, 2\right)}{x}} \cdot 1.3333333333333333
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot \frac{1}{2}\right)\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \]
    2. clear-numN/A

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

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

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

      \[\leadsto \frac{1}{\frac{\sin x}{\color{blue}{\frac{8}{3} \cdot \left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)\right)}}} \]
    6. associate-/r*N/A

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}}} \]
    8. lift-sin.f64N/A

      \[\leadsto \frac{\color{blue}{\sin \left(x \cdot \frac{1}{2}\right)} \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}} \]
    9. lift-sin.f64N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \color{blue}{\sin \left(x \cdot \frac{1}{2}\right)}}{\frac{\sin x}{\frac{8}{3}}} \]
    10. sin-multN/A

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    11. div-invN/A

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

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \color{blue}{\frac{1}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    13. frac-2negN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\color{blue}{\frac{\mathsf{neg}\left(\sin x\right)}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    14. neg-mul-1N/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{-1 \cdot \sin x}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    15. *-commutativeN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{\sin x \cdot -1}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
  4. Applied rewrites52.4%

    \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x} \cdot 1.3333333333333333} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x}} \cdot \frac{4}{3} \]
    2. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{1 - \cos x}}{\sin x} \cdot \frac{4}{3} \]
    3. lift-cos.f64N/A

      \[\leadsto \frac{1 - \color{blue}{\cos x}}{\sin x} \cdot \frac{4}{3} \]
    4. lift-sin.f64N/A

      \[\leadsto \frac{1 - \cos x}{\color{blue}{\sin x}} \cdot \frac{4}{3} \]
    5. hang-p0-tanN/A

      \[\leadsto \color{blue}{\tan \left(\frac{x}{2}\right)} \cdot \frac{4}{3} \]
    6. div-invN/A

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    7. metadata-evalN/A

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

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    9. lower-tan.f6499.5

      \[\leadsto \color{blue}{\tan \left(x \cdot 0.5\right)} \cdot 1.3333333333333333 \]
    10. lift-*.f64N/A

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

      \[\leadsto \tan \color{blue}{\left(\frac{1}{2} \cdot x\right)} \cdot \frac{4}{3} \]
    12. lift-*.f6499.5

      \[\leadsto \tan \color{blue}{\left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  6. Applied rewrites99.5%

    \[\leadsto \color{blue}{\tan \left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  7. Step-by-step derivation
    1. lift-tan.f64N/A

      \[\leadsto \color{blue}{\tan \left(\frac{1}{2} \cdot x\right)} \cdot \frac{4}{3} \]
    2. tan-quotN/A

      \[\leadsto \color{blue}{\frac{\sin \left(\frac{1}{2} \cdot x\right)}{\cos \left(\frac{1}{2} \cdot x\right)}} \cdot \frac{4}{3} \]
    3. clear-numN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\cos \left(\frac{1}{2} \cdot x\right)}{\sin \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\cos \left(\frac{1}{2} \cdot x\right)}{\sin \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    5. clear-numN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\sin \left(\frac{1}{2} \cdot x\right)}{\cos \left(\frac{1}{2} \cdot x\right)}}}} \cdot \frac{4}{3} \]
    6. tan-quotN/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\tan \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    7. lift-tan.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\tan \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    8. lower-/.f6499.5

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\tan \left(0.5 \cdot x\right)}}} \cdot 1.3333333333333333 \]
    9. lift-*.f64N/A

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

      \[\leadsto \frac{1}{\frac{1}{\tan \color{blue}{\left(x \cdot \frac{1}{2}\right)}}} \cdot \frac{4}{3} \]
    11. lower-*.f6499.5

      \[\leadsto \frac{1}{\frac{1}{\tan \color{blue}{\left(x \cdot 0.5\right)}}} \cdot 1.3333333333333333 \]
  8. Applied rewrites99.5%

    \[\leadsto \color{blue}{\frac{1}{\frac{1}{\tan \left(x \cdot 0.5\right)}}} \cdot 1.3333333333333333 \]
  9. Taylor expanded in x around 0

    \[\leadsto \frac{1}{\color{blue}{\frac{2 + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) - \frac{1}{6}\right)}{x}}} \cdot \frac{4}{3} \]
  10. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{2 + {x}^{2} \cdot \left({x}^{2} \cdot \left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) - \frac{1}{6}\right)}{x}}} \cdot \frac{4}{3} \]
    2. +-commutativeN/A

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

      \[\leadsto \frac{1}{\frac{\color{blue}{\left({x}^{2} \cdot \left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) - \frac{1}{6}\right) \cdot {x}^{2}} + 2}{x}} \cdot \frac{4}{3} \]
    4. lower-fma.f64N/A

      \[\leadsto \frac{1}{\frac{\color{blue}{\mathsf{fma}\left({x}^{2} \cdot \left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) - \frac{1}{6}, {x}^{2}, 2\right)}}{x}} \cdot \frac{4}{3} \]
    5. sub-negN/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{{x}^{2} \cdot \left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right)}, {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    6. *-commutativeN/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) \cdot {x}^{2}} + \left(\mathsf{neg}\left(\frac{1}{6}\right)\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    7. metadata-evalN/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}\right) \cdot {x}^{2} + \color{blue}{\frac{-1}{6}}, {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    8. lower-fma.f64N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{-1}{15120} \cdot {x}^{2} - \frac{1}{360}, {x}^{2}, \frac{-1}{6}\right)}, {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    9. sub-negN/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\frac{-1}{15120} \cdot {x}^{2} + \left(\mathsf{neg}\left(\frac{1}{360}\right)\right)}, {x}^{2}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    10. metadata-evalN/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120} \cdot {x}^{2} + \color{blue}{\frac{-1}{360}}, {x}^{2}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    11. lower-fma.f64N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{-1}{15120}, {x}^{2}, \frac{-1}{360}\right)}, {x}^{2}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    12. unpow2N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120}, \color{blue}{x \cdot x}, \frac{-1}{360}\right), {x}^{2}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    13. lower-*.f64N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120}, \color{blue}{x \cdot x}, \frac{-1}{360}\right), {x}^{2}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    14. unpow2N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120}, x \cdot x, \frac{-1}{360}\right), \color{blue}{x \cdot x}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    15. lower-*.f64N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120}, x \cdot x, \frac{-1}{360}\right), \color{blue}{x \cdot x}, \frac{-1}{6}\right), {x}^{2}, 2\right)}{x}} \cdot \frac{4}{3} \]
    16. unpow2N/A

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{15120}, x \cdot x, \frac{-1}{360}\right), x \cdot x, \frac{-1}{6}\right), \color{blue}{x \cdot x}, 2\right)}{x}} \cdot \frac{4}{3} \]
    17. lower-*.f6452.3

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-6.613756613756614 \cdot 10^{-5}, x \cdot x, -0.002777777777777778\right), x \cdot x, -0.16666666666666666\right), \color{blue}{x \cdot x}, 2\right)}{x}} \cdot 1.3333333333333333 \]
  11. Applied rewrites52.3%

    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-6.613756613756614 \cdot 10^{-5}, x \cdot x, -0.002777777777777778\right), x \cdot x, -0.16666666666666666\right), x \cdot x, 2\right)}{x}}} \cdot 1.3333333333333333 \]
  12. Add Preprocessing

Alternative 4: 50.4% accurate, 8.8× speedup?

\[\begin{array}{l} \\ \frac{1}{\frac{\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 2\right)}{x}} \cdot 1.3333333333333333 \end{array} \]
(FPCore (x)
 :precision binary64
 (* (/ 1.0 (/ (fma -0.16666666666666666 (* x x) 2.0) x)) 1.3333333333333333))
double code(double x) {
	return (1.0 / (fma(-0.16666666666666666, (x * x), 2.0) / x)) * 1.3333333333333333;
}
function code(x)
	return Float64(Float64(1.0 / Float64(fma(-0.16666666666666666, Float64(x * x), 2.0) / x)) * 1.3333333333333333)
end
code[x_] := N[(N[(1.0 / N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{\frac{\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 2\right)}{x}} \cdot 1.3333333333333333
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot \frac{1}{2}\right)\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \]
    2. clear-numN/A

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

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

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

      \[\leadsto \frac{1}{\frac{\sin x}{\color{blue}{\frac{8}{3} \cdot \left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)\right)}}} \]
    6. associate-/r*N/A

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}}} \]
    8. lift-sin.f64N/A

      \[\leadsto \frac{\color{blue}{\sin \left(x \cdot \frac{1}{2}\right)} \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}} \]
    9. lift-sin.f64N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \color{blue}{\sin \left(x \cdot \frac{1}{2}\right)}}{\frac{\sin x}{\frac{8}{3}}} \]
    10. sin-multN/A

      \[\leadsto \frac{\color{blue}{\frac{\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    11. div-invN/A

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

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \color{blue}{\frac{1}{2}}}{\frac{\sin x}{\frac{8}{3}}} \]
    13. frac-2negN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\color{blue}{\frac{\mathsf{neg}\left(\sin x\right)}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    14. neg-mul-1N/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{-1 \cdot \sin x}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    15. *-commutativeN/A

      \[\leadsto \frac{\left(\cos \left(x \cdot \frac{1}{2} - x \cdot \frac{1}{2}\right) - \cos \left(x \cdot \frac{1}{2} + x \cdot \frac{1}{2}\right)\right) \cdot \frac{1}{2}}{\frac{\color{blue}{\sin x \cdot -1}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
  4. Applied rewrites52.4%

    \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x} \cdot 1.3333333333333333} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1 - \cos x}{\sin x}} \cdot \frac{4}{3} \]
    2. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{1 - \cos x}}{\sin x} \cdot \frac{4}{3} \]
    3. lift-cos.f64N/A

      \[\leadsto \frac{1 - \color{blue}{\cos x}}{\sin x} \cdot \frac{4}{3} \]
    4. lift-sin.f64N/A

      \[\leadsto \frac{1 - \cos x}{\color{blue}{\sin x}} \cdot \frac{4}{3} \]
    5. hang-p0-tanN/A

      \[\leadsto \color{blue}{\tan \left(\frac{x}{2}\right)} \cdot \frac{4}{3} \]
    6. div-invN/A

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    7. metadata-evalN/A

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

      \[\leadsto \tan \color{blue}{\left(x \cdot \frac{1}{2}\right)} \cdot \frac{4}{3} \]
    9. lower-tan.f6499.5

      \[\leadsto \color{blue}{\tan \left(x \cdot 0.5\right)} \cdot 1.3333333333333333 \]
    10. lift-*.f64N/A

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

      \[\leadsto \tan \color{blue}{\left(\frac{1}{2} \cdot x\right)} \cdot \frac{4}{3} \]
    12. lift-*.f6499.5

      \[\leadsto \tan \color{blue}{\left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  6. Applied rewrites99.5%

    \[\leadsto \color{blue}{\tan \left(0.5 \cdot x\right)} \cdot 1.3333333333333333 \]
  7. Step-by-step derivation
    1. lift-tan.f64N/A

      \[\leadsto \color{blue}{\tan \left(\frac{1}{2} \cdot x\right)} \cdot \frac{4}{3} \]
    2. tan-quotN/A

      \[\leadsto \color{blue}{\frac{\sin \left(\frac{1}{2} \cdot x\right)}{\cos \left(\frac{1}{2} \cdot x\right)}} \cdot \frac{4}{3} \]
    3. clear-numN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\cos \left(\frac{1}{2} \cdot x\right)}{\sin \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\cos \left(\frac{1}{2} \cdot x\right)}{\sin \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    5. clear-numN/A

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\sin \left(\frac{1}{2} \cdot x\right)}{\cos \left(\frac{1}{2} \cdot x\right)}}}} \cdot \frac{4}{3} \]
    6. tan-quotN/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\tan \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    7. lift-tan.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\tan \left(\frac{1}{2} \cdot x\right)}}} \cdot \frac{4}{3} \]
    8. lower-/.f6499.5

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{\tan \left(0.5 \cdot x\right)}}} \cdot 1.3333333333333333 \]
    9. lift-*.f64N/A

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

      \[\leadsto \frac{1}{\frac{1}{\tan \color{blue}{\left(x \cdot \frac{1}{2}\right)}}} \cdot \frac{4}{3} \]
    11. lower-*.f6499.5

      \[\leadsto \frac{1}{\frac{1}{\tan \color{blue}{\left(x \cdot 0.5\right)}}} \cdot 1.3333333333333333 \]
  8. Applied rewrites99.5%

    \[\leadsto \color{blue}{\frac{1}{\frac{1}{\tan \left(x \cdot 0.5\right)}}} \cdot 1.3333333333333333 \]
  9. Taylor expanded in x around 0

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

      \[\leadsto \frac{1}{\color{blue}{\frac{2 + \frac{-1}{6} \cdot {x}^{2}}{x}}} \cdot \frac{4}{3} \]
    2. +-commutativeN/A

      \[\leadsto \frac{1}{\frac{\color{blue}{\frac{-1}{6} \cdot {x}^{2} + 2}}{x}} \cdot \frac{4}{3} \]
    3. lower-fma.f64N/A

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

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{x \cdot x}, 2\right)}{x}} \cdot \frac{4}{3} \]
    5. lower-*.f6452.2

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(-0.16666666666666666, \color{blue}{x \cdot x}, 2\right)}{x}} \cdot 1.3333333333333333 \]
  11. Applied rewrites52.2%

    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 2\right)}{x}}} \cdot 1.3333333333333333 \]
  12. Add Preprocessing

Alternative 5: 50.2% accurate, 20.2× speedup?

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

\\
\frac{0.25 \cdot x}{0.375}
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot \frac{1}{2}\right)\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \]
    2. clear-numN/A

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

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

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

      \[\leadsto \frac{1}{\frac{\sin x}{\color{blue}{\frac{8}{3} \cdot \left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)\right)}}} \]
    6. associate-/r*N/A

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{\frac{8}{3}}}} \]
    8. frac-2negN/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\color{blue}{\frac{\mathsf{neg}\left(\sin x\right)}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    9. neg-mul-1N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\color{blue}{-1 \cdot \sin x}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    10. *-commutativeN/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\frac{\color{blue}{\sin x \cdot -1}}{\mathsf{neg}\left(\frac{8}{3}\right)}} \]
    11. associate-/l*N/A

      \[\leadsto \frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\color{blue}{\sin x \cdot \frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    12. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}}{\frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
    13. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}}{\frac{-1}{\mathsf{neg}\left(\frac{8}{3}\right)}}} \]
  4. Applied rewrites52.4%

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(-0.5, \cos x, 0.5\right)}{\sin x}}{0.375}} \]
  5. Taylor expanded in x around 0

    \[\leadsto \frac{\color{blue}{\frac{1}{4} \cdot x}}{\frac{3}{8}} \]
  6. Step-by-step derivation
    1. lower-*.f6451.6

      \[\leadsto \frac{\color{blue}{0.25 \cdot x}}{0.375} \]
  7. Applied rewrites51.6%

    \[\leadsto \frac{\color{blue}{0.25 \cdot x}}{0.375} \]
  8. Add Preprocessing

Alternative 6: 49.9% accurate, 57.2× speedup?

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

\\
0.6666666666666666 \cdot x
\end{array}
Derivation
  1. Initial program 75.7%

    \[\frac{\left(\frac{8}{3} \cdot \sin \left(x \cdot 0.5\right)\right) \cdot \sin \left(x \cdot 0.5\right)}{\sin x} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0

    \[\leadsto \color{blue}{\frac{2}{3} \cdot x} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{x \cdot \frac{2}{3}} \]
    2. lower-*.f6451.4

      \[\leadsto \color{blue}{x \cdot 0.6666666666666666} \]
  5. Applied rewrites51.4%

    \[\leadsto \color{blue}{x \cdot 0.6666666666666666} \]
  6. Final simplification51.4%

    \[\leadsto 0.6666666666666666 \cdot x \]
  7. Add Preprocessing

Developer Target 1: 99.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(x \cdot 0.5\right)\\ \frac{\frac{8 \cdot t\_0}{3}}{\frac{\sin x}{t\_0}} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sin (* x 0.5)))) (/ (/ (* 8.0 t_0) 3.0) (/ (sin x) t_0))))
double code(double x) {
	double t_0 = sin((x * 0.5));
	return ((8.0 * t_0) / 3.0) / (sin(x) / t_0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sin((x * 0.5d0))
    code = ((8.0d0 * t_0) / 3.0d0) / (sin(x) / t_0)
end function
public static double code(double x) {
	double t_0 = Math.sin((x * 0.5));
	return ((8.0 * t_0) / 3.0) / (Math.sin(x) / t_0);
}
def code(x):
	t_0 = math.sin((x * 0.5))
	return ((8.0 * t_0) / 3.0) / (math.sin(x) / t_0)
function code(x)
	t_0 = sin(Float64(x * 0.5))
	return Float64(Float64(Float64(8.0 * t_0) / 3.0) / Float64(sin(x) / t_0))
end
function tmp = code(x)
	t_0 = sin((x * 0.5));
	tmp = ((8.0 * t_0) / 3.0) / (sin(x) / t_0);
end
code[x_] := Block[{t$95$0 = N[Sin[N[(x * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(8.0 * t$95$0), $MachinePrecision] / 3.0), $MachinePrecision] / N[(N[Sin[x], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(x \cdot 0.5\right)\\
\frac{\frac{8 \cdot t\_0}{3}}{\frac{\sin x}{t\_0}}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024277 
(FPCore (x)
  :name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, A"
  :precision binary64

  :alt
  (! :herbie-platform default (/ (/ (* 8 (sin (* x 1/2))) 3) (/ (sin x) (sin (* x 1/2)))))

  (/ (* (* (/ 8.0 3.0) (sin (* x 0.5))) (sin (* x 0.5))) (sin x)))