
(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:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x tau)
:precision binary32
(cast
(!
:precision
binary64
(let* ((t_1 (* x (* PI tau))))
(* (/ (sin t_1) (* x PI)) (/ (sin (* x PI)) t_1))))))
float code(float x, float tau) {
double t_1_1 = ((double) x) * (((double) M_PI) * ((double) tau));
double tmp = (sin(t_1_1) / (((double) x) * ((double) M_PI))) * (sin((((double) x) * ((double) M_PI))) / t_1_1);
return (float) tmp;
}
function code(x, tau) t_1_1 = Float64(Float64(x) * Float64(pi * Float64(tau))) tmp = Float64(Float64(sin(t_1_1) / Float64(Float64(x) * pi)) * Float64(sin(Float64(Float64(x) * pi)) / t_1_1)) return Float32(tmp) end
function tmp_3 = code(x, tau) t_1_2 = double(x) * (pi * double(tau)); tmp = (sin(t_1_2) / (double(x) * pi)) * (sin((double(x) * pi)) / t_1_2); tmp_3 = single(tmp); end
\begin{array}{l}
\\
\langle \left( \begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin t_1}{x \cdot \pi} \cdot \frac{\sin \left(x \cdot \pi\right)}{t_1}
\end{array} \right)_{\text{binary64}} \rangle_{\text{binary32}}
\end{array}
Initial program 99.1%
Final simplification99.1%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (sin (* x PI)) (/ (/ (sin t_1) t_1) (* x PI)))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return sinf((x * ((float) M_PI))) * ((sinf(t_1) / t_1) / (x * ((float) M_PI)));
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * tau)) return Float32(sin(Float32(x * Float32(pi))) * Float32(Float32(sin(t_1) / t_1) / Float32(x * Float32(pi)))) end
function tmp = code(x, tau) t_1 = x * (single(pi) * tau); tmp = sin((x * single(pi))) * ((sin(t_1) / t_1) / (x * single(pi))); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\sin \left(x \cdot \pi\right) \cdot \frac{\frac{\sin t_1}{t_1}}{x \cdot \pi}
\end{array}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (/ (sin (* x PI)) (* x PI)) (/ (sin t_1) t_1))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return (sinf((x * ((float) M_PI))) / (x * ((float) M_PI))) * (sinf(t_1) / t_1);
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * 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 = x * (single(pi) * tau); tmp = (sin((x * single(pi))) / (x * single(pi))) * (sin(t_1) / t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \cdot \frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.9%
*-commutative97.9%
associate-*l*97.2%
associate-*l*97.9%
Simplified97.9%
Final simplification97.9%
(FPCore (x tau) :precision binary32 (* (sin (* x PI)) (/ (sin (* tau (* x PI))) (* tau (pow (* x PI) 2.0)))))
float code(float x, float tau) {
return sinf((x * ((float) M_PI))) * (sinf((tau * (x * ((float) M_PI)))) / (tau * powf((x * ((float) M_PI)), 2.0f)));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(pi))) * Float32(sin(Float32(tau * Float32(x * Float32(pi)))) / Float32(tau * (Float32(x * Float32(pi)) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = sin((x * single(pi))) * (sin((tau * (x * single(pi)))) / (tau * ((x * single(pi)) ^ single(2.0)))); end
\begin{array}{l}
\\
\sin \left(x \cdot \pi\right) \cdot \frac{\sin \left(tau \cdot \left(x \cdot \pi\right)\right)}{tau \cdot {\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in x around inf 96.5%
associate-/l*96.4%
associate-*r*96.6%
*-commutative96.6%
*-commutative96.6%
unpow296.6%
unpow296.6%
swap-sqr96.9%
unpow296.9%
associate-/r/96.9%
remove-double-neg96.9%
distribute-frac-neg96.9%
Simplified97.2%
Final simplification97.2%
(FPCore (x tau) :precision binary32 (/ (* (sin (* x PI)) (/ (sin (* tau (* x PI))) tau)) (pow (* x PI) 2.0)))
float code(float x, float tau) {
return (sinf((x * ((float) M_PI))) * (sinf((tau * (x * ((float) M_PI)))) / tau)) / powf((x * ((float) M_PI)), 2.0f);
}
function code(x, tau) return Float32(Float32(sin(Float32(x * Float32(pi))) * Float32(sin(Float32(tau * Float32(x * Float32(pi)))) / tau)) / (Float32(x * Float32(pi)) ^ Float32(2.0))) end
function tmp = code(x, tau) tmp = (sin((x * single(pi))) * (sin((tau * (x * single(pi)))) / tau)) / ((x * single(pi)) ^ single(2.0)); end
\begin{array}{l}
\\
\frac{\sin \left(x \cdot \pi\right) \cdot \frac{\sin \left(tau \cdot \left(x \cdot \pi\right)\right)}{tau}}{{\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
associate-/l/97.5%
associate-*r/97.6%
*-commutative97.6%
frac-times97.5%
associate-/r*97.2%
associate-*r/97.2%
Applied egg-rr96.9%
associate-*r/96.9%
associate-*l/96.8%
times-frac96.9%
associate-/r*96.9%
associate-/l/96.8%
unpow296.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*97.1%
Simplified97.1%
add-log-exp_binary3296.3%
Applied rewrite-once96.3%
Taylor expanded in tau around inf 96.5%
associate-/r*96.4%
associate-*r*96.5%
*-commutative96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l/96.7%
*-commutative96.7%
*-commutative96.7%
*-commutative96.7%
*-commutative96.7%
associate-*r*96.4%
*-commutative96.4%
Simplified97.2%
Final simplification97.2%
(FPCore (x tau) :precision binary32 (/ (/ (sin (* tau (* x PI))) (pow (* x PI) 2.0)) (/ tau (sin (* x PI)))))
float code(float x, float tau) {
return (sinf((tau * (x * ((float) M_PI)))) / powf((x * ((float) M_PI)), 2.0f)) / (tau / sinf((x * ((float) M_PI))));
}
function code(x, tau) return Float32(Float32(sin(Float32(tau * Float32(x * Float32(pi)))) / (Float32(x * Float32(pi)) ^ Float32(2.0))) / Float32(tau / sin(Float32(x * Float32(pi))))) end
function tmp = code(x, tau) tmp = (sin((tau * (x * single(pi)))) / ((x * single(pi)) ^ single(2.0))) / (tau / sin((x * single(pi)))); end
\begin{array}{l}
\\
\frac{\frac{\sin \left(tau \cdot \left(x \cdot \pi\right)\right)}{{\left(x \cdot \pi\right)}^{2}}}{\frac{tau}{\sin \left(x \cdot \pi\right)}}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
associate-/l/97.5%
associate-*r/97.6%
*-commutative97.6%
frac-times97.5%
associate-*r*97.0%
associate-/r*97.0%
associate-*r/97.2%
Applied egg-rr97.0%
associate-*r/96.9%
associate-*l/96.9%
associate-/l*97.1%
associate-/l/97.0%
unpow297.0%
*-commutative97.0%
*-commutative97.0%
associate-*r*97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (/ (sin t_1) t_1) (+ 1.0 (* (pow (* x PI) 2.0) -0.16666666666666666)))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return (sinf(t_1) / t_1) * (1.0f + (powf((x * ((float) M_PI)), 2.0f) * -0.16666666666666666f));
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * tau)) return Float32(Float32(sin(t_1) / t_1) * Float32(Float32(1.0) + Float32((Float32(x * Float32(pi)) ^ Float32(2.0)) * Float32(-0.16666666666666666)))) end
function tmp = code(x, tau) t_1 = x * (single(pi) * tau); tmp = (sin(t_1) / t_1) * (single(1.0) + (((x * single(pi)) ^ single(2.0)) * single(-0.16666666666666666))); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin t_1}{t_1} \cdot \left(1 + {\left(x \cdot \pi\right)}^{2} \cdot -0.16666666666666666\right)
\end{array}
\end{array}
Initial program 97.9%
*-commutative97.9%
associate-*l*97.2%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 85.8%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified85.8%
Final simplification85.8%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* PI (* x tau)))) (* (+ 1.0 (* (pow (* x PI) 2.0) -0.16666666666666666)) (/ (sin t_1) t_1))))
float code(float x, float tau) {
float t_1 = ((float) M_PI) * (x * tau);
return (1.0f + (powf((x * ((float) M_PI)), 2.0f) * -0.16666666666666666f)) * (sinf(t_1) / t_1);
}
function code(x, tau) t_1 = Float32(Float32(pi) * Float32(x * tau)) return Float32(Float32(Float32(1.0) + Float32((Float32(x * Float32(pi)) ^ Float32(2.0)) * Float32(-0.16666666666666666))) * Float32(sin(t_1) / t_1)) end
function tmp = code(x, tau) t_1 = single(pi) * (x * tau); tmp = (single(1.0) + (((x * single(pi)) ^ single(2.0)) * single(-0.16666666666666666))) * (sin(t_1) / t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \pi \cdot \left(x \cdot tau\right)\\
\left(1 + {\left(x \cdot \pi\right)}^{2} \cdot -0.16666666666666666\right) \cdot \frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l*97.1%
*-commutative97.1%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 85.8%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified85.8%
Final simplification85.8%
(FPCore (x tau) :precision binary32 (* (sin (* x PI)) (/ (+ 1.0 (* -0.16666666666666666 (pow (* tau (* x PI)) 2.0))) (* x PI))))
float code(float x, float tau) {
return sinf((x * ((float) M_PI))) * ((1.0f + (-0.16666666666666666f * powf((tau * (x * ((float) M_PI))), 2.0f))) / (x * ((float) M_PI)));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(pi))) * Float32(Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(tau * Float32(x * Float32(pi))) ^ Float32(2.0)))) / Float32(x * Float32(pi)))) end
function tmp = code(x, tau) tmp = sin((x * single(pi))) * ((single(1.0) + (single(-0.16666666666666666) * ((tau * (x * single(pi))) ^ single(2.0)))) / (x * single(pi))); end
\begin{array}{l}
\\
\sin \left(x \cdot \pi\right) \cdot \frac{1 + -0.16666666666666666 \cdot {\left(tau \cdot \left(x \cdot \pi\right)\right)}^{2}}{x \cdot \pi}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 80.2%
associate-*r*80.4%
unpow280.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow180.4%
unpow180.4%
pow-sqr80.4%
*-commutative80.4%
*-commutative80.4%
associate-*r*80.4%
metadata-eval80.4%
Simplified80.2%
Final simplification80.2%
(FPCore (x tau) :precision binary32 (* (/ (sin (* x PI)) (* x PI)) (+ 1.0 (* -0.16666666666666666 (pow (* tau (* x PI)) 2.0)))))
float code(float x, float tau) {
return (sinf((x * ((float) M_PI))) / (x * ((float) M_PI))) * (1.0f + (-0.16666666666666666f * powf((tau * (x * ((float) M_PI))), 2.0f)));
}
function code(x, tau) return Float32(Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))) * Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(tau * Float32(x * Float32(pi))) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = (sin((x * single(pi))) / (x * single(pi))) * (single(1.0) + (single(-0.16666666666666666) * ((tau * (x * single(pi))) ^ single(2.0)))); end
\begin{array}{l}
\\
\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi} \cdot \left(1 + -0.16666666666666666 \cdot {\left(tau \cdot \left(x \cdot \pi\right)\right)}^{2}\right)
\end{array}
Initial program 97.9%
*-commutative97.9%
associate-*l*97.2%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 80.4%
associate-*r*80.4%
unpow280.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow180.4%
unpow180.4%
pow-sqr80.4%
*-commutative80.4%
*-commutative80.4%
associate-*r*80.4%
metadata-eval80.4%
Simplified80.4%
Final simplification80.4%
(FPCore (x tau) :precision binary32 (* (+ 1.0 (* (pow (* x PI) 2.0) -0.16666666666666666)) (+ 1.0 (* -0.16666666666666666 (pow (* tau (* x PI)) 2.0)))))
float code(float x, float tau) {
return (1.0f + (powf((x * ((float) M_PI)), 2.0f) * -0.16666666666666666f)) * (1.0f + (-0.16666666666666666f * powf((tau * (x * ((float) M_PI))), 2.0f)));
}
function code(x, tau) return Float32(Float32(Float32(1.0) + Float32((Float32(x * Float32(pi)) ^ Float32(2.0)) * Float32(-0.16666666666666666))) * Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(tau * Float32(x * Float32(pi))) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = (single(1.0) + (((x * single(pi)) ^ single(2.0)) * single(-0.16666666666666666))) * (single(1.0) + (single(-0.16666666666666666) * ((tau * (x * single(pi))) ^ single(2.0)))); end
\begin{array}{l}
\\
\left(1 + {\left(x \cdot \pi\right)}^{2} \cdot -0.16666666666666666\right) \cdot \left(1 + -0.16666666666666666 \cdot {\left(tau \cdot \left(x \cdot \pi\right)\right)}^{2}\right)
\end{array}
Initial program 97.9%
*-commutative97.9%
associate-*l*97.2%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 80.4%
associate-*r*80.4%
unpow280.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
swap-sqr80.4%
*-commutative80.4%
*-commutative80.4%
unpow180.4%
unpow180.4%
pow-sqr80.4%
*-commutative80.4%
*-commutative80.4%
associate-*r*80.4%
metadata-eval80.4%
Simplified80.4%
Taylor expanded in x around 0 80.0%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified80.0%
Final simplification80.0%
(FPCore (x tau) :precision binary32 (+ 1.0 (* (* x x) (* -0.16666666666666666 (+ (pow PI 2.0) (* (* tau tau) (pow PI 2.0)))))))
float code(float x, float tau) {
return 1.0f + ((x * x) * (-0.16666666666666666f * (powf(((float) M_PI), 2.0f) + ((tau * tau) * powf(((float) M_PI), 2.0f)))));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(x * x) * Float32(Float32(-0.16666666666666666) * Float32((Float32(pi) ^ Float32(2.0)) + Float32(Float32(tau * tau) * (Float32(pi) ^ Float32(2.0))))))) end
function tmp = code(x, tau) tmp = single(1.0) + ((x * x) * (single(-0.16666666666666666) * ((single(pi) ^ single(2.0)) + ((tau * tau) * (single(pi) ^ single(2.0)))))); end
\begin{array}{l}
\\
1 + \left(x \cdot x\right) \cdot \left(-0.16666666666666666 \cdot \left({\pi}^{2} + \left(tau \cdot tau\right) \cdot {\pi}^{2}\right)\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in x around 0 79.6%
unpow279.6%
distribute-lft-out79.6%
unpow279.6%
Simplified79.6%
Final simplification79.6%
(FPCore (x tau) :precision binary32 (fma (* -0.16666666666666666 (* (pow PI 2.0) (+ 1.0 (* tau tau)))) (* x x) 1.0))
float code(float x, float tau) {
return fmaf((-0.16666666666666666f * (powf(((float) M_PI), 2.0f) * (1.0f + (tau * tau)))), (x * x), 1.0f);
}
function code(x, tau) return fma(Float32(Float32(-0.16666666666666666) * Float32((Float32(pi) ^ Float32(2.0)) * Float32(Float32(1.0) + Float32(tau * tau)))), Float32(x * x), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666 \cdot \left({\pi}^{2} \cdot \left(1 + tau \cdot tau\right)\right), x \cdot x, 1\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
associate-/l/97.5%
associate-*r/97.6%
*-commutative97.6%
frac-times97.5%
associate-/r*97.2%
associate-*r/97.2%
Applied egg-rr96.9%
associate-*r/96.9%
associate-*l/96.8%
times-frac96.9%
associate-/r*96.9%
associate-/l/96.8%
unpow296.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*97.1%
Simplified97.1%
add-log-exp_binary3296.3%
Applied rewrite-once96.3%
rem-log-exp97.1%
associate-*l/97.0%
*-commutative97.0%
unpow297.0%
*-commutative97.0%
associate-*l*96.8%
times-frac96.8%
*-commutative96.8%
*-commutative96.8%
Applied egg-rr96.4%
Taylor expanded in x around 0 79.6%
+-commutative79.6%
*-commutative79.6%
unpow279.6%
fma-def79.6%
distribute-lft-out79.6%
distribute-lft1-in79.6%
unpow279.6%
Simplified79.6%
Final simplification79.6%
(FPCore (x tau) :precision binary32 (/ 1.0 (/ 1.0 (fma -0.16666666666666666 (pow (* x PI) 2.0) 1.0))))
float code(float x, float tau) {
return 1.0f / (1.0f / fmaf(-0.16666666666666666f, powf((x * ((float) M_PI)), 2.0f), 1.0f));
}
function code(x, tau) return Float32(Float32(1.0) / Float32(Float32(1.0) / fma(Float32(-0.16666666666666666), (Float32(x * Float32(pi)) ^ Float32(2.0)), Float32(1.0)))) end
\begin{array}{l}
\\
\frac{1}{\frac{1}{\mathsf{fma}\left(-0.16666666666666666, {\left(x \cdot \pi\right)}^{2}, 1\right)}}
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified65.6%
flip3-+65.6%
clear-num65.6%
clear-num65.6%
flip3-+65.7%
+-commutative65.7%
fma-def65.7%
*-commutative65.7%
Applied egg-rr65.7%
Final simplification65.7%
(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(x * Float32(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 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.9%
*-commutative97.9%
associate-*l*97.2%
associate-*l*97.9%
Simplified97.9%
clear-num97.7%
inv-pow97.7%
div-inv97.6%
metadata-eval97.6%
unpow-prod-down97.5%
metadata-eval97.5%
inv-pow97.5%
metadata-eval97.5%
Applied egg-rr97.5%
unpow-197.5%
Simplified97.5%
Taylor expanded in x around 0 71.5%
Final simplification71.5%
(FPCore (x tau) :precision binary32 (fma (* -0.16666666666666666 (* x x)) (pow PI 2.0) 1.0))
float code(float x, float tau) {
return fmaf((-0.16666666666666666f * (x * x)), powf(((float) M_PI), 2.0f), 1.0f);
}
function code(x, tau) return fma(Float32(Float32(-0.16666666666666666) * Float32(x * x)), (Float32(pi) ^ Float32(2.0)), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666 \cdot \left(x \cdot x\right), {\pi}^{2}, 1\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in x around 0 65.6%
+-commutative65.6%
unpow265.6%
associate-*r*65.6%
fma-udef65.6%
Simplified65.6%
Final simplification65.6%
(FPCore (x tau) :precision binary32 (fma (pow (* x PI) 2.0) -0.16666666666666666 1.0))
float code(float x, float tau) {
return fmaf(powf((x * ((float) M_PI)), 2.0f), -0.16666666666666666f, 1.0f);
}
function code(x, tau) return fma((Float32(x * Float32(pi)) ^ Float32(2.0)), Float32(-0.16666666666666666), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left({\left(x \cdot \pi\right)}^{2}, -0.16666666666666666, 1\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified65.6%
+-commutative65.6%
*-commutative65.6%
fma-def65.6%
*-commutative65.6%
Applied egg-rr65.6%
Final simplification65.6%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (* (* x x) (pow PI 2.0)))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * ((x * x) * powf(((float) M_PI), 2.0f)));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * Float32(Float32(x * x) * (Float32(pi) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((x * x) * (single(pi) ^ single(2.0)))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot \left(\left(x \cdot x\right) \cdot {\pi}^{2}\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
Simplified65.6%
Final simplification65.6%
(FPCore (x tau) :precision binary32 (+ 1.0 (* (pow PI 2.0) (* -0.16666666666666666 (* x x)))))
float code(float x, float tau) {
return 1.0f + (powf(((float) M_PI), 2.0f) * (-0.16666666666666666f * (x * x)));
}
function code(x, tau) return Float32(Float32(1.0) + Float32((Float32(pi) ^ Float32(2.0)) * Float32(Float32(-0.16666666666666666) * Float32(x * x)))) end
function tmp = code(x, tau) tmp = single(1.0) + ((single(pi) ^ single(2.0)) * (single(-0.16666666666666666) * (x * x))); end
\begin{array}{l}
\\
1 + {\pi}^{2} \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified65.6%
Taylor expanded in x around 0 65.6%
unpow265.6%
associate-*r*65.6%
Simplified65.6%
Final simplification65.6%
(FPCore (x tau) :precision binary32 (+ 1.0 (* (pow (* x PI) 2.0) -0.16666666666666666)))
float code(float x, float tau) {
return 1.0f + (powf((x * ((float) M_PI)), 2.0f) * -0.16666666666666666f);
}
function code(x, tau) return Float32(Float32(1.0) + Float32((Float32(x * Float32(pi)) ^ Float32(2.0)) * Float32(-0.16666666666666666))) end
function tmp = code(x, tau) tmp = single(1.0) + (((x * single(pi)) ^ single(2.0)) * single(-0.16666666666666666)); end
\begin{array}{l}
\\
1 + {\left(x \cdot \pi\right)}^{2} \cdot -0.16666666666666666
\end{array}
Initial program 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in tau around 0 65.2%
Taylor expanded in x around 0 65.6%
unpow265.6%
unpow265.6%
swap-sqr65.6%
unpow265.6%
Simplified65.6%
Final simplification65.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 97.9%
associate-*r/97.8%
associate-*l*97.1%
*-commutative97.1%
*-commutative97.1%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-/l*97.8%
associate-/r/97.6%
*-commutative97.6%
Simplified97.6%
associate-/l/97.5%
associate-*r/97.6%
*-commutative97.6%
frac-times97.5%
associate-/r*97.2%
associate-*r/97.2%
Applied egg-rr96.9%
associate-*r/96.9%
associate-*l/96.8%
times-frac96.9%
associate-/r*96.9%
associate-/l/96.8%
unpow296.8%
*-commutative96.8%
*-commutative96.8%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 64.4%
Final simplification64.4%
herbie shell --seed 2023297
(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))))