
(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 18 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
(let* ((t_1 (* tau (* x PI))))
(*
(/ (sin t_1) t_1)
(exp (pow (cbrt (log (/ (sin (* x PI)) (* x PI)))) 3.0)))))
float code(float x, float tau) {
float t_1 = tau * (x * ((float) M_PI));
return (sinf(t_1) / t_1) * expf(powf(cbrtf(logf((sinf((x * ((float) M_PI))) / (x * ((float) M_PI))))), 3.0f));
}
function code(x, tau) t_1 = Float32(tau * Float32(x * Float32(pi))) return Float32(Float32(sin(t_1) / t_1) * exp((cbrt(log(Float32(sin(Float32(x * Float32(pi))) / Float32(x * Float32(pi))))) ^ Float32(3.0)))) end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \left(x \cdot \pi\right)\\
\frac{\sin t_1}{t_1} \cdot e^{{\left(\sqrt[3]{\log \left(\frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}\right)}\right)}^{3}}
\end{array}
\end{array}
Initial program 98.1%
add-exp-log98.1%
*-commutative98.1%
*-commutative98.1%
Applied egg-rr98.1%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
Final simplification98.1%
(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(x * Float32(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 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin t_1}{t_1} \cdot \frac{\sin \left(x \cdot \pi\right)}{x \cdot \pi}
\end{array}
\end{array}
Initial program 98.1%
associate-*l*97.6%
associate-*l*98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x tau) :precision binary32 (* (sin (* x PI)) (/ (sin (* PI (* x tau))) (* tau (pow (* x PI) 2.0)))))
float code(float x, float tau) {
return sinf((x * ((float) M_PI))) * (sinf((((float) M_PI) * (x * tau))) / (tau * powf((x * ((float) M_PI)), 2.0f)));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(pi))) * Float32(sin(Float32(Float32(pi) * Float32(x * tau))) / Float32(tau * (Float32(x * Float32(pi)) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = sin((x * single(pi))) * (sin((single(pi) * (x * tau))) / (tau * ((x * single(pi)) ^ single(2.0)))); end
\begin{array}{l}
\\
\sin \left(x \cdot \pi\right) \cdot \frac{\sin \left(\pi \cdot \left(x \cdot tau\right)\right)}{tau \cdot {\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in x around inf 96.7%
associate-*r*96.9%
*-commutative96.9%
*-commutative96.9%
*-commutative96.9%
unpow296.9%
unpow296.9%
swap-sqr97.1%
unpow297.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x tau) :precision binary32 (* (sin (* x (* PI tau))) (/ (sin (* x PI)) (* tau (pow (* x PI) 2.0)))))
float code(float x, float tau) {
return sinf((x * (((float) M_PI) * tau))) * (sinf((x * ((float) M_PI))) / (tau * powf((x * ((float) M_PI)), 2.0f)));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(Float32(pi) * tau))) * Float32(sin(Float32(x * Float32(pi))) / Float32(tau * (Float32(x * Float32(pi)) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = sin((x * (single(pi) * tau))) * (sin((x * single(pi))) / (tau * ((x * single(pi)) ^ single(2.0)))); end
\begin{array}{l}
\\
\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{tau \cdot {\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 98.1%
associate-*r/97.9%
associate-*l/97.8%
associate-/l/97.9%
associate-*r/97.8%
associate-*l*97.3%
associate-*r*97.2%
associate-/r*97.1%
associate-/l/97.2%
swap-sqr97.0%
associate-*r*97.0%
Simplified97.0%
add-cube-cbrt96.2%
pow396.3%
associate-/r*96.2%
*-commutative96.2%
associate-*r*96.1%
swap-sqr96.2%
pow296.2%
*-commutative96.2%
Applied egg-rr96.2%
unpow396.2%
add-cube-cbrt97.1%
associate-/l/97.2%
Applied egg-rr97.2%
Final simplification97.2%
(FPCore (x tau) :precision binary32 (* (* (sin (* PI (* x tau))) (/ (sin (* x PI)) tau)) (pow (* x PI) -2.0)))
float code(float x, float tau) {
return (sinf((((float) M_PI) * (x * tau))) * (sinf((x * ((float) M_PI))) / tau)) * powf((x * ((float) M_PI)), -2.0f);
}
function code(x, tau) return Float32(Float32(sin(Float32(Float32(pi) * Float32(x * tau))) * Float32(sin(Float32(x * Float32(pi))) / tau)) * (Float32(x * Float32(pi)) ^ Float32(-2.0))) end
function tmp = code(x, tau) tmp = (sin((single(pi) * (x * tau))) * (sin((x * single(pi))) / tau)) * ((x * single(pi)) ^ single(-2.0)); end
\begin{array}{l}
\\
\left(\sin \left(\pi \cdot \left(x \cdot tau\right)\right) \cdot \frac{\sin \left(x \cdot \pi\right)}{tau}\right) \cdot {\left(x \cdot \pi\right)}^{-2}
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
clear-num96.8%
inv-pow96.8%
*-commutative96.8%
associate-/l*96.9%
associate-*r*96.8%
swap-sqr97.2%
pow297.2%
*-commutative97.2%
associate-*r*97.5%
*-commutative97.5%
associate-*l*97.2%
Applied egg-rr97.2%
unpow-197.2%
associate-/r/97.0%
*-commutative97.0%
Simplified97.0%
expm1-log1p-u96.9%
expm1-udef96.7%
Applied egg-rr96.9%
expm1-def97.0%
expm1-log1p97.1%
associate-*r*97.3%
*-commutative97.3%
*-commutative97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x tau) :precision binary32 (* (/ (sin (* x PI)) (pow (* x PI) 2.0)) (/ (sin (* PI (* x tau))) tau)))
float code(float x, float tau) {
return (sinf((x * ((float) M_PI))) / powf((x * ((float) M_PI)), 2.0f)) * (sinf((((float) M_PI) * (x * tau))) / tau);
}
function code(x, tau) return Float32(Float32(sin(Float32(x * Float32(pi))) / (Float32(x * Float32(pi)) ^ Float32(2.0))) * Float32(sin(Float32(Float32(pi) * Float32(x * tau))) / tau)) end
function tmp = code(x, tau) tmp = (sin((x * single(pi))) / ((x * single(pi)) ^ single(2.0))) * (sin((single(pi) * (x * tau))) / tau); end
\begin{array}{l}
\\
\frac{\sin \left(x \cdot \pi\right)}{{\left(x \cdot \pi\right)}^{2}} \cdot \frac{\sin \left(\pi \cdot \left(x \cdot tau\right)\right)}{tau}
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
associate-*r/96.9%
associate-/r*97.0%
*-commutative97.0%
associate-*r*96.8%
*-commutative96.8%
associate-*l*97.1%
associate-*r*97.1%
swap-sqr97.1%
pow297.1%
*-commutative97.1%
Applied egg-rr97.1%
pow-prod-down97.1%
*-commutative97.1%
associate-*r*96.9%
*-commutative96.9%
associate-/r*96.8%
*-commutative96.8%
*-commutative96.8%
times-frac96.8%
Applied egg-rr97.3%
Final simplification97.3%
(FPCore (x tau) :precision binary32 (/ (sin (* PI (* x tau))) (/ tau (/ (sin (* x PI)) (pow (* x PI) 2.0)))))
float code(float x, float tau) {
return sinf((((float) M_PI) * (x * tau))) / (tau / (sinf((x * ((float) M_PI))) / powf((x * ((float) M_PI)), 2.0f)));
}
function code(x, tau) return Float32(sin(Float32(Float32(pi) * Float32(x * tau))) / Float32(tau / Float32(sin(Float32(x * Float32(pi))) / (Float32(x * Float32(pi)) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = sin((single(pi) * (x * tau))) / (tau / (sin((x * single(pi))) / ((x * single(pi)) ^ single(2.0)))); end
\begin{array}{l}
\\
\frac{\sin \left(\pi \cdot \left(x \cdot tau\right)\right)}{\frac{tau}{\frac{\sin \left(x \cdot \pi\right)}{{\left(x \cdot \pi\right)}^{2}}}}
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
*-commutative96.8%
associate-*l/96.9%
associate-/l*96.9%
associate-*r*96.7%
*-commutative96.7%
associate-*l*96.8%
associate-/l*97.0%
*-commutative97.0%
associate-*r*97.1%
swap-sqr97.4%
pow297.4%
*-commutative97.4%
Applied egg-rr97.4%
Final simplification97.4%
(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(Float32(sin(Float32(x * Float32(pi))) * 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{\frac{\sin \left(x \cdot \pi\right) \cdot \sin \left(tau \cdot \left(x \cdot \pi\right)\right)}{tau}}{{\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
associate-*r/96.9%
associate-/r*97.0%
*-commutative97.0%
associate-*r*96.8%
*-commutative96.8%
associate-*l*97.1%
associate-*r*97.1%
swap-sqr97.1%
pow297.1%
*-commutative97.1%
Applied egg-rr97.1%
Taylor expanded in x around -inf 97.4%
Final simplification97.4%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* tau (* x PI)))) (* (/ (sin t_1) t_1) (+ 1.0 (* (pow (* x PI) 2.0) -0.16666666666666666)))))
float code(float x, float tau) {
float t_1 = tau * (x * ((float) M_PI));
return (sinf(t_1) / t_1) * (1.0f + (powf((x * ((float) M_PI)), 2.0f) * -0.16666666666666666f));
}
function code(x, tau) t_1 = Float32(tau * Float32(x * Float32(pi))) 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 = tau * (x * single(pi)); 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 := tau \cdot \left(x \cdot \pi\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 98.1%
Taylor expanded in x around 0 85.6%
*-commutative85.6%
unpow285.6%
Simplified85.6%
pow285.6%
unpow-prod-down85.6%
Applied egg-rr85.6%
Final simplification85.6%
(FPCore (x tau) :precision binary32 (* (sin (* PI (* x tau))) (fma -0.16666666666666666 (* x (/ PI tau)) (/ (/ 1.0 PI) (* x tau)))))
float code(float x, float tau) {
return sinf((((float) M_PI) * (x * tau))) * fmaf(-0.16666666666666666f, (x * (((float) M_PI) / tau)), ((1.0f / ((float) M_PI)) / (x * tau)));
}
function code(x, tau) return Float32(sin(Float32(Float32(pi) * Float32(x * tau))) * fma(Float32(-0.16666666666666666), Float32(x * Float32(Float32(pi) / tau)), Float32(Float32(Float32(1.0) / Float32(pi)) / Float32(x * tau)))) end
\begin{array}{l}
\\
\sin \left(\pi \cdot \left(x \cdot tau\right)\right) \cdot \mathsf{fma}\left(-0.16666666666666666, x \cdot \frac{\pi}{tau}, \frac{\frac{1}{\pi}}{x \cdot tau}\right)
\end{array}
Initial program 98.1%
associate-*r/97.9%
associate-*l/97.8%
associate-/l/97.9%
associate-*r/97.8%
associate-*l*97.3%
associate-*r*97.2%
associate-/r*97.1%
associate-/l/97.2%
swap-sqr97.0%
associate-*r*97.0%
Simplified97.0%
Taylor expanded in x around 0 85.0%
distribute-lft-in84.9%
associate-*r*84.9%
*-commutative84.9%
associate-*r*84.9%
associate-/l*84.9%
associate-*r*85.4%
*-commutative85.4%
associate-*r*84.9%
*-commutative84.9%
*-commutative84.9%
associate-*r*85.4%
Applied egg-rr85.4%
distribute-lft-out85.3%
fma-udef85.3%
associate-/r/85.3%
associate-/r*85.1%
Simplified85.1%
Final simplification85.1%
(FPCore (x tau) :precision binary32 (/ (* (sin (* tau (* x PI))) (+ (* (* x PI) -0.16666666666666666) (/ 1.0 (* x PI)))) tau))
float code(float x, float tau) {
return (sinf((tau * (x * ((float) M_PI)))) * (((x * ((float) M_PI)) * -0.16666666666666666f) + (1.0f / (x * ((float) M_PI))))) / tau;
}
function code(x, tau) return Float32(Float32(sin(Float32(tau * Float32(x * Float32(pi)))) * Float32(Float32(Float32(x * Float32(pi)) * Float32(-0.16666666666666666)) + Float32(Float32(1.0) / Float32(x * Float32(pi))))) / tau) end
function tmp = code(x, tau) tmp = (sin((tau * (x * single(pi)))) * (((x * single(pi)) * single(-0.16666666666666666)) + (single(1.0) / (x * single(pi))))) / tau; end
\begin{array}{l}
\\
\frac{\sin \left(tau \cdot \left(x \cdot \pi\right)\right) \cdot \left(\left(x \cdot \pi\right) \cdot -0.16666666666666666 + \frac{1}{x \cdot \pi}\right)}{tau}
\end{array}
Initial program 98.1%
associate-*r/97.9%
associate-*l/97.8%
associate-/l/97.9%
associate-*r/97.8%
associate-*l*97.3%
associate-*r*97.2%
associate-/r*97.1%
associate-/l/97.2%
swap-sqr97.0%
associate-*r*97.0%
Simplified97.0%
Taylor expanded in x around 0 85.0%
Taylor expanded in tau around inf 85.1%
Final simplification85.1%
(FPCore (x tau) :precision binary32 (fma (* -0.16666666666666666 (* (+ 1.0 (* tau tau)) (pow PI 2.0))) (* x x) 1.0))
float code(float x, float tau) {
return fmaf((-0.16666666666666666f * ((1.0f + (tau * tau)) * powf(((float) M_PI), 2.0f))), (x * x), 1.0f);
}
function code(x, tau) return fma(Float32(Float32(-0.16666666666666666) * Float32(Float32(Float32(1.0) + Float32(tau * tau)) * (Float32(pi) ^ Float32(2.0)))), Float32(x * x), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666 \cdot \left(\left(1 + tau \cdot tau\right) \cdot {\pi}^{2}\right), x \cdot x, 1\right)
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in x around 0 79.2%
+-commutative79.2%
fma-def79.2%
distribute-lft-out79.2%
distribute-rgt1-in79.2%
unpow279.2%
unpow279.2%
Simplified79.2%
Final simplification79.2%
(FPCore (x tau) :precision binary32 (* (sin (* x (* PI tau))) (/ 1.0 (* tau (* x PI)))))
float code(float x, float tau) {
return sinf((x * (((float) M_PI) * tau))) * (1.0f / (tau * (x * ((float) M_PI))));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(Float32(pi) * tau))) * Float32(Float32(1.0) / Float32(tau * Float32(x * Float32(pi))))) end
function tmp = code(x, tau) tmp = sin((x * (single(pi) * tau))) * (single(1.0) / (tau * (x * single(pi)))); end
\begin{array}{l}
\\
\sin \left(x \cdot \left(\pi \cdot tau\right)\right) \cdot \frac{1}{tau \cdot \left(x \cdot \pi\right)}
\end{array}
Initial program 98.1%
associate-*r/97.9%
associate-*l/97.8%
associate-/l/97.9%
associate-*r/97.8%
associate-*l*97.3%
associate-*r*97.2%
associate-/r*97.1%
associate-/l/97.2%
swap-sqr97.0%
associate-*r*97.0%
Simplified97.0%
Taylor expanded in x around 0 70.0%
Final simplification70.0%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (* (* x x) (exp (* 2.0 (log PI)))))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * ((x * x) * expf((2.0f * logf(((float) M_PI))))));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * Float32(Float32(x * x) * exp(Float32(Float32(2.0) * log(Float32(pi))))))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((x * x) * exp((single(2.0) * log(single(pi)))))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot \left(\left(x \cdot x\right) \cdot e^{2 \cdot \log \pi}\right)
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in tau around 0 63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 64.0%
unpow264.0%
*-commutative64.0%
unpow264.0%
swap-sqr64.0%
unpow264.0%
*-commutative64.0%
Simplified64.0%
unpow-prod-down64.0%
*-commutative64.0%
unpow264.0%
Applied egg-rr64.0%
add-exp-log64.0%
log-pow64.0%
Applied egg-rr64.0%
Final simplification64.0%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* tau (* x PI)))) (/ (sin t_1) t_1)))
float code(float x, float tau) {
float t_1 = tau * (x * ((float) M_PI));
return sinf(t_1) / t_1;
}
function code(x, tau) t_1 = Float32(tau * Float32(x * Float32(pi))) return Float32(sin(t_1) / t_1) end
function tmp = code(x, tau) t_1 = tau * (x * single(pi)); tmp = sin(t_1) / t_1; end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \left(x \cdot \pi\right)\\
\frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 98.1%
*-un-lft-identity98.1%
times-frac97.5%
*-commutative97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 70.2%
Final simplification70.2%
(FPCore (x tau) :precision binary32 (fma -0.16666666666666666 (pow (* x PI) 2.0) 1.0))
float code(float x, float tau) {
return fmaf(-0.16666666666666666f, powf((x * ((float) M_PI)), 2.0f), 1.0f);
}
function code(x, tau) return fma(Float32(-0.16666666666666666), (Float32(x * Float32(pi)) ^ Float32(2.0)), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666, {\left(x \cdot \pi\right)}^{2}, 1\right)
\end{array}
Initial program 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in tau around 0 63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 64.0%
+-commutative64.0%
unpow264.0%
*-commutative64.0%
unpow264.0%
swap-sqr64.0%
unpow264.0%
fma-def64.0%
*-commutative64.0%
Simplified64.0%
Final simplification64.0%
(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 98.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in tau around 0 63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 64.0%
unpow264.0%
*-commutative64.0%
unpow264.0%
swap-sqr64.0%
unpow264.0%
*-commutative64.0%
Simplified64.0%
Final simplification64.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.1%
*-commutative98.1%
times-frac97.9%
associate-*r/97.8%
associate-*r*97.3%
associate-/r*97.3%
associate-/l/97.3%
associate-*l*97.0%
swap-sqr96.7%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in x around 0 62.8%
Final simplification62.8%
herbie shell --seed 2023228
(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))))