
(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 (* (* tau x) (PI))) (t_2 (* x (PI)))) (* (/ (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 := x \cdot \mathsf{PI}\left(\right)\\
\frac{\sin t\_1}{t\_1} \cdot \frac{\sin t\_2}{t\_2}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*r*N/A
lower-*.f32N/A
lower-*.f3297.2
Applied rewrites97.2%
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
associate-*l*N/A
lift-*.f32N/A
lift-*.f3297.9
Applied rewrites97.9%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* tau t_1))) (* (/ (sin 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 := tau \cdot t\_1\\
\frac{\sin t\_1}{t\_2} \cdot \frac{\sin t\_2}{t\_1}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
*-lft-identityN/A
associate-*l/N/A
lower-*.f32N/A
Applied rewrites97.5%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (* (/ (sin (* t_1 tau)) (* (* (* t_1 x) (PI)) tau)) (sin (* x (PI))))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin \left(t\_1 \cdot tau\right)}{\left(\left(t\_1 \cdot x\right) \cdot \mathsf{PI}\left(\right)\right) \cdot tau} \cdot \sin \left(x \cdot \mathsf{PI}\left(\right)\right)
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
*-lft-identityN/A
associate-*l/N/A
lower-*.f32N/A
Applied rewrites97.5%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
frac-timesN/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
lift-*.f32N/A
*-commutativeN/A
lift-*.f32N/A
Applied rewrites97.8%
Taylor expanded in x around inf
lower-/.f32N/A
lower-sin.f32N/A
*-commutativeN/A
lower-*.f32N/A
*-commutativeN/A
lower-*.f32N/A
lower-PI.f32N/A
*-commutativeN/A
lower-*.f32N/A
Applied rewrites97.1%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* tau (PI)) x))) (/ (* (/ (sin t_1) t_1) (/ (* (PI) x) (PI))) x)))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(tau \cdot \mathsf{PI}\left(\right)\right) \cdot x\\
\frac{\frac{\sin t\_1}{t\_1} \cdot \frac{\mathsf{PI}\left(\right) \cdot x}{\mathsf{PI}\left(\right)}}{x}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
*-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l/N/A
lift-/.f32N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
lower-/.f32N/A
Applied rewrites96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.9
Applied rewrites69.9%
Applied rewrites70.2%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* tau (PI))) (t_2 (* (PI) x))) (/ (* (/ (sin (* t_1 x)) x) (/ t_2 t_2)) t_1)))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \mathsf{PI}\left(\right)\\
t_2 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\frac{\sin \left(t\_1 \cdot x\right)}{x} \cdot \frac{t\_2}{t\_2}}{t\_1}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
*-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l/N/A
lift-/.f32N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
lower-/.f32N/A
Applied rewrites96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.9
Applied rewrites69.9%
lift-/.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
*-commutativeN/A
Applied rewrites70.2%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (* tau (PI)) x)) (t_2 (* (PI) x))) (/ (* (sin t_1) (/ t_2 t_2)) t_1)))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(tau \cdot \mathsf{PI}\left(\right)\right) \cdot x\\
t_2 := \mathsf{PI}\left(\right) \cdot x\\
\frac{\sin t\_1 \cdot \frac{t\_2}{t\_2}}{t\_1}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
*-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l/N/A
lift-/.f32N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
lower-/.f32N/A
Applied rewrites96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.9
Applied rewrites69.9%
lift-/.f32N/A
lift-*.f32N/A
lift-*.f32N/A
times-fracN/A
*-commutativeN/A
Applied rewrites70.2%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x)) (t_2 (* (* tau (PI)) x))) (* (/ (/ t_1 t_1) t_2) (sin t_2))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
t_2 := \left(tau \cdot \mathsf{PI}\left(\right)\right) \cdot x\\
\frac{\frac{t\_1}{t\_1}}{t\_2} \cdot \sin t\_2
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
*-commutativeN/A
lift-/.f32N/A
lift-*.f32N/A
associate-/l/N/A
lift-/.f32N/A
clear-numN/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
lower-/.f32N/A
Applied rewrites96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3269.9
Applied rewrites69.9%
lift-/.f32N/A
lift-*.f32N/A
associate-/r*N/A
lift-/.f32N/A
Applied rewrites70.2%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* (PI) x))) (* (/ 1.0 tau) (/ (sin (* tau t_1)) t_1))))
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{PI}\left(\right) \cdot x\\
\frac{1}{tau} \cdot \frac{\sin \left(tau \cdot t\_1\right)}{t\_1}
\end{array}
\end{array}
Initial program 97.9%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
*-lft-identityN/A
associate-*l/N/A
lower-*.f32N/A
Applied rewrites97.5%
Taylor expanded in x around 0
lower-/.f3270.2
Applied rewrites70.2%
(FPCore (x tau) :precision binary32 (/ (sin (* x (PI))) (* (PI) x)))
\begin{array}{l}
\\
\frac{\sin \left(x \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right) \cdot x}
\end{array}
Initial program 97.9%
lift-*.f32N/A
lift-/.f32N/A
lift-/.f32N/A
frac-timesN/A
*-commutativeN/A
times-fracN/A
*-lft-identityN/A
associate-*l/N/A
lower-*.f32N/A
Applied rewrites97.5%
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f32N/A
lower-PI.f3263.9
Applied rewrites63.9%
(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 97.9%
Taylor expanded in x around 0
Applied rewrites63.2%
herbie shell --seed 2024326
(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)))))