1/4096 sin(-2 PI n k / 4096) t n/4096

Percentage Accurate: 99.8% → 99.8%
Time: 11.3s
Alternatives: 4
Speedup: N/A×

Specification

?
\[\left(\left(0 \leq n \land n \leq 4096\right) \land \left(0 \leq k \land k \leq 4096\right)\right) \land \left(6.28318530718 \leq t \land t \leq 12.5663706144\right)\]
\[\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\right)\right) \]
(FPCore (n k t)
  :precision binary64
  (*
 (/ 1.0 4096.0)
 (* (sin (* (- 2.0) (* PI (* n (/ k 4096.0))))) (* t (/ n 4096.0)))))
double code(double n, double k, double t) {
	return (1.0 / 4096.0) * (sin((-2.0 * (((double) M_PI) * (n * (k / 4096.0))))) * (t * (n / 4096.0)));
}
public static double code(double n, double k, double t) {
	return (1.0 / 4096.0) * (Math.sin((-2.0 * (Math.PI * (n * (k / 4096.0))))) * (t * (n / 4096.0)));
}
def code(n, k, t):
	return (1.0 / 4096.0) * (math.sin((-2.0 * (math.pi * (n * (k / 4096.0))))) * (t * (n / 4096.0)))
function code(n, k, t)
	return Float64(Float64(1.0 / 4096.0) * Float64(sin(Float64(Float64(-2.0) * Float64(pi * Float64(n * Float64(k / 4096.0))))) * Float64(t * Float64(n / 4096.0))))
end
function tmp = code(n, k, t)
	tmp = (1.0 / 4096.0) * (sin((-2.0 * (pi * (n * (k / 4096.0))))) * (t * (n / 4096.0)));
end
code[n_, k_, t_] := N[(N[(1.0 / 4096.0), $MachinePrecision] * N[(N[Sin[N[((-2.0) * N[(Pi * N[(n * N[(k / 4096.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t * N[(n / 4096.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\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 4 alternatives:

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

Initial Program: 99.8% accurate, 1.0× speedup?

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

Alternative 1: 99.8% accurate, 4.1× speedup?

\[\left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right) \]
(FPCore (n k t)
  :precision binary64
  (* (* (* (* PI t) k) -2.9103830456733704e-11) (* n n)))
double code(double n, double k, double t) {
	return (((((double) M_PI) * t) * k) * -2.9103830456733704e-11) * (n * n);
}
public static double code(double n, double k, double t) {
	return (((Math.PI * t) * k) * -2.9103830456733704e-11) * (n * n);
}
def code(n, k, t):
	return (((math.pi * t) * k) * -2.9103830456733704e-11) * (n * n)
function code(n, k, t)
	return Float64(Float64(Float64(Float64(pi * t) * k) * -2.9103830456733704e-11) * Float64(n * n))
end
function tmp = code(n, k, t)
	tmp = (((pi * t) * k) * -2.9103830456733704e-11) * (n * n);
end
code[n_, k_, t_] := N[(N[(N[(N[(Pi * t), $MachinePrecision] * k), $MachinePrecision] * -2.9103830456733704e-11), $MachinePrecision] * N[(n * n), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right)
Derivation
  1. Initial program 99.8%

    \[\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\right)\right) \]
  2. Taylor expanded in n around 0

    \[\leadsto \color{blue}{\frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(\color{blue}{t} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. lower-PI.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right) \]
  4. Applied rewrites99.8%

    \[\leadsto \color{blue}{-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \pi\right)\right)}\right) \]
    3. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \pi\right)}\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left(t \cdot \pi\right) \cdot \color{blue}{{n}^{2}}\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \color{blue}{{n}^{2}}\right) \]
    6. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot {\color{blue}{n}}^{2}\right) \]
    7. associate-*l*N/A

      \[\leadsto \left(\frac{-1}{34359738368} \cdot \left(k \cdot \left(t \cdot \pi\right)\right)\right) \cdot \color{blue}{{n}^{2}} \]
    8. lower-*.f64N/A

      \[\leadsto \left(\frac{-1}{34359738368} \cdot \left(k \cdot \left(t \cdot \pi\right)\right)\right) \cdot \color{blue}{{n}^{2}} \]
    9. *-commutativeN/A

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot {\color{blue}{n}}^{2} \]
    10. lower-*.f6499.8%

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {\color{blue}{n}}^{2} \]
    11. lift-*.f64N/A

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    12. *-commutativeN/A

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    13. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {n}^{2} \]
    14. lift-*.f64N/A

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    15. *-commutativeN/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    16. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {n}^{2} \]
    17. lift-pow.f64N/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{\color{blue}{2}} \]
    18. unpow2N/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot \color{blue}{n}\right) \]
    19. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot \color{blue}{n}\right) \]
  6. Applied rewrites99.8%

    \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \color{blue}{\left(n \cdot n\right)} \]
  7. Add Preprocessing

Alternative 2: 99.8% accurate, 4.1× speedup?

\[\left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right) \]
(FPCore (n k t)
  :precision binary64
  (* (* (* (* PI k) t) -2.9103830456733704e-11) (* n n)))
double code(double n, double k, double t) {
	return (((((double) M_PI) * k) * t) * -2.9103830456733704e-11) * (n * n);
}
public static double code(double n, double k, double t) {
	return (((Math.PI * k) * t) * -2.9103830456733704e-11) * (n * n);
}
def code(n, k, t):
	return (((math.pi * k) * t) * -2.9103830456733704e-11) * (n * n)
function code(n, k, t)
	return Float64(Float64(Float64(Float64(pi * k) * t) * -2.9103830456733704e-11) * Float64(n * n))
end
function tmp = code(n, k, t)
	tmp = (((pi * k) * t) * -2.9103830456733704e-11) * (n * n);
end
code[n_, k_, t_] := N[(N[(N[(N[(Pi * k), $MachinePrecision] * t), $MachinePrecision] * -2.9103830456733704e-11), $MachinePrecision] * N[(n * n), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right)
Derivation
  1. Initial program 99.8%

    \[\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\right)\right) \]
  2. Taylor expanded in n around 0

    \[\leadsto \color{blue}{\frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(\color{blue}{t} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. lower-PI.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right) \]
  4. Applied rewrites99.8%

    \[\leadsto \color{blue}{-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \pi\right)\right)}\right) \]
    3. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \pi\right)}\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left(t \cdot \pi\right) \cdot \color{blue}{{n}^{2}}\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \color{blue}{{n}^{2}}\right) \]
    6. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot {\color{blue}{n}}^{2}\right) \]
    7. associate-*l*N/A

      \[\leadsto \left(\frac{-1}{34359738368} \cdot \left(k \cdot \left(t \cdot \pi\right)\right)\right) \cdot \color{blue}{{n}^{2}} \]
    8. lower-*.f64N/A

      \[\leadsto \left(\frac{-1}{34359738368} \cdot \left(k \cdot \left(t \cdot \pi\right)\right)\right) \cdot \color{blue}{{n}^{2}} \]
    9. *-commutativeN/A

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot {\color{blue}{n}}^{2} \]
    10. lower-*.f6499.8%

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {\color{blue}{n}}^{2} \]
    11. lift-*.f64N/A

      \[\leadsto \left(\left(k \cdot \left(t \cdot \pi\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    12. *-commutativeN/A

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    13. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {n}^{2} \]
    14. lift-*.f64N/A

      \[\leadsto \left(\left(\left(t \cdot \pi\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    15. *-commutativeN/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{2} \]
    16. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot {n}^{2} \]
    17. lift-pow.f64N/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot {n}^{\color{blue}{2}} \]
    18. unpow2N/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot \color{blue}{n}\right) \]
    19. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot \color{blue}{n}\right) \]
  6. Applied rewrites99.8%

    \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \color{blue}{\left(n \cdot n\right)} \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\pi \cdot t\right) \cdot k\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    2. *-commutativeN/A

      \[\leadsto \left(\left(k \cdot \left(\pi \cdot t\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    3. lift-*.f64N/A

      \[\leadsto \left(\left(k \cdot \left(\pi \cdot t\right)\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    4. associate-*r*N/A

      \[\leadsto \left(\left(\left(k \cdot \pi\right) \cdot t\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    5. *-commutativeN/A

      \[\leadsto \left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    6. lift-*.f64N/A

      \[\leadsto \left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot \frac{-1}{34359738368}\right) \cdot \left(n \cdot n\right) \]
    7. lower-*.f6499.8%

      \[\leadsto \left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right) \]
  8. Applied rewrites99.8%

    \[\leadsto \left(\left(\left(\pi \cdot k\right) \cdot t\right) \cdot -2.9103830456733704 \cdot 10^{-11}\right) \cdot \left(n \cdot n\right) \]
  9. Add Preprocessing

Alternative 3: 99.8% accurate, 4.1× speedup?

\[-2.9103830456733704 \cdot 10^{-11} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \pi\right) \]
(FPCore (n k t)
  :precision binary64
  (* -2.9103830456733704e-11 (* (* (* (* k n) n) t) PI)))
double code(double n, double k, double t) {
	return -2.9103830456733704e-11 * ((((k * n) * n) * t) * ((double) M_PI));
}
public static double code(double n, double k, double t) {
	return -2.9103830456733704e-11 * ((((k * n) * n) * t) * Math.PI);
}
def code(n, k, t):
	return -2.9103830456733704e-11 * ((((k * n) * n) * t) * math.pi)
function code(n, k, t)
	return Float64(-2.9103830456733704e-11 * Float64(Float64(Float64(Float64(k * n) * n) * t) * pi))
end
function tmp = code(n, k, t)
	tmp = -2.9103830456733704e-11 * ((((k * n) * n) * t) * pi);
end
code[n_, k_, t_] := N[(-2.9103830456733704e-11 * N[(N[(N[(N[(k * n), $MachinePrecision] * n), $MachinePrecision] * t), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]
-2.9103830456733704 \cdot 10^{-11} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \pi\right)
Derivation
  1. Initial program 99.8%

    \[\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\right)\right) \]
  2. Taylor expanded in n around 0

    \[\leadsto \color{blue}{\frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(\color{blue}{t} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. lower-PI.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right) \]
  4. Applied rewrites99.8%

    \[\leadsto \color{blue}{-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \pi\right)\right)}\right) \]
    2. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \pi\right)}\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot {n}^{2}\right) \cdot \color{blue}{\left(t \cdot \pi\right)}\right) \]
    4. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(k \cdot {n}^{2}\right) \cdot \left(t \cdot \color{blue}{\pi}\right)\right) \]
    5. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(k \cdot {n}^{2}\right) \cdot t\right) \cdot \color{blue}{\pi}\right) \]
    6. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(k \cdot {n}^{2}\right) \cdot t\right) \cdot \color{blue}{\pi}\right) \]
    7. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(k \cdot {n}^{2}\right) \cdot t\right) \cdot \pi\right) \]
    8. lift-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(k \cdot {n}^{2}\right) \cdot t\right) \cdot \pi\right) \]
    9. unpow2N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(k \cdot \left(n \cdot n\right)\right) \cdot t\right) \cdot \pi\right) \]
    10. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \pi\right) \]
    11. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \pi\right) \]
    12. lower-*.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \pi\right) \]
  6. Applied rewrites99.8%

    \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(\left(\left(\left(k \cdot n\right) \cdot n\right) \cdot t\right) \cdot \color{blue}{\pi}\right) \]
  7. Add Preprocessing

Alternative 4: 99.8% accurate, 4.1× speedup?

\[-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left(\left(\left(n \cdot n\right) \cdot t\right) \cdot \pi\right)\right) \]
(FPCore (n k t)
  :precision binary64
  (* -2.9103830456733704e-11 (* k (* (* (* n n) t) PI))))
double code(double n, double k, double t) {
	return -2.9103830456733704e-11 * (k * (((n * n) * t) * ((double) M_PI)));
}
public static double code(double n, double k, double t) {
	return -2.9103830456733704e-11 * (k * (((n * n) * t) * Math.PI));
}
def code(n, k, t):
	return -2.9103830456733704e-11 * (k * (((n * n) * t) * math.pi))
function code(n, k, t)
	return Float64(-2.9103830456733704e-11 * Float64(k * Float64(Float64(Float64(n * n) * t) * pi)))
end
function tmp = code(n, k, t)
	tmp = -2.9103830456733704e-11 * (k * (((n * n) * t) * pi));
end
code[n_, k_, t_] := N[(-2.9103830456733704e-11 * N[(k * N[(N[(N[(n * n), $MachinePrecision] * t), $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left(\left(\left(n \cdot n\right) \cdot t\right) \cdot \pi\right)\right)
Derivation
  1. Initial program 99.8%

    \[\frac{1}{4096} \cdot \left(\sin \left(\left(-2\right) \cdot \left(\pi \cdot \left(n \cdot \frac{k}{4096}\right)\right)\right) \cdot \left(t \cdot \frac{n}{4096}\right)\right) \]
  2. Taylor expanded in n around 0

    \[\leadsto \color{blue}{\frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  3. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \color{blue}{\left(k \cdot \left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \color{blue}{\left({n}^{2} \cdot \left(t \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \]
    4. lower-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(\color{blue}{t} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)\right)\right) \]
    6. lower-PI.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right) \]
  4. Applied rewrites99.8%

    \[\leadsto \color{blue}{-2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \pi\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \color{blue}{\left(t \cdot \pi\right)}\right)\right) \]
    2. lift-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left({n}^{2} \cdot \left(t \cdot \color{blue}{\pi}\right)\right)\right) \]
    3. associate-*r*N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left({n}^{2} \cdot t\right) \cdot \color{blue}{\pi}\right)\right) \]
    4. lower-*.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left({n}^{2} \cdot t\right) \cdot \color{blue}{\pi}\right)\right) \]
    5. lower-*.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left(\left({n}^{2} \cdot t\right) \cdot \pi\right)\right) \]
    6. lift-pow.f64N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left({n}^{2} \cdot t\right) \cdot \pi\right)\right) \]
    7. unpow2N/A

      \[\leadsto \frac{-1}{34359738368} \cdot \left(k \cdot \left(\left(\left(n \cdot n\right) \cdot t\right) \cdot \pi\right)\right) \]
    8. lower-*.f6499.8%

      \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left(\left(\left(n \cdot n\right) \cdot t\right) \cdot \pi\right)\right) \]
  6. Applied rewrites99.8%

    \[\leadsto -2.9103830456733704 \cdot 10^{-11} \cdot \left(k \cdot \left(\left(\left(n \cdot n\right) \cdot t\right) \cdot \color{blue}{\pi}\right)\right) \]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 1 
(FPCore (n k t)
  :name "1/4096 sin(-2 PI n k / 4096) t n/4096"
  :precision binary64
  :pre (and (and (and (<= 0.0 n) (<= n 4096.0)) (and (<= 0.0 k) (<= k 4096.0))) (and (<= 6.28318530718 t) (<= t 12.5663706144)))
  (* (/ 1.0 4096.0) (* (sin (* (- 2.0) (* PI (* n (/ k 4096.0))))) (* t (/ n 4096.0)))))