
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (PI))) (t_2 (* t_1 tau))) (* (/ (sin t_2) t_2) (/ (sin t_1) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{PI}\left(\right)\\
t_2 := t\_1 \cdot tau\\
\frac{\sin t\_2}{t\_2} \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (PI))) (t_2 (* t_1 tau))) (* (/ (sin t_2) t_2) (/ (sin t_1) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{PI}\left(\right)\\
t_2 := t\_1 \cdot tau\\
\frac{\sin t\_2}{t\_2} \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* (PI) (* x tau)))) (* (/ (sin t_1) t_1) (/ (sin t_2) t_2))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
t_2 := \mathsf{PI}\left(\right) \cdot \left(x \cdot tau\right)\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin t\_2}{t\_2}
\end{array}
\end{array}
Initial program 98.2%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.8
Applied rewrites97.8%
Taylor expanded in tau around inf
associate-*r*N/A
associate-/r*N/A
associate-/l/N/A
lower-/.f32N/A
lower-sin.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f3298.3
Applied rewrites98.3%
Final simplification98.3%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (* (/ (sin t_1) (* x tau)) (/ (sin (* t_1 tau)) (* t_1 (PI))))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin t\_1}{x \cdot tau} \cdot \frac{\sin \left(t\_1 \cdot tau\right)}{t\_1 \cdot \mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 98.2%
Taylor expanded in tau around inf
*-commutativeN/A
times-fracN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
associate-/r*N/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f32N/A
Applied rewrites97.4%
Final simplification97.4%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* t_1 tau))) (/ (* (/ t_1 t_2) (sin t_2)) t_1)))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
t_2 := t\_1 \cdot tau\\
\frac{\frac{t\_1}{t\_2} \cdot \sin t\_2}{t\_1}
\end{array}
\end{array}
Initial program 98.2%
lift-*.f32N/A
lift-/.f32N/A
associate-*r/N/A
lower-/.f32N/A
Applied rewrites98.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3270.6
Applied rewrites70.6%
Final simplification70.6%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* (PI) x) tau))) (* 1.0 (/ (sin t_1) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\mathsf{PI}\left(\right) \cdot x\right) \cdot tau\\
1 \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Initial program 98.2%
Taylor expanded in x around 0
Applied rewrites70.6%
Final simplification70.6%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) (* x tau)))) (* 1.0 (/ (sin t_1) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot \left(x \cdot tau\right)\\
1 \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Initial program 98.2%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.8
Applied rewrites97.8%
Taylor expanded in tau around inf
associate-*r*N/A
associate-/r*N/A
associate-/l/N/A
lower-/.f32N/A
lower-sin.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-*.f3298.3
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites70.6%
Final simplification70.6%
(FPCore (x tau) :precision binary32 (+ (* (pow (* (PI) x) 2.0) -0.16666666666666666) 1.0))
\begin{array}{l}
\\
{\left(\mathsf{PI}\left(\right) \cdot x\right)}^{2} \cdot -0.16666666666666666 + 1
\end{array}
Initial program 98.2%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites63.2%
Taylor expanded in tau around 0
Applied rewrites63.2%
Applied rewrites64.4%
(FPCore (x tau) :precision binary32 1.0)
float code(float x, float tau) {
return 1.0f;
}
real(4) function code(x, tau)
real(4), intent (in) :: x
real(4), intent (in) :: tau
code = 1.0e0
end function
function code(x, tau) return Float32(1.0) end
function tmp = code(x, tau) tmp = single(1.0); end
\begin{array}{l}
\\
1
\end{array}
Initial program 98.2%
Taylor expanded in x around 0
Applied rewrites63.2%
herbie shell --seed 2024242
(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)))))