Diagrams.TwoD.Path.Metafont.Internal:hobbyF from diagrams-contrib-1.3.0.5

Percentage Accurate: 99.3% → 99.4%
Time: 24.9s
Alternatives: 37
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/
  (+
   2.0
   (*
    (*
     (* (sqrt 2.0) (- (sin x) (/ (sin y) 16.0)))
     (- (sin y) (/ (sin x) 16.0)))
    (- (cos x) (cos y))))
  (*
   3.0
   (+
    (+ 1.0 (* (/ (- (sqrt 5.0) 1.0) 2.0) (cos x)))
    (* (/ (- 3.0 (sqrt 5.0)) 2.0) (cos y))))))
double code(double x, double y) {
	return (2.0 + (((sqrt(2.0) * (sin(x) - (sin(y) / 16.0))) * (sin(y) - (sin(x) / 16.0))) * (cos(x) - cos(y)))) / (3.0 * ((1.0 + (((sqrt(5.0) - 1.0) / 2.0) * cos(x))) + (((3.0 - sqrt(5.0)) / 2.0) * cos(y))));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (2.0d0 + (((sqrt(2.0d0) * (sin(x) - (sin(y) / 16.0d0))) * (sin(y) - (sin(x) / 16.0d0))) * (cos(x) - cos(y)))) / (3.0d0 * ((1.0d0 + (((sqrt(5.0d0) - 1.0d0) / 2.0d0) * cos(x))) + (((3.0d0 - sqrt(5.0d0)) / 2.0d0) * cos(y))))
end function
public static double code(double x, double y) {
	return (2.0 + (((Math.sqrt(2.0) * (Math.sin(x) - (Math.sin(y) / 16.0))) * (Math.sin(y) - (Math.sin(x) / 16.0))) * (Math.cos(x) - Math.cos(y)))) / (3.0 * ((1.0 + (((Math.sqrt(5.0) - 1.0) / 2.0) * Math.cos(x))) + (((3.0 - Math.sqrt(5.0)) / 2.0) * Math.cos(y))));
}
def code(x, y):
	return (2.0 + (((math.sqrt(2.0) * (math.sin(x) - (math.sin(y) / 16.0))) * (math.sin(y) - (math.sin(x) / 16.0))) * (math.cos(x) - math.cos(y)))) / (3.0 * ((1.0 + (((math.sqrt(5.0) - 1.0) / 2.0) * math.cos(x))) + (((3.0 - math.sqrt(5.0)) / 2.0) * math.cos(y))))
function code(x, y)
	return Float64(Float64(2.0 + Float64(Float64(Float64(sqrt(2.0) * Float64(sin(x) - Float64(sin(y) / 16.0))) * Float64(sin(y) - Float64(sin(x) / 16.0))) * Float64(cos(x) - cos(y)))) / Float64(3.0 * Float64(Float64(1.0 + Float64(Float64(Float64(sqrt(5.0) - 1.0) / 2.0) * cos(x))) + Float64(Float64(Float64(3.0 - sqrt(5.0)) / 2.0) * cos(y)))))
end
function tmp = code(x, y)
	tmp = (2.0 + (((sqrt(2.0) * (sin(x) - (sin(y) / 16.0))) * (sin(y) - (sin(x) / 16.0))) * (cos(x) - cos(y)))) / (3.0 * ((1.0 + (((sqrt(5.0) - 1.0) / 2.0) * cos(x))) + (((3.0 - sqrt(5.0)) / 2.0) * cos(y))));
end
code[x_, y_] := N[(N[(2.0 + N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] - N[(N[Sin[x], $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[x], $MachinePrecision] - N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 * N[(N[(1.0 + N[(N[(N[(N[Sqrt[5.0], $MachinePrecision] - 1.0), $MachinePrecision] / 2.0), $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(3.0 - N[Sqrt[5.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)}
\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 37 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: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/
  (+
   2.0
   (*
    (*
     (* (sqrt 2.0) (- (sin x) (/ (sin y) 16.0)))
     (- (sin y) (/ (sin x) 16.0)))
    (- (cos x) (cos y))))
  (*
   3.0
   (+
    (+ 1.0 (* (/ (- (sqrt 5.0) 1.0) 2.0) (cos x)))
    (* (/ (- 3.0 (sqrt 5.0)) 2.0) (cos y))))))
double code(double x, double y) {
	return (2.0 + (((sqrt(2.0) * (sin(x) - (sin(y) / 16.0))) * (sin(y) - (sin(x) / 16.0))) * (cos(x) - cos(y)))) / (3.0 * ((1.0 + (((sqrt(5.0) - 1.0) / 2.0) * cos(x))) + (((3.0 - sqrt(5.0)) / 2.0) * cos(y))));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (2.0d0 + (((sqrt(2.0d0) * (sin(x) - (sin(y) / 16.0d0))) * (sin(y) - (sin(x) / 16.0d0))) * (cos(x) - cos(y)))) / (3.0d0 * ((1.0d0 + (((sqrt(5.0d0) - 1.0d0) / 2.0d0) * cos(x))) + (((3.0d0 - sqrt(5.0d0)) / 2.0d0) * cos(y))))
end function
public static double code(double x, double y) {
	return (2.0 + (((Math.sqrt(2.0) * (Math.sin(x) - (Math.sin(y) / 16.0))) * (Math.sin(y) - (Math.sin(x) / 16.0))) * (Math.cos(x) - Math.cos(y)))) / (3.0 * ((1.0 + (((Math.sqrt(5.0) - 1.0) / 2.0) * Math.cos(x))) + (((3.0 - Math.sqrt(5.0)) / 2.0) * Math.cos(y))));
}
def code(x, y):
	return (2.0 + (((math.sqrt(2.0) * (math.sin(x) - (math.sin(y) / 16.0))) * (math.sin(y) - (math.sin(x) / 16.0))) * (math.cos(x) - math.cos(y)))) / (3.0 * ((1.0 + (((math.sqrt(5.0) - 1.0) / 2.0) * math.cos(x))) + (((3.0 - math.sqrt(5.0)) / 2.0) * math.cos(y))))
function code(x, y)
	return Float64(Float64(2.0 + Float64(Float64(Float64(sqrt(2.0) * Float64(sin(x) - Float64(sin(y) / 16.0))) * Float64(sin(y) - Float64(sin(x) / 16.0))) * Float64(cos(x) - cos(y)))) / Float64(3.0 * Float64(Float64(1.0 + Float64(Float64(Float64(sqrt(5.0) - 1.0) / 2.0) * cos(x))) + Float64(Float64(Float64(3.0 - sqrt(5.0)) / 2.0) * cos(y)))))
end
function tmp = code(x, y)
	tmp = (2.0 + (((sqrt(2.0) * (sin(x) - (sin(y) / 16.0))) * (sin(y) - (sin(x) / 16.0))) * (cos(x) - cos(y)))) / (3.0 * ((1.0 + (((sqrt(5.0) - 1.0) / 2.0) * cos(x))) + (((3.0 - sqrt(5.0)) / 2.0) * cos(y))));
end
code[x_, y_] := N[(N[(2.0 + N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] - N[(N[Sin[x], $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[x], $MachinePrecision] - N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 * N[(N[(1.0 + N[(N[(N[(N[Sqrt[5.0], $MachinePrecision] - 1.0), $MachinePrecision] / 2.0), $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(3.0 - N[Sqrt[5.0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)}
\end{array}

Alternative 1: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/
  (fma
   (fma (sin y) -0.0625 (sin x))
   (* (- (cos x) (cos y)) (* (sqrt 2.0) (fma -0.0625 (sin x) (sin y))))
   2.0)
  (fma
   (fma (fma (sqrt 5.0) 0.5 -0.5) (cos x) 1.0)
   3.0
   (/ (* (cos y) 6.0) (+ (sqrt 5.0) 3.0)))))
double code(double x, double y) {
	return fma(fma(sin(y), -0.0625, sin(x)), ((cos(x) - cos(y)) * (sqrt(2.0) * fma(-0.0625, sin(x), sin(y)))), 2.0) / fma(fma(fma(sqrt(5.0), 0.5, -0.5), cos(x), 1.0), 3.0, ((cos(y) * 6.0) / (sqrt(5.0) + 3.0)));
}
function code(x, y)
	return Float64(fma(fma(sin(y), -0.0625, sin(x)), Float64(Float64(cos(x) - cos(y)) * Float64(sqrt(2.0) * fma(-0.0625, sin(x), sin(y)))), 2.0) / fma(fma(fma(sqrt(5.0), 0.5, -0.5), cos(x), 1.0), 3.0, Float64(Float64(cos(y) * 6.0) / Float64(sqrt(5.0) + 3.0))))
end
code[x_, y_] := N[(N[(N[(N[Sin[y], $MachinePrecision] * -0.0625 + N[Sin[x], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[x], $MachinePrecision] - N[Cos[y], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-0.0625 * N[Sin[x], $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / N[(N[(N[(N[Sqrt[5.0], $MachinePrecision] * 0.5 + -0.5), $MachinePrecision] * N[Cos[x], $MachinePrecision] + 1.0), $MachinePrecision] * 3.0 + N[(N[(N[Cos[y], $MachinePrecision] * 6.0), $MachinePrecision] / N[(N[Sqrt[5.0], $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[\frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

      \[\leadsto \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{\color{blue}{\mathsf{fma}\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x, 3, \left(\frac{3 - \sqrt{5}}{2} \cdot \cos y\right) \cdot 3\right)}} \]
  4. Applied rewrites99.5%

    \[\leadsto \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(1.5 - \sqrt{5} \cdot 0.5\right)\right)}} \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

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

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right) + 2}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right)} \cdot \left(\cos x - \cos y\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    5. associate-*l*N/A

      \[\leadsto \frac{\color{blue}{\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right)} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sin x - \frac{\sin y}{16}\right) \cdot \sqrt{2}\right)} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    8. associate-*l*N/A

      \[\leadsto \frac{\color{blue}{\left(\sin x - \frac{\sin y}{16}\right) \cdot \left(\sqrt{2} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right)\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
  6. Applied rewrites99.5%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, -0.0625, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(1.5 - \sqrt{5} \cdot 0.5\right)\right)} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \color{blue}{\left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    2. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    3. flip3--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{{\frac{3}{2}}^{3} - {\left(\sqrt{5} \cdot \frac{1}{2}\right)}^{3}}{\frac{3}{2} \cdot \frac{3}{2} + \left(\left(\sqrt{5} \cdot \frac{1}{2}\right) \cdot \left(\sqrt{5} \cdot \frac{1}{2}\right) + \frac{3}{2} \cdot \left(\sqrt{5} \cdot \frac{1}{2}\right)\right)}}\right)} \]
    4. flip3--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \color{blue}{\sqrt{5} \cdot \frac{1}{2}}\right)\right)} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \color{blue}{\frac{1}{2}}\right)\right)} \]
    7. div-invN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \color{blue}{\frac{\sqrt{5}}{2}}\right)\right)} \]
    8. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\frac{3}{2}} - \frac{\sqrt{5}}{2}\right)\right)} \]
    9. div-subN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{3 - \sqrt{5}}{2}}\right)} \]
    10. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \frac{\color{blue}{3 - \sqrt{5}}}{2}\right)} \]
    11. div-invN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\left(3 - \sqrt{5}\right) \cdot \frac{1}{2}\right)}\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\left(3 - \sqrt{5}\right)} \cdot \frac{1}{2}\right)\right)} \]
    13. flip--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{3 + \sqrt{5}}} \cdot \frac{1}{2}\right)\right)} \]
    14. lift-+.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{\color{blue}{3 + \sqrt{5}}} \cdot \frac{1}{2}\right)\right)} \]
    15. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{3 + \sqrt{5}} \cdot \color{blue}{\frac{1}{2}}\right)\right)} \]
    16. associate-*l/N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{\left(3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}\right) \cdot \frac{1}{2}}{3 + \sqrt{5}}}\right)} \]
  8. Applied rewrites99.5%

    \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, -0.0625, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \color{blue}{\frac{\cos y \cdot 6}{3 + \sqrt{5}}}\right)} \]
  9. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \color{blue}{\sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \color{blue}{\left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    3. associate-*r*N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \color{blue}{\left(\sqrt{2} \cdot \mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right)\right) \cdot \left(\cos x - \cos y\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    4. *-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \color{blue}{\left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \color{blue}{\left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    6. lower-*.f6499.5

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \left(\cos x - \cos y\right) \cdot \color{blue}{\left(\sqrt{2} \cdot \mathsf{fma}\left(\sin x, -0.0625, \sin y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    7. lift-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \color{blue}{\left(\sin x \cdot \frac{-1}{16} + \sin y\right)}\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \left(\color{blue}{\frac{-1}{16} \cdot \sin x} + \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
    9. lower-fma.f6499.5

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \color{blue}{\mathsf{fma}\left(-0.0625, \sin x, \sin y\right)}\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
  10. Applied rewrites99.5%

    \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \color{blue}{\left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right)}, 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
  11. Final simplification99.5%

    \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \left(\cos x - \cos y\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)} \]
  12. Add Preprocessing

Alternative 2: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\cos x - \cos y, \mathsf{fma}\left(\sin y, -0.0625, \sin x\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/
  (fma
   (- (cos x) (cos y))
   (*
    (fma (sin y) -0.0625 (sin x))
    (* (sqrt 2.0) (fma -0.0625 (sin x) (sin y))))
   2.0)
  (fma
   (fma (fma (sqrt 5.0) 0.5 -0.5) (cos x) 1.0)
   3.0
   (/ (* (cos y) 6.0) (+ (sqrt 5.0) 3.0)))))
double code(double x, double y) {
	return fma((cos(x) - cos(y)), (fma(sin(y), -0.0625, sin(x)) * (sqrt(2.0) * fma(-0.0625, sin(x), sin(y)))), 2.0) / fma(fma(fma(sqrt(5.0), 0.5, -0.5), cos(x), 1.0), 3.0, ((cos(y) * 6.0) / (sqrt(5.0) + 3.0)));
}
function code(x, y)
	return Float64(fma(Float64(cos(x) - cos(y)), Float64(fma(sin(y), -0.0625, sin(x)) * Float64(sqrt(2.0) * fma(-0.0625, sin(x), sin(y)))), 2.0) / fma(fma(fma(sqrt(5.0), 0.5, -0.5), cos(x), 1.0), 3.0, Float64(Float64(cos(y) * 6.0) / Float64(sqrt(5.0) + 3.0))))
end
code[x_, y_] := N[(N[(N[(N[Cos[x], $MachinePrecision] - N[Cos[y], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sin[y], $MachinePrecision] * -0.0625 + N[Sin[x], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(-0.0625 * N[Sin[x], $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / N[(N[(N[(N[Sqrt[5.0], $MachinePrecision] * 0.5 + -0.5), $MachinePrecision] * N[Cos[x], $MachinePrecision] + 1.0), $MachinePrecision] * 3.0 + N[(N[(N[Cos[y], $MachinePrecision] * 6.0), $MachinePrecision] / N[(N[Sqrt[5.0], $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(\cos x - \cos y, \mathsf{fma}\left(\sin y, -0.0625, \sin x\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)}
\end{array}
Derivation
  1. Initial program 99.3%

    \[\frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{3 \cdot \left(\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x\right) + \frac{3 - \sqrt{5}}{2} \cdot \cos y\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

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

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

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

      \[\leadsto \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{\color{blue}{\mathsf{fma}\left(1 + \frac{\sqrt{5} - 1}{2} \cdot \cos x, 3, \left(\frac{3 - \sqrt{5}}{2} \cdot \cos y\right) \cdot 3\right)}} \]
  4. Applied rewrites99.3%

    \[\leadsto \frac{2 + \left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(1.5 - \sqrt{5} \cdot 0.5\right)\right)}} \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

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

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right) + 2}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right) \cdot \left(\cos x - \cos y\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\sin y - \frac{\sin x}{16}\right)\right)} \cdot \left(\cos x - \cos y\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    5. associate-*l*N/A

      \[\leadsto \frac{\color{blue}{\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right) \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\sqrt{2} \cdot \left(\sin x - \frac{\sin y}{16}\right)\right)} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{\left(\left(\sin x - \frac{\sin y}{16}\right) \cdot \sqrt{2}\right)} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right) + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
    8. associate-*l*N/A

      \[\leadsto \frac{\color{blue}{\left(\sin x - \frac{\sin y}{16}\right) \cdot \left(\sqrt{2} \cdot \left(\left(\sin y - \frac{\sin x}{16}\right) \cdot \left(\cos x - \cos y\right)\right)\right)} + 2}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)\right)} \]
  6. Applied rewrites99.3%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, -0.0625, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(1.5 - \sqrt{5} \cdot 0.5\right)\right)} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \color{blue}{\left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    2. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    3. flip3--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{{\frac{3}{2}}^{3} - {\left(\sqrt{5} \cdot \frac{1}{2}\right)}^{3}}{\frac{3}{2} \cdot \frac{3}{2} + \left(\left(\sqrt{5} \cdot \frac{1}{2}\right) \cdot \left(\sqrt{5} \cdot \frac{1}{2}\right) + \frac{3}{2} \cdot \left(\sqrt{5} \cdot \frac{1}{2}\right)\right)}}\right)} \]
    4. flip3--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\frac{3}{2} - \sqrt{5} \cdot \frac{1}{2}\right)}\right)} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \color{blue}{\sqrt{5} \cdot \frac{1}{2}}\right)\right)} \]
    6. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \sqrt{5} \cdot \color{blue}{\frac{1}{2}}\right)\right)} \]
    7. div-invN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3}{2} - \color{blue}{\frac{\sqrt{5}}{2}}\right)\right)} \]
    8. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\frac{3}{2}} - \frac{\sqrt{5}}{2}\right)\right)} \]
    9. div-subN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{3 - \sqrt{5}}{2}}\right)} \]
    10. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \frac{\color{blue}{3 - \sqrt{5}}}{2}\right)} \]
    11. div-invN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\left(\left(3 - \sqrt{5}\right) \cdot \frac{1}{2}\right)}\right)} \]
    12. lift--.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\left(3 - \sqrt{5}\right)} \cdot \frac{1}{2}\right)\right)} \]
    13. flip--N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\color{blue}{\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{3 + \sqrt{5}}} \cdot \frac{1}{2}\right)\right)} \]
    14. lift-+.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{\color{blue}{3 + \sqrt{5}}} \cdot \frac{1}{2}\right)\right)} \]
    15. metadata-evalN/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \left(\frac{3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}}{3 + \sqrt{5}} \cdot \color{blue}{\frac{1}{2}}\right)\right)} \]
    16. associate-*l/N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, \frac{-1}{16}, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, \frac{-1}{16}, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, \frac{1}{2}, \frac{-1}{2}\right), \cos x, 1\right), 3, \left(3 \cdot \cos y\right) \cdot \color{blue}{\frac{\left(3 \cdot 3 - \sqrt{5} \cdot \sqrt{5}\right) \cdot \frac{1}{2}}{3 + \sqrt{5}}}\right)} \]
  8. Applied rewrites99.4%

    \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(\sin y, -0.0625, \sin x\right), \sqrt{2} \cdot \left(\mathsf{fma}\left(\sin x, -0.0625, \sin y\right) \cdot \left(\cos x - \cos y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \color{blue}{\frac{\cos y \cdot 6}{3 + \sqrt{5}}}\right)} \]
  9. Applied rewrites99.4%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\cos x - \cos y, \mathsf{fma}\left(\sin y, -0.0625, \sin x\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{3 + \sqrt{5}}\right)} \]
  10. Final simplification99.4%

    \[\leadsto \frac{\mathsf{fma}\left(\cos x - \cos y, \mathsf{fma}\left(\sin y, -0.0625, \sin x\right) \cdot \left(\sqrt{2} \cdot \mathsf{fma}\left(-0.0625, \sin x, \sin y\right)\right), 2\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\sqrt{5}, 0.5, -0.5\right), \cos x, 1\right), 3, \frac{\cos y \cdot 6}{\sqrt{5} + 3}\right)} \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2024223 
(FPCore (x y)
  :name "Diagrams.TwoD.Path.Metafont.Internal:hobbyF from diagrams-contrib-1.3.0.5"
  :precision binary64
  (/ (+ 2.0 (* (* (* (sqrt 2.0) (- (sin x) (/ (sin y) 16.0))) (- (sin y) (/ (sin x) 16.0))) (- (cos x) (cos y)))) (* 3.0 (+ (+ 1.0 (* (/ (- (sqrt 5.0) 1.0) 2.0) (cos x))) (* (/ (- 3.0 (sqrt 5.0)) 2.0) (cos y))))))