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

Percentage Accurate: 76.5% → 99.5%
Time: 11.3s
Alternatives: 9
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 9 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: 76.5% 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}{\sin x} \cdot \frac{t\_0}{0.375} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 x)))) (* (/ t_0 (sin x)) (/ t_0 0.375))))
double code(double x) {
	double t_0 = sin((0.5 * x));
	return (t_0 / sin(x)) * (t_0 / 0.375);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = sin((0.5d0 * x))
    code = (t_0 / sin(x)) * (t_0 / 0.375d0)
end function
public static double code(double x) {
	double t_0 = Math.sin((0.5 * x));
	return (t_0 / Math.sin(x)) * (t_0 / 0.375);
}
def code(x):
	t_0 = math.sin((0.5 * x))
	return (t_0 / math.sin(x)) * (t_0 / 0.375)
function code(x)
	t_0 = sin(Float64(0.5 * x))
	return Float64(Float64(t_0 / sin(x)) * Float64(t_0 / 0.375))
end
function tmp = code(x)
	t_0 = sin((0.5 * x));
	tmp = (t_0 / sin(x)) * (t_0 / 0.375);
end
code[x_] := Block[{t$95$0 = N[Sin[N[(0.5 * x), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 / N[Sin[x], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / 0.375), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

    \[\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)}}} \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\frac{\sin \left(0.5 \cdot x\right)}{\sin x} \cdot \frac{\sin \left(0.5 \cdot x\right)}{0.375}} \]
  5. 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.9%

    \[\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. div-invN/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{2.6666666666666665}{\sin x}}{\frac{2}{1 - \cos x}}} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{4}{3} \cdot \frac{1 - \cos x}{\sin x}} \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 51.2% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \frac{2.6666666666666665}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.00013227513227513228, -0.005555555555555556\right), -0.3333333333333333\right), 4\right)}{x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/
  2.6666666666666665
  (/
   (fma
    (* x x)
    (fma
     (* x x)
     (fma (* x x) -0.00013227513227513228 -0.005555555555555556)
     -0.3333333333333333)
    4.0)
   x)))
double code(double x) {
	return 2.6666666666666665 / (fma((x * x), fma((x * x), fma((x * x), -0.00013227513227513228, -0.005555555555555556), -0.3333333333333333), 4.0) / x);
}
function code(x)
	return Float64(2.6666666666666665 / Float64(fma(Float64(x * x), fma(Float64(x * x), fma(Float64(x * x), -0.00013227513227513228, -0.005555555555555556), -0.3333333333333333), 4.0) / x))
end
code[x_] := N[(2.6666666666666665 / N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.00013227513227513228 + -0.005555555555555556), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] + 4.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2.6666666666666665}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.00013227513227513228, -0.005555555555555556\right), -0.3333333333333333\right), 4\right)}{x}}
\end{array}
Derivation
  1. Initial program 75.9%

    \[\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. lift-*.f64N/A

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

      \[\leadsto \frac{\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)}{\sin x} \]
    4. associate-*l*N/A

      \[\leadsto \frac{\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)}}{\sin x} \]
    5. associate-/l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{8}{3}}{\frac{\mathsf{fma}\left(\color{blue}{x \cdot x}, {x}^{2} \cdot \left(\frac{-1}{7560} \cdot {x}^{2} - \frac{1}{180}\right) - \frac{1}{3}, 4\right)}{x}} \]
    5. lower-*.f64N/A

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

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

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

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

      \[\leadsto \frac{\frac{8}{3}}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{7560} \cdot {x}^{2} - \frac{1}{180}, \frac{-1}{3}\right), 4\right)}{x}} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{\frac{8}{3}}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{7560} \cdot {x}^{2} - \frac{1}{180}, \frac{-1}{3}\right), 4\right)}{x}} \]
    11. sub-negN/A

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

      \[\leadsto \frac{\frac{8}{3}}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{{x}^{2} \cdot \frac{-1}{7560}} + \left(\mathsf{neg}\left(\frac{1}{180}\right)\right), \frac{-1}{3}\right), 4\right)}{x}} \]
    13. metadata-evalN/A

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

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

      \[\leadsto \frac{\frac{8}{3}}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{7560}, \frac{-1}{180}\right), \frac{-1}{3}\right), 4\right)}{x}} \]
    16. lower-*.f6456.2

      \[\leadsto \frac{2.6666666666666665}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(\color{blue}{x \cdot x}, -0.00013227513227513228, -0.005555555555555556\right), -0.3333333333333333\right), 4\right)}{x}} \]
  7. Applied rewrites56.2%

    \[\leadsto \frac{2.6666666666666665}{\color{blue}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.00013227513227513228, -0.005555555555555556\right), -0.3333333333333333\right), 4\right)}{x}}} \]
  8. Add Preprocessing

Alternative 4: 51.3% accurate, 10.1× speedup?

\[\begin{array}{l} \\ \frac{2.6666666666666665}{\frac{\mathsf{fma}\left(x \cdot x, -0.3333333333333333, 4\right)}{x}} \end{array} \]
(FPCore (x)
 :precision binary64
 (/ 2.6666666666666665 (/ (fma (* x x) -0.3333333333333333 4.0) x)))
double code(double x) {
	return 2.6666666666666665 / (fma((x * x), -0.3333333333333333, 4.0) / x);
}
function code(x)
	return Float64(2.6666666666666665 / Float64(fma(Float64(x * x), -0.3333333333333333, 4.0) / x))
end
code[x_] := N[(2.6666666666666665 / N[(N[(N[(x * x), $MachinePrecision] * -0.3333333333333333 + 4.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2.6666666666666665}{\frac{\mathsf{fma}\left(x \cdot x, -0.3333333333333333, 4\right)}{x}}
\end{array}
Derivation
  1. Initial program 75.9%

    \[\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. lift-*.f64N/A

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

      \[\leadsto \frac{\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)}{\sin x} \]
    4. associate-*l*N/A

      \[\leadsto \frac{\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)}}{\sin x} \]
    5. associate-/l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2.6666666666666665}{\frac{\mathsf{fma}\left(\color{blue}{x \cdot x}, -0.3333333333333333, 4\right)}{x}} \]
  7. Applied rewrites56.1%

    \[\leadsto \frac{2.6666666666666665}{\color{blue}{\frac{\mathsf{fma}\left(x \cdot x, -0.3333333333333333, 4\right)}{x}}} \]
  8. Add Preprocessing

Alternative 5: 50.6% accurate, 10.4× speedup?

\[\begin{array}{l} \\ 1.3333333333333333 \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.004166666666666667, 0.041666666666666664\right), 0.5\right)\right) \end{array} \]
(FPCore (x)
 :precision binary64
 (*
  1.3333333333333333
  (*
   x
   (fma (* x x) (fma x (* x 0.004166666666666667) 0.041666666666666664) 0.5))))
double code(double x) {
	return 1.3333333333333333 * (x * fma((x * x), fma(x, (x * 0.004166666666666667), 0.041666666666666664), 0.5));
}
function code(x)
	return Float64(1.3333333333333333 * Float64(x * fma(Float64(x * x), fma(x, Float64(x * 0.004166666666666667), 0.041666666666666664), 0.5)))
end
code[x_] := N[(1.3333333333333333 * N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.004166666666666667), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1.3333333333333333 \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.004166666666666667, 0.041666666666666664\right), 0.5\right)\right)
\end{array}
Derivation
  1. Initial program 75.9%

    \[\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. div-invN/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{2.6666666666666665}{\sin x}}{\frac{2}{1 - \cos x}}} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{\frac{4}{3} \cdot \frac{1 - \cos x}{\sin x}} \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{4}{3} \cdot \left(x \cdot \color{blue}{\left(\frac{1}{2} + {x}^{2} \cdot \left(\frac{1}{24} + \frac{1}{240} \cdot {x}^{2}\right)\right)}\right) \]
  9. Step-by-step derivation
    1. Applied rewrites55.3%

      \[\leadsto 1.3333333333333333 \cdot \left(x \cdot \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.004166666666666667, 0.041666666666666664\right), 0.5\right)}\right) \]
    2. Add Preprocessing

    Alternative 6: 50.6% accurate, 12.3× speedup?

    \[\begin{array}{l} \\ x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.005555555555555556, 0.05555555555555555\right), 0.6666666666666666\right) \end{array} \]
    (FPCore (x)
     :precision binary64
     (*
      x
      (fma
       (* x x)
       (fma x (* x 0.005555555555555556) 0.05555555555555555)
       0.6666666666666666)))
    double code(double x) {
    	return x * fma((x * x), fma(x, (x * 0.005555555555555556), 0.05555555555555555), 0.6666666666666666);
    }
    
    function code(x)
    	return Float64(x * fma(Float64(x * x), fma(x, Float64(x * 0.005555555555555556), 0.05555555555555555), 0.6666666666666666))
    end
    
    code[x_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.005555555555555556), $MachinePrecision] + 0.05555555555555555), $MachinePrecision] + 0.6666666666666666), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.005555555555555556, 0.05555555555555555\right), 0.6666666666666666\right)
    \end{array}
    
    Derivation
    1. Initial program 75.9%

      \[\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}{x \cdot \left(\frac{2}{3} + {x}^{2} \cdot \left(\frac{1}{18} + \frac{1}{180} \cdot {x}^{2}\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

        \[\leadsto x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{18} + \frac{1}{180} \cdot {x}^{2}, \frac{2}{3}\right) \]
      5. lower-*.f64N/A

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

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{1}{180} \cdot {x}^{2} + \frac{1}{18}}, \frac{2}{3}\right) \]
      7. *-commutativeN/A

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{{x}^{2} \cdot \frac{1}{180}} + \frac{1}{18}, \frac{2}{3}\right) \]
      8. unpow2N/A

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{180} + \frac{1}{18}, \frac{2}{3}\right) \]
      9. associate-*l*N/A

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{x \cdot \left(x \cdot \frac{1}{180}\right)} + \frac{1}{18}, \frac{2}{3}\right) \]
      10. lower-fma.f64N/A

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{180}, \frac{1}{18}\right)}, \frac{2}{3}\right) \]
      11. lower-*.f6455.3

        \[\leadsto x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.005555555555555556}, 0.05555555555555555\right), 0.6666666666666666\right) \]
    5. Applied rewrites55.3%

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.005555555555555556, 0.05555555555555555\right), 0.6666666666666666\right)} \]
    6. Add Preprocessing

    Alternative 7: 50.6% accurate, 15.6× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(x \cdot \left(x \cdot x\right), 0.05555555555555555, x \cdot 0.6666666666666666\right) \end{array} \]
    (FPCore (x)
     :precision binary64
     (fma (* x (* x x)) 0.05555555555555555 (* x 0.6666666666666666)))
    double code(double x) {
    	return fma((x * (x * x)), 0.05555555555555555, (x * 0.6666666666666666));
    }
    
    function code(x)
    	return fma(Float64(x * Float64(x * x)), 0.05555555555555555, Float64(x * 0.6666666666666666))
    end
    
    code[x_] := N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * 0.05555555555555555 + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(x \cdot \left(x \cdot x\right), 0.05555555555555555, x \cdot 0.6666666666666666\right)
    \end{array}
    
    Derivation
    1. Initial program 75.9%

      \[\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 \frac{\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)}}{\sin x} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\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)}{\sin x} \]
      3. associate-*l*N/A

        \[\leadsto \frac{\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)}}{\sin x} \]
      4. lift-sin.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{18} \cdot {x}^{2} + \frac{2}{3}\right)} \]
      3. unpow2N/A

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

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

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

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(x, \frac{1}{18} \cdot x, \frac{2}{3}\right)} \]
      7. *-commutativeN/A

        \[\leadsto x \cdot \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{1}{18}}, \frac{2}{3}\right) \]
      8. lower-*.f6455.1

        \[\leadsto x \cdot \mathsf{fma}\left(x, \color{blue}{x \cdot 0.05555555555555555}, 0.6666666666666666\right) \]
    7. Applied rewrites55.1%

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(x, x \cdot 0.05555555555555555, 0.6666666666666666\right)} \]
    8. Step-by-step derivation
      1. Applied rewrites55.1%

        \[\leadsto \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \color{blue}{0.05555555555555555}, x \cdot 0.6666666666666666\right) \]
      2. Add Preprocessing

      Alternative 8: 50.6% accurate, 20.2× speedup?

      \[\begin{array}{l} \\ x \cdot \mathsf{fma}\left(0.05555555555555555, x \cdot x, 0.6666666666666666\right) \end{array} \]
      (FPCore (x)
       :precision binary64
       (* x (fma 0.05555555555555555 (* x x) 0.6666666666666666)))
      double code(double x) {
      	return x * fma(0.05555555555555555, (x * x), 0.6666666666666666);
      }
      
      function code(x)
      	return Float64(x * fma(0.05555555555555555, Float64(x * x), 0.6666666666666666))
      end
      
      code[x_] := N[(x * N[(0.05555555555555555 * N[(x * x), $MachinePrecision] + 0.6666666666666666), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      x \cdot \mathsf{fma}\left(0.05555555555555555, x \cdot x, 0.6666666666666666\right)
      \end{array}
      
      Derivation
      1. Initial program 75.9%

        \[\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}{x \cdot \left(\frac{2}{3} + \frac{1}{18} \cdot {x}^{2}\right)} \]
      4. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

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

          \[\leadsto x \cdot \mathsf{fma}\left(0.05555555555555555, \color{blue}{x \cdot x}, 0.6666666666666666\right) \]
      5. Applied rewrites55.1%

        \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(0.05555555555555555, x \cdot x, 0.6666666666666666\right)} \]
      6. Add Preprocessing

      Alternative 9: 50.8% accurate, 57.2× speedup?

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

        \[\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. lower-*.f6455.0

          \[\leadsto \color{blue}{0.6666666666666666 \cdot x} \]
      5. Applied rewrites55.0%

        \[\leadsto \color{blue}{0.6666666666666666 \cdot x} \]
      6. Final simplification55.0%

        \[\leadsto x \cdot 0.6666666666666666 \]
      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 2024222 
      (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)))