
(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 (* 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.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_2 t_1))))
\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\_2 \cdot t\_1}
\end{array}
\end{array}
Initial program 98.0%
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3297.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.7
Applied rewrites97.7%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
lift-/.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
Applied rewrites97.8%
Final simplification97.8%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* t_1 tau))) (/ 1.0 (/ (* (* (/ t_2 (sin t_2)) x) (PI)) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
t_2 := t\_1 \cdot tau\\
\frac{1}{\frac{\left(\frac{t\_2}{\sin t\_2} \cdot x\right) \cdot \mathsf{PI}\left(\right)}{t\_1}}
\end{array}
\end{array}
Initial program 98.0%
lift-*.f32N/A
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f32N/A
Applied rewrites97.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.2
Applied rewrites69.2%
Applied rewrites69.0%
lift-/.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
associate-*r/N/A
lower-/.f32N/A
Applied rewrites69.4%
Final simplification69.4%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* t_1 tau))) (/ (* t_1 (sin t_2)) (* 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{t\_1 \cdot \sin t\_2}{t\_2 \cdot t\_1}
\end{array}
\end{array}
Initial program 98.0%
lift-/.f32N/A
clear-numN/A
associate-/r/N/A
lower-*.f32N/A
lower-/.f3297.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.7
lift-*.f32N/A
*-commutativeN/A
lower-*.f3297.7
Applied rewrites97.7%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
lift-/.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lower-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
Applied rewrites97.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.3
Applied rewrites69.3%
Final simplification69.3%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (/ 1.0 (/ t_1 (sin t_1)))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{1}{\frac{t\_1}{\sin t\_1}}
\end{array}
\end{array}
Initial program 98.0%
lift-*.f32N/A
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f32N/A
Applied rewrites97.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.2
Applied rewrites69.2%
Applied rewrites69.0%
Taylor expanded in tau around 0
lower-/.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3263.0
Applied rewrites63.0%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (/ (sin t_1) t_1)))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin t\_1}{t\_1}
\end{array}
\end{array}
Initial program 98.0%
lift-*.f32N/A
lift-/.f32N/A
associate-*l/N/A
lift-/.f32N/A
div-invN/A
associate-*r*N/A
lift-*.f32N/A
*-commutativeN/A
times-fracN/A
lower-*.f32N/A
Applied rewrites97.2%
Taylor expanded in x around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
unpow2N/A
lower-*.f32N/A
lower-PI.f32N/A
lower-PI.f3261.8
Applied rewrites61.8%
Applied rewrites61.8%
Taylor expanded in tau around 0
lower-/.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3263.0
Applied rewrites63.0%
(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.0%
Taylor expanded in x around 0
Applied rewrites62.2%
herbie shell --seed 2024332
(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)))))