
(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 10 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 (* t_1 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 := t\_1 \cdot tau\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin t\_2}{t\_2}
\end{array}
\end{array}
Initial program 98.1%
Final simplification98.1%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* tau x) (PI))) (t_2 (* (PI) x))) (* (/ (sin t_1) t_1) (/ (sin t_2) t_2))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(tau \cdot x\right) \cdot \mathsf{PI}\left(\right)\\
t_2 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin t\_2}{t\_2}
\end{array}
\end{array}
Initial program 98.1%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.4
Applied rewrites97.4%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*l*N/A
lift-*.f32N/A
lift-*.f3298.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3298.0
Applied rewrites98.0%
Final simplification98.0%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* t_1 tau))) (/ (* (sin t_2) (sin t_1)) (* t_1 t_2))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
t_2 := t\_1 \cdot tau\\
\frac{\sin t\_2 \cdot \sin t\_1}{t\_1 \cdot t\_2}
\end{array}
\end{array}
Initial program 98.1%
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
Applied rewrites97.9%
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
Applied rewrites98.0%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
associate-*r*N/A
lift-/.f32N/A
div-invN/A
frac-2negN/A
Applied rewrites97.8%
Final simplification97.8%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (/ (* (sin (* t_1 tau)) (sin t_1)) (* (* (* (* tau (PI)) (PI)) x) x))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin \left(t\_1 \cdot tau\right) \cdot \sin t\_1}{\left(\left(\left(tau \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot x\right) \cdot x}
\end{array}
\end{array}
Initial program 98.1%
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
Applied rewrites97.9%
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
Applied rewrites98.0%
Applied rewrites97.0%
Final simplification97.0%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (* 1.0 (/ (/ (sin (* t_1 tau)) t_1) tau))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
1 \cdot \frac{\frac{\sin \left(t\_1 \cdot tau\right)}{t\_1}}{tau}
\end{array}
\end{array}
Initial program 98.1%
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
Applied rewrites97.9%
Taylor expanded in x around 0
Applied rewrites72.6%
Final simplification72.6%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* (PI) x) tau))) (* (* 1.0 (sin t_1)) (/ 1.0 t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\mathsf{PI}\left(\right) \cdot x\right) \cdot tau\\
\left(1 \cdot \sin t\_1\right) \cdot \frac{1}{t\_1}
\end{array}
\end{array}
Initial program 98.1%
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
lower-/.f32N/A
lower-/.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.9
Applied rewrites97.9%
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
Applied rewrites98.0%
Taylor expanded in x around 0
Applied rewrites72.6%
Final simplification72.6%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* tau x) (PI)))) (* 1.0 (/ (sin t_1) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(tau \cdot x\right) \cdot \mathsf{PI}\left(\right)\\
1 \cdot \frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Initial program 98.1%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.4
Applied rewrites97.4%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*l*N/A
lift-*.f32N/A
lift-*.f3298.0
lift-*.f32N/A
*-commutativeN/A
lower-*.f3298.0
Applied rewrites98.0%
Taylor expanded in x around 0
Applied rewrites72.6%
Final simplification72.6%
(FPCore (x tau) :precision binary32 (* (/ (sin (* (* tau x) (PI))) (* (* (PI) x) tau)) 1.0))
\begin{array}{l}
\\
\frac{\sin \left(\left(tau \cdot x\right) \cdot \mathsf{PI}\left(\right)\right)}{\left(\mathsf{PI}\left(\right) \cdot x\right) \cdot tau} \cdot 1
\end{array}
Initial program 98.1%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.4
Applied rewrites97.4%
Taylor expanded in x around 0
Applied rewrites72.3%
Final simplification72.3%
(FPCore (x tau) :precision binary32 (+ 1.0 (* (pow (* (PI) x) 2.0) -0.16666666666666666)))
\begin{array}{l}
\\
1 + {\left(\mathsf{PI}\left(\right) \cdot x\right)}^{2} \cdot -0.16666666666666666
\end{array}
Initial program 98.1%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f32N/A
Applied rewrites65.3%
Taylor expanded in tau around 0
Applied rewrites65.5%
Applied rewrites66.6%
Final simplification66.6%
(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.1%
Taylor expanded in x around 0
Applied rewrites65.5%
herbie shell --seed 2024259
(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)))))