Lanczos kernel

Percentage Accurate: 97.9% → 97.9%
Time: 12.4s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\left(10^{-5} \leq x \land x \leq 1\right) \land \left(1 \leq tau \land tau \leq 5\right)\]
\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \pi\right) \cdot tau\\ \frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* (* x PI) tau)))
   (* (/ (sin t_1) t_1) (/ (sin (* x PI)) (* x PI)))))
float code(float x, float tau) {
	float t_1 = (x * ((float) M_PI)) * tau;
	return (sinf(t_1) / t_1) * (sinf((x * ((float) M_PI))) / (x * ((float) M_PI)));
}
function code(x, tau)
	t_1 = Float32(Float32(x * Float32(pi)) * tau)
	return Float32(Float32(sin(t_1) / t_1) * Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))))
end
function tmp = code(x, tau)
	t_1 = (x * single(pi)) * tau;
	tmp = (sin(t_1) / t_1) * (sin((x * single(pi))) / (x * single(pi)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \pi\right) \cdot tau\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}
\end{array}
\end{array}

Sampling outcomes in binary32 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 7 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: 97.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \pi\right) \cdot tau\\ \frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* (* x PI) tau)))
   (* (/ (sin t_1) t_1) (/ (sin (* x PI)) (* x PI)))))
float code(float x, float tau) {
	float t_1 = (x * ((float) M_PI)) * tau;
	return (sinf(t_1) / t_1) * (sinf((x * ((float) M_PI))) / (x * ((float) M_PI)));
}
function code(x, tau)
	t_1 = Float32(Float32(x * Float32(pi)) * tau)
	return Float32(Float32(sin(t_1) / t_1) * Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))))
end
function tmp = code(x, tau)
	t_1 = (x * single(pi)) * tau;
	tmp = (sin(t_1) / t_1) * (sin((x * single(pi))) / (x * single(pi)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \pi\right) \cdot tau\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}
\end{array}
\end{array}

Alternative 1: 97.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \pi\right) \cdot tau\\ \frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* (* x PI) tau)))
   (* (/ (sin t_1) t_1) (/ (sin (* x PI)) (* x PI)))))
float code(float x, float tau) {
	float t_1 = (x * ((float) M_PI)) * tau;
	return (sinf(t_1) / t_1) * (sinf((x * ((float) M_PI))) / (x * ((float) M_PI)));
}
function code(x, tau)
	t_1 = Float32(Float32(x * Float32(pi)) * tau)
	return Float32(Float32(sin(t_1) / t_1) * Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))))
end
function tmp = code(x, tau)
	t_1 = (x * single(pi)) * tau;
	tmp = (sin(t_1) / t_1) * (sin((x * single(pi))) / (x * single(pi)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \pi\right) \cdot tau\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}
\end{array}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Add Preprocessing
  3. Final simplification97.9%

    \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  4. Add Preprocessing

Alternative 2: 97.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\pi \cdot tau\right)\\ \sin t\_1 \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot t\_1\right)} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* x (* PI tau))))
   (* (sin t_1) (/ (sin (* x PI)) (* PI (* x t_1))))))
float code(float x, float tau) {
	float t_1 = x * (((float) M_PI) * tau);
	return sinf(t_1) * (sinf((x * ((float) M_PI))) / (((float) M_PI) * (x * t_1)));
}
function code(x, tau)
	t_1 = Float32(x * Float32(Float32(pi) * tau))
	return Float32(sin(t_1) * Float32(sin(Float32(x * Float32(pi))) / Float32(Float32(pi) * Float32(x * t_1))))
end
function tmp = code(x, tau)
	t_1 = x * (single(pi) * tau);
	tmp = sin(t_1) * (sin((x * single(pi))) / (single(pi) * (x * t_1)));
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\sin t\_1 \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot t\_1\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Step-by-step derivation
    1. associate-*l/97.7%

      \[\leadsto \color{blue}{\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    2. associate-/l*97.6%

      \[\leadsto \color{blue}{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    3. associate-*l*97.0%

      \[\leadsto \sin \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)} \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau} \]
    4. associate-/l/97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{\left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \left(x \cdot \pi\right)}} \]
    5. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(x \cdot \pi\right) \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)}} \]
    6. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(\pi \cdot x\right)} \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)} \]
    7. associate-*l*97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\pi \cdot \left(x \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)\right)}} \]
    8. associate-*l*97.2%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)}\right)} \]
  3. Simplified97.2%

    \[\leadsto \color{blue}{\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \left(x \cdot \left(\pi \cdot tau\right)\right)\right)}} \]
  4. Add Preprocessing
  5. Final simplification97.2%

    \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \left(x \cdot \left(\pi \cdot tau\right)\right)\right)} \]
  6. Add Preprocessing

Alternative 3: 97.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\pi \cdot tau\right)\\ \sin t\_1 \cdot \frac{\sin \left(x \cdot \pi\right)}{\left(x \cdot \pi\right) \cdot t\_1} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* x (* PI tau))))
   (* (sin t_1) (/ (sin (* x PI)) (* (* x PI) t_1)))))
float code(float x, float tau) {
	float t_1 = x * (((float) M_PI) * tau);
	return sinf(t_1) * (sinf((x * ((float) M_PI))) / ((x * ((float) M_PI)) * t_1));
}
function code(x, tau)
	t_1 = Float32(x * Float32(Float32(pi) * tau))
	return Float32(sin(t_1) * Float32(sin(Float32(x * Float32(pi))) / Float32(Float32(x * Float32(pi)) * t_1)))
end
function tmp = code(x, tau)
	t_1 = x * (single(pi) * tau);
	tmp = sin(t_1) * (sin((x * single(pi))) / ((x * single(pi)) * t_1));
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\sin t\_1 \cdot \frac{\sin \left(x \cdot \pi\right)}{\left(x \cdot \pi\right) \cdot t\_1}
\end{array}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Step-by-step derivation
    1. associate-*l/97.7%

      \[\leadsto \color{blue}{\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    2. associate-/l*97.6%

      \[\leadsto \color{blue}{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    3. associate-*l*97.0%

      \[\leadsto \sin \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)} \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau} \]
    4. associate-/l/97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{\left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \left(x \cdot \pi\right)}} \]
    5. associate-*l*97.5%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)} \cdot \left(x \cdot \pi\right)} \]
  3. Simplified97.5%

    \[\leadsto \color{blue}{\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \left(x \cdot \pi\right)}} \]
  4. Add Preprocessing
  5. Final simplification97.5%

    \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\left(x \cdot \pi\right) \cdot \left(x \cdot \left(\pi \cdot tau\right)\right)} \]
  6. Add Preprocessing

Alternative 4: 97.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \pi \cdot \left(x \cdot tau\right)\\ \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \cdot \frac{\sin t\_1}{t\_1} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* PI (* x tau))))
   (* (/ (sin (* x PI)) (* x PI)) (/ (sin t_1) t_1))))
float code(float x, float tau) {
	float t_1 = ((float) M_PI) * (x * tau);
	return (sinf((x * ((float) M_PI))) / (x * ((float) M_PI))) * (sinf(t_1) / t_1);
}
function code(x, tau)
	t_1 = Float32(Float32(pi) * Float32(x * tau))
	return Float32(Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))) * Float32(sin(t_1) / t_1))
end
function tmp = code(x, tau)
	t_1 = single(pi) * (x * tau);
	tmp = (sin((x * single(pi))) / (x * single(pi))) * (sin(t_1) / t_1);
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \pi \cdot \left(x \cdot tau\right)\\
\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Step-by-step derivation
    1. *-commutative97.9%

      \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\color{blue}{\left(\pi \cdot x\right)} \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
    2. associate-*l*97.3%

      \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\color{blue}{\pi \cdot \left(x \cdot tau\right)}} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
    3. *-commutative97.3%

      \[\leadsto \frac{\sin \left(\color{blue}{\left(\pi \cdot x\right)} \cdot tau\right)}{\pi \cdot \left(x \cdot tau\right)} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
    4. associate-*l*97.9%

      \[\leadsto \frac{\sin \color{blue}{\left(\pi \cdot \left(x \cdot tau\right)\right)}}{\pi \cdot \left(x \cdot tau\right)} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  3. Simplified97.9%

    \[\leadsto \color{blue}{\frac{\sin \left(\pi \cdot \left(x \cdot tau\right)\right)}{\pi \cdot \left(x \cdot tau\right)} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}} \]
  4. Add Preprocessing
  5. Final simplification97.9%

    \[\leadsto \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \cdot \frac{\sin \left(\pi \cdot \left(x \cdot tau\right)\right)}{\pi \cdot \left(x \cdot tau\right)} \]
  6. Add Preprocessing

Alternative 5: 70.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \pi\right) \cdot tau\\ \frac{\sin t\_1}{t\_1} \end{array} \end{array} \]
(FPCore (x tau)
 :precision binary32
 (let* ((t_1 (* (* x PI) tau))) (/ (sin t_1) t_1)))
float code(float x, float tau) {
	float t_1 = (x * ((float) M_PI)) * tau;
	return sinf(t_1) / t_1;
}
function code(x, tau)
	t_1 = Float32(Float32(x * Float32(pi)) * tau)
	return Float32(sin(t_1) / t_1)
end
function tmp = code(x, tau)
	t_1 = (x * single(pi)) * tau;
	tmp = sin(t_1) / t_1;
end
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \pi\right) \cdot tau\\
\frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. expm1-log1p-u97.8%

      \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot \pi\right)\right)\right)}}{x \cdot \pi} \]
    2. expm1-undefine81.3%

      \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot \pi\right)} - 1\right)}}{x \cdot \pi} \]
  4. Applied egg-rr81.3%

    \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot \pi\right)} - 1\right)}}{x \cdot \pi} \]
  5. Step-by-step derivation
    1. expm1-define97.8%

      \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot \pi\right)\right)\right)}}{x \cdot \pi} \]
  6. Simplified97.8%

    \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \color{blue}{\left(\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot \pi\right)\right)\right)}}{x \cdot \pi} \]
  7. Taylor expanded in x around 0 71.0%

    \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \color{blue}{1} \]
  8. Final simplification71.0%

    \[\leadsto \frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \]
  9. Add Preprocessing

Alternative 6: 64.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \end{array} \]
(FPCore (x tau) :precision binary32 (/ (sin (* x PI)) (* x PI)))
float code(float x, float tau) {
	return sinf((x * ((float) M_PI))) / (x * ((float) M_PI));
}
function code(x, tau)
	return Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi)))
end
function tmp = code(x, tau)
	tmp = sin((x * single(pi))) / (x * single(pi));
end
\begin{array}{l}

\\
\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Step-by-step derivation
    1. associate-*l/97.7%

      \[\leadsto \color{blue}{\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    2. associate-/l*97.6%

      \[\leadsto \color{blue}{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    3. associate-*l*97.0%

      \[\leadsto \sin \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)} \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau} \]
    4. associate-/l/97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{\left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \left(x \cdot \pi\right)}} \]
    5. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(x \cdot \pi\right) \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)}} \]
    6. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(\pi \cdot x\right)} \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)} \]
    7. associate-*l*97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\pi \cdot \left(x \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)\right)}} \]
    8. associate-*l*97.2%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)}\right)} \]
  3. Simplified97.2%

    \[\leadsto \color{blue}{\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \left(x \cdot \left(\pi \cdot tau\right)\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in tau around 0 64.2%

    \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}} \]
  6. Final simplification64.2%

    \[\leadsto \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  7. Add Preprocessing

Alternative 7: 63.4% accurate, 31.3× speedup?

\[\begin{array}{l} \\ \frac{x \cdot \pi}{x \cdot \pi} \end{array} \]
(FPCore (x tau) :precision binary32 (/ (* x PI) (* x PI)))
float code(float x, float tau) {
	return (x * ((float) M_PI)) / (x * ((float) M_PI));
}
function code(x, tau)
	return Float32(Float32(x * Float32(pi)) / Float32(x * Float32(pi)))
end
function tmp = code(x, tau)
	tmp = (x * single(pi)) / (x * single(pi));
end
\begin{array}{l}

\\
\frac{x \cdot \pi}{x \cdot \pi}
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right)}{\left(x \cdot \pi\right) \cdot tau} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \]
  2. Step-by-step derivation
    1. associate-*l/97.7%

      \[\leadsto \color{blue}{\frac{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    2. associate-/l*97.6%

      \[\leadsto \color{blue}{\sin \left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau}} \]
    3. associate-*l*97.0%

      \[\leadsto \sin \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)} \cdot \frac{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}}{\left(x \cdot \pi\right) \cdot tau} \]
    4. associate-/l/97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{\left(\left(x \cdot \pi\right) \cdot tau\right) \cdot \left(x \cdot \pi\right)}} \]
    5. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(x \cdot \pi\right) \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)}} \]
    6. *-commutative97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\left(\pi \cdot x\right)} \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)} \]
    7. associate-*l*97.0%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\color{blue}{\pi \cdot \left(x \cdot \left(\left(x \cdot \pi\right) \cdot tau\right)\right)}} \]
    8. associate-*l*97.2%

      \[\leadsto \sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \color{blue}{\left(x \cdot \left(\pi \cdot tau\right)\right)}\right)} \]
  3. Simplified97.2%

    \[\leadsto \color{blue}{\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{\pi \cdot \left(x \cdot \left(x \cdot \left(\pi \cdot tau\right)\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in tau around 0 64.2%

    \[\leadsto \color{blue}{\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}} \]
  6. Taylor expanded in x around 0 63.5%

    \[\leadsto \frac{\color{blue}{x \cdot \pi}}{x \cdot \pi} \]
  7. Final simplification63.5%

    \[\leadsto \frac{x \cdot \pi}{x \cdot \pi} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024053 
(FPCore (x tau)
  :name "Lanczos kernel"
  :precision binary32
  :pre (and (and (<= 1e-5 x) (<= x 1.0)) (and (<= 1.0 tau) (<= tau 5.0)))
  (* (/ (sin (* (* x PI) tau)) (* (* x PI) tau)) (/ (sin (* x PI)) (* x PI))))