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

Percentage Accurate: 75.9% → 99.4%
Time: 8.3s
Alternatives: 4
Speedup: 2.9×

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 4 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: 75.9% 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.4% accurate, 2.9× speedup?

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

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

    \[\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. associate-/l*N/A

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\sin \left(x \cdot \frac{1}{2}\right)}^{2}}}{\sin x} \cdot \frac{8}{3} \]
    11. lower-pow.f6472.6

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

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

      \[\leadsto \frac{{\sin \color{blue}{\left(\frac{1}{2} \cdot x\right)}}^{2}}{\sin x} \cdot \frac{8}{3} \]
    14. lower-*.f6472.6

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

      \[\leadsto \frac{{\sin \left(\frac{1}{2} \cdot x\right)}^{2}}{\sin x} \cdot \color{blue}{\frac{8}{3}} \]
    16. metadata-eval72.6

      \[\leadsto \frac{{\sin \left(0.5 \cdot x\right)}^{2}}{\sin x} \cdot \color{blue}{2.6666666666666665} \]
  4. Applied rewrites72.6%

    \[\leadsto \color{blue}{\frac{{\sin \left(0.5 \cdot x\right)}^{2}}{\sin x} \cdot 2.6666666666666665} \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

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

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

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

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

      \[\leadsto \left(\color{blue}{\frac{\sin \left(\frac{1}{2} \cdot x\right)}{\sin x}} \cdot \sin \left(\frac{1}{2} \cdot x\right)\right) \cdot \frac{8}{3} \]
    6. lower-*.f6499.2

      \[\leadsto \color{blue}{\left(\frac{\sin \left(0.5 \cdot x\right)}{\sin x} \cdot \sin \left(0.5 \cdot x\right)\right)} \cdot 2.6666666666666665 \]
    7. lift-*.f64N/A

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

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

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

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

      \[\leadsto \left(\frac{\sin \left(x \cdot \frac{1}{2}\right)}{\sin x} \cdot \sin \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) \cdot \frac{8}{3} \]
    12. lower-*.f6499.2

      \[\leadsto \left(\frac{\sin \left(x \cdot 0.5\right)}{\sin x} \cdot \sin \color{blue}{\left(x \cdot 0.5\right)}\right) \cdot 2.6666666666666665 \]
  6. Applied rewrites99.2%

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

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

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

      \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \frac{1}{2}\right) \cdot \sin \left(x \cdot \frac{1}{2}\right)}{\sin x}} \cdot \frac{8}{3} \]
    4. 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)}{\sin x} \cdot \frac{8}{3} \]
    5. 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)}}{\sin x} \cdot \frac{8}{3} \]
    6. 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}}}{\sin x} \cdot \frac{8}{3} \]
    7. associate-/l/N/A

      \[\leadsto \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 \cdot \sin x}} \cdot \frac{8}{3} \]
    8. lower-/.f64N/A

      \[\leadsto \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 \cdot \sin x}} \cdot \frac{8}{3} \]
  8. Applied rewrites43.5%

    \[\leadsto \color{blue}{\frac{1 - \cos \left(1 \cdot x\right)}{2 \cdot \sin x}} \cdot 2.6666666666666665 \]
  9. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \tan \color{blue}{\left(\frac{x}{2}\right)} \cdot \frac{\frac{8}{3}}{2} \]
    16. metadata-eval99.4

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

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

Alternative 2: 55.4% accurate, 3.0× speedup?

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

\\
0.5 \cdot \left(\sin \left(0.5 \cdot x\right) \cdot 2.6666666666666665\right)
\end{array}
Derivation
  1. Initial program 72.6%

    \[\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. associate-/l*N/A

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sin \left(\frac{1}{2} \cdot x\right)}{\sin x} \cdot \color{blue}{\left(\sin \left(x \cdot \frac{1}{2}\right) \cdot \frac{8}{3}\right)} \]
    12. lower-*.f6499.2

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

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

      \[\leadsto \frac{\sin \left(\frac{1}{2} \cdot x\right)}{\sin x} \cdot \left(\sin \color{blue}{\left(\frac{1}{2} \cdot x\right)} \cdot \frac{8}{3}\right) \]
    15. lower-*.f6499.2

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

      \[\leadsto \frac{\sin \left(\frac{1}{2} \cdot x\right)}{\sin x} \cdot \left(\sin \left(\frac{1}{2} \cdot x\right) \cdot \color{blue}{\frac{8}{3}}\right) \]
    17. metadata-eval99.2

      \[\leadsto \frac{\sin \left(0.5 \cdot x\right)}{\sin x} \cdot \left(\sin \left(0.5 \cdot x\right) \cdot \color{blue}{2.6666666666666665}\right) \]
  4. Applied rewrites99.2%

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

    \[\leadsto \color{blue}{\frac{1}{2}} \cdot \left(\sin \left(\frac{1}{2} \cdot x\right) \cdot \frac{8}{3}\right) \]
  6. Step-by-step derivation
    1. Applied rewrites64.1%

      \[\leadsto \color{blue}{0.5} \cdot \left(\sin \left(0.5 \cdot x\right) \cdot 2.6666666666666665\right) \]
    2. Add Preprocessing

    Alternative 3: 52.1% accurate, 11.4× speedup?

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.0030864197530864196 \cdot {x}^{4} - 0.4444444444444444\right) \cdot \color{blue}{\frac{x}{0.05555555555555555 \cdot \left(x \cdot x\right) - 0.6666666666666666}} \]
      2. Taylor expanded in x around 0

        \[\leadsto \frac{-4}{9} \cdot \frac{\color{blue}{x}}{\frac{1}{18} \cdot \left(x \cdot x\right) - \frac{2}{3}} \]
      3. Step-by-step derivation
        1. Applied rewrites61.0%

          \[\leadsto -0.4444444444444444 \cdot \frac{\color{blue}{x}}{0.05555555555555555 \cdot \left(x \cdot x\right) - 0.6666666666666666} \]
        2. Add Preprocessing

        Alternative 4: 51.5% 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 72.6%

          \[\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-*.f6460.6

            \[\leadsto \color{blue}{0.6666666666666666 \cdot x} \]
        5. Applied rewrites60.6%

          \[\leadsto \color{blue}{0.6666666666666666 \cdot x} \]
        6. 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 2024329 
        (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)))