1/256 sin(-2 PI k / 256) (-sin(1/256 (2 PI) + 2 PI)) + 1/256 sin(-2 PI 2 k / 256) (-sin(2/256 (2 PI) + 2 PI)) + 1/256 sin(-2 PI 3 k / 256) (-sin(3/256 (2 PI) + 2 PI))

Percentage Accurate: 91.2% → 99.5%
Time: 5.1s
Alternatives: 6
Speedup: 81.2×

Specification

?
\[0 \leq k \land k \leq 256\]
\[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
(FPCore (k)
  :precision binary64
  (+
 (+
  (*
   (/ 1.0 256.0)
   (*
    (sin (* (- 2.0) (* PI (/ k 256.0))))
    (- (sin (+ (* (/ 1.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))
  (*
   (/ 1.0 256.0)
   (*
    (sin (* (- 2.0) (* PI (* 2.0 (/ k 256.0)))))
    (- (sin (+ (* (/ 2.0 256.0) (* 2.0 PI)) (* 2.0 PI)))))))
 (*
  (/ 1.0 256.0)
  (*
   (sin (* (- 2.0) (* PI (* 3.0 (/ k 256.0)))))
   (- (sin (+ (* (/ 3.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))))
double code(double k) {
	return (((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (k / 256.0)))) * -sin((((1.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI)))))) + ((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (2.0 * (k / 256.0))))) * -sin((((2.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI))))))) + ((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (3.0 * (k / 256.0))))) * -sin((((3.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI))))));
}
public static double code(double k) {
	return (((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (k / 256.0)))) * -Math.sin((((1.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI))))) + ((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (2.0 * (k / 256.0))))) * -Math.sin((((2.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI)))))) + ((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (3.0 * (k / 256.0))))) * -Math.sin((((3.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI)))));
}
def code(k):
	return (((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (k / 256.0)))) * -math.sin((((1.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi))))) + ((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (2.0 * (k / 256.0))))) * -math.sin((((2.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi)))))) + ((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (3.0 * (k / 256.0))))) * -math.sin((((3.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi)))))
function code(k)
	return Float64(Float64(Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(k / 256.0)))) * Float64(-sin(Float64(Float64(Float64(1.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi)))))) + Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(2.0 * Float64(k / 256.0))))) * Float64(-sin(Float64(Float64(Float64(2.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi))))))) + Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(3.0 * Float64(k / 256.0))))) * Float64(-sin(Float64(Float64(Float64(3.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi)))))))
end
function tmp = code(k)
	tmp = (((1.0 / 256.0) * (sin((-2.0 * (pi * (k / 256.0)))) * -sin((((1.0 / 256.0) * (2.0 * pi)) + (2.0 * pi))))) + ((1.0 / 256.0) * (sin((-2.0 * (pi * (2.0 * (k / 256.0))))) * -sin((((2.0 / 256.0) * (2.0 * pi)) + (2.0 * pi)))))) + ((1.0 / 256.0) * (sin((-2.0 * (pi * (3.0 * (k / 256.0))))) * -sin((((3.0 / 256.0) * (2.0 * pi)) + (2.0 * pi)))));
end
code[k_] := N[(N[(N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(1.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(2.0 * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(2.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(3.0 * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(3.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 91.2% accurate, 1.0× speedup?

\[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
(FPCore (k)
  :precision binary64
  (+
 (+
  (*
   (/ 1.0 256.0)
   (*
    (sin (* (- 2.0) (* PI (/ k 256.0))))
    (- (sin (+ (* (/ 1.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))
  (*
   (/ 1.0 256.0)
   (*
    (sin (* (- 2.0) (* PI (* 2.0 (/ k 256.0)))))
    (- (sin (+ (* (/ 2.0 256.0) (* 2.0 PI)) (* 2.0 PI)))))))
 (*
  (/ 1.0 256.0)
  (*
   (sin (* (- 2.0) (* PI (* 3.0 (/ k 256.0)))))
   (- (sin (+ (* (/ 3.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))))
double code(double k) {
	return (((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (k / 256.0)))) * -sin((((1.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI)))))) + ((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (2.0 * (k / 256.0))))) * -sin((((2.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI))))))) + ((1.0 / 256.0) * (sin((-2.0 * (((double) M_PI) * (3.0 * (k / 256.0))))) * -sin((((3.0 / 256.0) * (2.0 * ((double) M_PI))) + (2.0 * ((double) M_PI))))));
}
public static double code(double k) {
	return (((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (k / 256.0)))) * -Math.sin((((1.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI))))) + ((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (2.0 * (k / 256.0))))) * -Math.sin((((2.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI)))))) + ((1.0 / 256.0) * (Math.sin((-2.0 * (Math.PI * (3.0 * (k / 256.0))))) * -Math.sin((((3.0 / 256.0) * (2.0 * Math.PI)) + (2.0 * Math.PI)))));
}
def code(k):
	return (((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (k / 256.0)))) * -math.sin((((1.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi))))) + ((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (2.0 * (k / 256.0))))) * -math.sin((((2.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi)))))) + ((1.0 / 256.0) * (math.sin((-2.0 * (math.pi * (3.0 * (k / 256.0))))) * -math.sin((((3.0 / 256.0) * (2.0 * math.pi)) + (2.0 * math.pi)))))
function code(k)
	return Float64(Float64(Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(k / 256.0)))) * Float64(-sin(Float64(Float64(Float64(1.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi)))))) + Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(2.0 * Float64(k / 256.0))))) * Float64(-sin(Float64(Float64(Float64(2.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi))))))) + Float64(Float64(1.0 / 256.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(3.0 * Float64(k / 256.0))))) * Float64(-sin(Float64(Float64(Float64(3.0 / 256.0) * Float64(2.0 * pi)) + Float64(2.0 * pi)))))))
end
function tmp = code(k)
	tmp = (((1.0 / 256.0) * (sin((-2.0 * (pi * (k / 256.0)))) * -sin((((1.0 / 256.0) * (2.0 * pi)) + (2.0 * pi))))) + ((1.0 / 256.0) * (sin((-2.0 * (pi * (2.0 * (k / 256.0))))) * -sin((((2.0 / 256.0) * (2.0 * pi)) + (2.0 * pi)))))) + ((1.0 / 256.0) * (sin((-2.0 * (pi * (3.0 * (k / 256.0))))) * -sin((((3.0 / 256.0) * (2.0 * pi)) + (2.0 * pi)))));
end
code[k_] := N[(N[(N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(1.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(2.0 * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(2.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 256.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(3.0 * N[(k / 256.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sin[N[(N[(N[(3.0 / 256.0), $MachinePrecision] * N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision] + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)

Alternative 1: 99.5% accurate, 1.5× speedup?

\[0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right) \]
(FPCore (k)
  :precision binary64
  (*
 0.00390625
 (fma
  -0.07356456359966781
  (sin (* -2.0 (* (* 0.01171875 k) PI)))
  (fma
   (sin (* 2.015625 PI))
   (sin (* (* (* 0.0078125 k) PI) 2.0))
   (*
    (sin (* -2.0078125 PI))
    (sin (* -2.0 (* (* 0.00390625 k) PI))))))))
double code(double k) {
	return 0.00390625 * fma(-0.07356456359966781, sin((-2.0 * ((0.01171875 * k) * ((double) M_PI)))), fma(sin((2.015625 * ((double) M_PI))), sin((((0.0078125 * k) * ((double) M_PI)) * 2.0)), (sin((-2.0078125 * ((double) M_PI))) * sin((-2.0 * ((0.00390625 * k) * ((double) M_PI)))))));
}
function code(k)
	return Float64(0.00390625 * fma(-0.07356456359966781, sin(Float64(-2.0 * Float64(Float64(0.01171875 * k) * pi))), fma(sin(Float64(2.015625 * pi)), sin(Float64(Float64(Float64(0.0078125 * k) * pi) * 2.0)), Float64(sin(Float64(-2.0078125 * pi)) * sin(Float64(-2.0 * Float64(Float64(0.00390625 * k) * pi)))))))
end
code[k_] := N[(0.00390625 * N[(-0.07356456359966781 * N[Sin[N[(-2.0 * N[(N[(0.01171875 * k), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(2.015625 * Pi), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(N[(0.0078125 * k), $MachinePrecision] * Pi), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-2.0078125 * Pi), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(-2.0 * N[(N[(0.00390625 * k), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right)
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Evaluated real constant99.4%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \color{blue}{6.356816384998098}\right)\right) \]
  3. Applied rewrites99.5%

    \[\leadsto \color{blue}{0.00390625 \cdot \mathsf{fma}\left(\sin -6.356816384998098, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right)} \]
  4. Evaluated real constant99.5%

    \[\leadsto 0.00390625 \cdot \mathsf{fma}\left(\color{blue}{-0.07356456359966781}, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right) \]
  5. Add Preprocessing

Alternative 2: 99.4% accurate, 1.6× speedup?

\[0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-0.0234375 \cdot \left(k \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(-2.0078125 \cdot \pi\right), \sin \left(-0.0078125 \cdot \left(k \cdot \pi\right)\right), \sin \left(0.015625 \cdot \left(k \cdot \pi\right)\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right) \]
(FPCore (k)
  :precision binary64
  (*
 0.00390625
 (fma
  -0.07356456359966781
  (sin (* -0.0234375 (* k PI)))
  (fma
   (sin (* -2.0078125 PI))
   (sin (* -0.0078125 (* k PI)))
   (* (sin (* 0.015625 (* k PI))) (sin (* 2.015625 PI)))))))
double code(double k) {
	return 0.00390625 * fma(-0.07356456359966781, sin((-0.0234375 * (k * ((double) M_PI)))), fma(sin((-2.0078125 * ((double) M_PI))), sin((-0.0078125 * (k * ((double) M_PI)))), (sin((0.015625 * (k * ((double) M_PI)))) * sin((2.015625 * ((double) M_PI))))));
}
function code(k)
	return Float64(0.00390625 * fma(-0.07356456359966781, sin(Float64(-0.0234375 * Float64(k * pi))), fma(sin(Float64(-2.0078125 * pi)), sin(Float64(-0.0078125 * Float64(k * pi))), Float64(sin(Float64(0.015625 * Float64(k * pi))) * sin(Float64(2.015625 * pi))))))
end
code[k_] := N[(0.00390625 * N[(-0.07356456359966781 * N[Sin[N[(-0.0234375 * N[(k * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-2.0078125 * Pi), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(-0.0078125 * N[(k * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(0.015625 * N[(k * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(2.015625 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-0.0234375 \cdot \left(k \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(-2.0078125 \cdot \pi\right), \sin \left(-0.0078125 \cdot \left(k \cdot \pi\right)\right), \sin \left(0.015625 \cdot \left(k \cdot \pi\right)\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right)
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Evaluated real constant99.4%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \color{blue}{6.356816384998098}\right)\right) \]
  3. Applied rewrites99.5%

    \[\leadsto \color{blue}{0.00390625 \cdot \mathsf{fma}\left(\sin -6.356816384998098, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right)} \]
  4. Evaluated real constant99.5%

    \[\leadsto 0.00390625 \cdot \mathsf{fma}\left(\color{blue}{-0.07356456359966781}, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right) \]
  5. Taylor expanded in k around inf

    \[\leadsto 0.00390625 \cdot \color{blue}{\left(\frac{-2650442729721097}{36028797018963968} \cdot \sin \left(\frac{-3}{128} \cdot \left(k \cdot \pi\right)\right) + \left(\sin \left(\frac{-257}{128} \cdot \pi\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \pi\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \pi\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \pi\right)\right)\right)} \]
  6. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \color{blue}{\sin \left(\frac{-3}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right)}, \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    2. lower-sin.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(\frac{-3}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right), \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(\frac{-3}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right), \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    4. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(\frac{-3}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right), \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    5. lower-PI.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(\frac{-3}{128} \cdot \left(k \cdot \pi\right)\right), \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right) \cdot \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) + \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    6. lower-fma.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(\frac{-3}{128} \cdot \left(k \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right), \sin \left(\frac{-1}{128} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right), \sin \left(\frac{1}{64} \cdot \left(k \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
  7. Applied rewrites99.4%

    \[\leadsto 0.00390625 \cdot \color{blue}{\mathsf{fma}\left(-0.07356456359966781, \sin \left(-0.0234375 \cdot \left(k \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(-2.0078125 \cdot \pi\right), \sin \left(-0.0078125 \cdot \left(k \cdot \pi\right)\right), \sin \left(0.015625 \cdot \left(k \cdot \pi\right)\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right)} \]
  8. Add Preprocessing

Alternative 3: 98.3% accurate, 2.3× speedup?

\[0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(-0.0078125, \pi \cdot \sin \left(-2.0078125 \cdot \pi\right), 0.015625 \cdot \left(\pi \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right)\right) \]
(FPCore (k)
  :precision binary64
  (*
 0.00390625
 (fma
  -0.07356456359966781
  (sin (* -2.0 (* (* 0.01171875 k) PI)))
  (*
   k
   (fma
    -0.0078125
    (* PI (sin (* -2.0078125 PI)))
    (* 0.015625 (* PI (sin (* 2.015625 PI)))))))))
double code(double k) {
	return 0.00390625 * fma(-0.07356456359966781, sin((-2.0 * ((0.01171875 * k) * ((double) M_PI)))), (k * fma(-0.0078125, (((double) M_PI) * sin((-2.0078125 * ((double) M_PI)))), (0.015625 * (((double) M_PI) * sin((2.015625 * ((double) M_PI))))))));
}
function code(k)
	return Float64(0.00390625 * fma(-0.07356456359966781, sin(Float64(-2.0 * Float64(Float64(0.01171875 * k) * pi))), Float64(k * fma(-0.0078125, Float64(pi * sin(Float64(-2.0078125 * pi))), Float64(0.015625 * Float64(pi * sin(Float64(2.015625 * pi))))))))
end
code[k_] := N[(0.00390625 * N[(-0.07356456359966781 * N[Sin[N[(-2.0 * N[(N[(0.01171875 * k), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(k * N[(-0.0078125 * N[(Pi * N[Sin[N[(-2.0078125 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(0.015625 * N[(Pi * N[Sin[N[(2.015625 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(-0.0078125, \pi \cdot \sin \left(-2.0078125 \cdot \pi\right), 0.015625 \cdot \left(\pi \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right)\right)
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Evaluated real constant99.4%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \color{blue}{6.356816384998098}\right)\right) \]
  3. Applied rewrites99.5%

    \[\leadsto \color{blue}{0.00390625 \cdot \mathsf{fma}\left(\sin -6.356816384998098, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right)} \]
  4. Evaluated real constant99.5%

    \[\leadsto 0.00390625 \cdot \mathsf{fma}\left(\color{blue}{-0.07356456359966781}, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \mathsf{fma}\left(\sin \left(2.015625 \cdot \pi\right), \sin \left(\left(\left(0.0078125 \cdot k\right) \cdot \pi\right) \cdot 2\right), \sin \left(-2.0078125 \cdot \pi\right) \cdot \sin \left(-2 \cdot \left(\left(0.00390625 \cdot k\right) \cdot \pi\right)\right)\right)\right) \]
  5. Taylor expanded in k around 0

    \[\leadsto 0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \color{blue}{k \cdot \left(\frac{-1}{128} \cdot \left(\pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right)\right) + \frac{1}{64} \cdot \left(\pi \cdot \sin \left(\frac{129}{64} \cdot \pi\right)\right)\right)}\right) \]
  6. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \color{blue}{\left(\frac{-1}{128} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}\right) \]
    2. lower-fma.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \color{blue}{\mathsf{PI}\left(\right) \cdot \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \mathsf{PI}\left(\right) \cdot \color{blue}{\sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    4. lower-PI.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \color{blue}{\left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right)}, \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    5. lower-sin.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right), \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    6. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \mathsf{PI}\left(\right)\right), \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    7. lower-PI.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    8. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    9. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    10. lower-PI.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\pi \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    11. lower-sin.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\pi \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
    12. lower-*.f64N/A

      \[\leadsto \frac{1}{256} \cdot \mathsf{fma}\left(\frac{-2650442729721097}{36028797018963968}, \sin \left(-2 \cdot \left(\left(\frac{3}{256} \cdot k\right) \cdot \pi\right)\right), k \cdot \mathsf{fma}\left(\frac{-1}{128}, \pi \cdot \sin \left(\frac{-257}{128} \cdot \pi\right), \frac{1}{64} \cdot \left(\pi \cdot \sin \left(\frac{129}{64} \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right) \]
  7. Applied rewrites98.3%

    \[\leadsto 0.00390625 \cdot \mathsf{fma}\left(-0.07356456359966781, \sin \left(-2 \cdot \left(\left(0.01171875 \cdot k\right) \cdot \pi\right)\right), \color{blue}{k \cdot \mathsf{fma}\left(-0.0078125, \pi \cdot \sin \left(-2.0078125 \cdot \pi\right), 0.015625 \cdot \left(\pi \cdot \sin \left(2.015625 \cdot \pi\right)\right)\right)}\right) \]
  8. Add Preprocessing

Alternative 4: 98.1% accurate, 2.4× speedup?

\[\mathsf{fma}\left(3.0517578125 \cdot 10^{-5} \cdot \pi, \sin \left(2.0078125 \cdot \pi\right), \left(6.103515625 \cdot 10^{-5} \cdot \pi\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right) \cdot k + \left(\left(\sin 6.356816384998098 \cdot \pi\right) \cdot k\right) \cdot 9.1552734375 \cdot 10^{-5} \]
(FPCore (k)
  :precision binary64
  (+
 (*
  (fma
   (* 3.0517578125e-5 PI)
   (sin (* 2.0078125 PI))
   (* (* 6.103515625e-5 PI) (sin (* 2.015625 PI))))
  k)
 (* (* (* (sin 6.356816384998098) PI) k) 9.1552734375e-5)))
double code(double k) {
	return (fma((3.0517578125e-5 * ((double) M_PI)), sin((2.0078125 * ((double) M_PI))), ((6.103515625e-5 * ((double) M_PI)) * sin((2.015625 * ((double) M_PI))))) * k) + (((sin(6.356816384998098) * ((double) M_PI)) * k) * 9.1552734375e-5);
}
function code(k)
	return Float64(Float64(fma(Float64(3.0517578125e-5 * pi), sin(Float64(2.0078125 * pi)), Float64(Float64(6.103515625e-5 * pi) * sin(Float64(2.015625 * pi)))) * k) + Float64(Float64(Float64(sin(6.356816384998098) * pi) * k) * 9.1552734375e-5))
end
code[k_] := N[(N[(N[(N[(3.0517578125e-5 * Pi), $MachinePrecision] * N[Sin[N[(2.0078125 * Pi), $MachinePrecision]], $MachinePrecision] + N[(N[(6.103515625e-5 * Pi), $MachinePrecision] * N[Sin[N[(2.015625 * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] + N[(N[(N[(N[Sin[6.356816384998098], $MachinePrecision] * Pi), $MachinePrecision] * k), $MachinePrecision] * 9.1552734375e-5), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(3.0517578125 \cdot 10^{-5} \cdot \pi, \sin \left(2.0078125 \cdot \pi\right), \left(6.103515625 \cdot 10^{-5} \cdot \pi\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right) \cdot k + \left(\left(\sin 6.356816384998098 \cdot \pi\right) \cdot k\right) \cdot 9.1552734375 \cdot 10^{-5}
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Evaluated real constant99.4%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \color{blue}{6.356816384998098}\right)\right) \]
  3. Taylor expanded in k around 0

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \color{blue}{\frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \frac{223660592990157}{35184372088832}\right)\right)} \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \color{blue}{\left(k \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \frac{223660592990157}{35184372088832}\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \sin \frac{223660592990157}{35184372088832}\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\sin \frac{223660592990157}{35184372088832}}\right)\right) \]
    4. lower-PI.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \color{blue}{\frac{223660592990157}{35184372088832}}\right)\right) \]
    5. lower-sin.f6498.1%

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  5. Applied rewrites98.1%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \color{blue}{9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right)} \]
  6. Taylor expanded in k around 0

    \[\leadsto \color{blue}{k \cdot \left(\frac{1}{32768} \cdot \left(\pi \cdot \sin \left(\frac{1}{128} \cdot \pi + 2 \cdot \pi\right)\right) + \frac{1}{16384} \cdot \left(\pi \cdot \sin \left(\frac{1}{64} \cdot \pi + 2 \cdot \pi\right)\right)\right)} + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  7. Step-by-step derivation
    1. metadata-evalN/A

      \[\leadsto k \cdot \left(\frac{1}{32768} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{2}{256} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{16384} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{1}{64} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \frac{223660592990157}{35184372088832}\right)\right) \]
  8. Applied rewrites98.1%

    \[\leadsto \color{blue}{k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), 6.103515625 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right)\right)\right)} + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  9. Applied rewrites98.1%

    \[\leadsto \color{blue}{\mathsf{fma}\left(3.0517578125 \cdot 10^{-5} \cdot \pi, \sin \left(2.0078125 \cdot \pi\right), \left(6.103515625 \cdot 10^{-5} \cdot \pi\right) \cdot \sin \left(2.015625 \cdot \pi\right)\right) \cdot k + \left(\left(\sin 6.356816384998098 \cdot \pi\right) \cdot k\right) \cdot 9.1552734375 \cdot 10^{-5}} \]
  10. Add Preprocessing

Alternative 5: 98.1% accurate, 3.0× speedup?

\[k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), 6.103515625 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right)\right)\right) + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot 0.23110989256925552\right) \]
(FPCore (k)
  :precision binary64
  (+
 (*
  k
  (fma
   3.0517578125e-5
   (* PI (sin (fma 0.0078125 PI (* 2.0 PI))))
   (* 6.103515625e-5 (* PI (sin (fma 0.015625 PI (* 2.0 PI)))))))
 (* 9.1552734375e-5 (* k 0.23110989256925552))))
double code(double k) {
	return (k * fma(3.0517578125e-5, (((double) M_PI) * sin(fma(0.0078125, ((double) M_PI), (2.0 * ((double) M_PI))))), (6.103515625e-5 * (((double) M_PI) * sin(fma(0.015625, ((double) M_PI), (2.0 * ((double) M_PI)))))))) + (9.1552734375e-5 * (k * 0.23110989256925552));
}
function code(k)
	return Float64(Float64(k * fma(3.0517578125e-5, Float64(pi * sin(fma(0.0078125, pi, Float64(2.0 * pi)))), Float64(6.103515625e-5 * Float64(pi * sin(fma(0.015625, pi, Float64(2.0 * pi))))))) + Float64(9.1552734375e-5 * Float64(k * 0.23110989256925552)))
end
code[k_] := N[(N[(k * N[(3.0517578125e-5 * N[(Pi * N[Sin[N[(0.0078125 * Pi + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(6.103515625e-5 * N[(Pi * N[Sin[N[(0.015625 * Pi + N[(2.0 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(9.1552734375e-5 * N[(k * 0.23110989256925552), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), 6.103515625 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right)\right)\right) + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot 0.23110989256925552\right)
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Evaluated real constant99.4%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \color{blue}{6.356816384998098}\right)\right) \]
  3. Taylor expanded in k around 0

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \color{blue}{\frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \frac{223660592990157}{35184372088832}\right)\right)} \]
  4. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \color{blue}{\left(k \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \frac{223660592990157}{35184372088832}\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \sin \frac{223660592990157}{35184372088832}\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\mathsf{PI}\left(\right) \cdot \color{blue}{\sin \frac{223660592990157}{35184372088832}}\right)\right) \]
    4. lower-PI.f64N/A

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \color{blue}{\frac{223660592990157}{35184372088832}}\right)\right) \]
    5. lower-sin.f6498.1%

      \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  5. Applied rewrites98.1%

    \[\leadsto \left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \color{blue}{9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right)} \]
  6. Taylor expanded in k around 0

    \[\leadsto \color{blue}{k \cdot \left(\frac{1}{32768} \cdot \left(\pi \cdot \sin \left(\frac{1}{128} \cdot \pi + 2 \cdot \pi\right)\right) + \frac{1}{16384} \cdot \left(\pi \cdot \sin \left(\frac{1}{64} \cdot \pi + 2 \cdot \pi\right)\right)\right)} + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  7. Step-by-step derivation
    1. metadata-evalN/A

      \[\leadsto k \cdot \left(\frac{1}{32768} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{2}{256} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{1}{16384} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{1}{64} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right) + \frac{3}{32768} \cdot \left(k \cdot \left(\pi \cdot \sin \frac{223660592990157}{35184372088832}\right)\right) \]
  8. Applied rewrites98.1%

    \[\leadsto \color{blue}{k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), 6.103515625 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right)\right)\right)} + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot \left(\pi \cdot \sin 6.356816384998098\right)\right) \]
  9. Evaluated real constant98.1%

    \[\leadsto k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), 6.103515625 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right)\right)\right) + 9.1552734375 \cdot 10^{-5} \cdot \left(k \cdot 0.23110989256925552\right) \]
  10. Add Preprocessing

Alternative 6: 97.7% accurate, 81.2× speedup?

\[k \cdot 3.2920212137967474 \cdot 10^{-5} \]
(FPCore (k)
  :precision binary64
  (* k 3.2920212137967474e-5))
double code(double k) {
	return k * 3.2920212137967474e-5;
}
real(8) function code(k)
    real(8), intent (in) :: k
    code = k * 3.2920212137967474d-5
end function
public static double code(double k) {
	return k * 3.2920212137967474e-5;
}
def code(k):
	return k * 3.2920212137967474e-5
function code(k)
	return Float64(k * 3.2920212137967474e-5)
end
function tmp = code(k)
	tmp = k * 3.2920212137967474e-5;
end
code[k_] := N[(k * 3.2920212137967474e-5), $MachinePrecision]
k \cdot 3.2920212137967474 \cdot 10^{-5}
Derivation
  1. Initial program 91.2%

    \[\left(\frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \frac{k}{256}\right)\right) \cdot \left(-\sin \left(\frac{1}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(2 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{2}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right)\right) + \frac{1}{256} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(3 \cdot \frac{k}{256}\right)\right)\right) \cdot \left(-\sin \left(\frac{3}{256} \cdot \left(2 \cdot \pi\right) + 2 \cdot \pi\right)\right)\right) \]
  2. Taylor expanded in k around 0

    \[\leadsto \color{blue}{k \cdot \left(\frac{1}{32768} \cdot \left(\pi \cdot \sin \left(\frac{1}{128} \cdot \pi + 2 \cdot \pi\right)\right) + \left(\frac{1}{16384} \cdot \left(\pi \cdot \sin \left(\frac{1}{64} \cdot \pi + 2 \cdot \pi\right)\right) + \frac{3}{32768} \cdot \left(\pi \cdot \sin \left(\frac{3}{128} \cdot \pi + 2 \cdot \pi\right)\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto k \cdot \color{blue}{\left(\frac{1}{32768} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{1}{128} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right) + \left(\frac{1}{16384} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{1}{64} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right) + \frac{3}{32768} \cdot \left(\mathsf{PI}\left(\right) \cdot \sin \left(\frac{3}{128} \cdot \mathsf{PI}\left(\right) + 2 \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)} \]
  4. Applied rewrites90.0%

    \[\leadsto \color{blue}{k \cdot \mathsf{fma}\left(3.0517578125 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.0078125, \pi, 2 \cdot \pi\right)\right), \mathsf{fma}\left(6.103515625 \cdot 10^{-5}, \pi \cdot \sin \left(\mathsf{fma}\left(0.015625, \pi, 2 \cdot \pi\right)\right), 9.1552734375 \cdot 10^{-5} \cdot \left(\pi \cdot \sin \left(\mathsf{fma}\left(0.0234375, \pi, 2 \cdot \pi\right)\right)\right)\right)\right)} \]
  5. Evaluated real constant97.7%

    \[\leadsto k \cdot 3.2920212137967474 \cdot 10^{-5} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 1 
(FPCore (k)
  :name "1/256 sin(-2 PI k / 256) (-sin(1/256 (2 PI) + 2 PI)) + 1/256 sin(-2 PI 2 k / 256) (-sin(2/256 (2 PI) + 2 PI)) + 1/256 sin(-2 PI 3 k / 256) (-sin(3/256 (2 PI) + 2 PI))"
  :precision binary64
  :pre (and (<= 0.0 k) (<= k 256.0))
  (+ (+ (* (/ 1.0 256.0) (* (sin (* (- 2.0) (* PI (/ k 256.0)))) (- (sin (+ (* (/ 1.0 256.0) (* 2.0 PI)) (* 2.0 PI)))))) (* (/ 1.0 256.0) (* (sin (* (- 2.0) (* PI (* 2.0 (/ k 256.0))))) (- (sin (+ (* (/ 2.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))) (* (/ 1.0 256.0) (* (sin (* (- 2.0) (* PI (* 3.0 (/ k 256.0))))) (- (sin (+ (* (/ 3.0 256.0) (* 2.0 PI)) (* 2.0 PI))))))))