
(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) (/ (sin (* x PI)) (* x PI)))))
float code(float x, float tau) {
float t_1 = tau * (x * ((float) M_PI));
return (sinf(t_1) / t_1) * (sinf((x * ((float) M_PI))) / (x * ((float) M_PI)));
}
function code(x, tau) t_1 = Float32(tau * Float32(x * Float32(pi))) 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 = tau * (x * single(pi)); tmp = (sin(t_1) / t_1) * (sin((x * single(pi))) / (x * single(pi))); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \left(x \cdot \pi\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.2%
Final simplification98.2%
(FPCore (x tau) :precision binary32 (* (sin (* x PI)) (/ (sin (* x (* PI tau))) (* tau (pow (* x PI) 2.0)))))
float code(float x, float tau) {
return sinf((x * ((float) M_PI))) * (sinf((x * (((float) M_PI) * tau))) / (tau * powf((x * ((float) M_PI)), 2.0f)));
}
function code(x, tau) return Float32(sin(Float32(x * Float32(pi))) * Float32(sin(Float32(x * Float32(Float32(pi) * tau))) / Float32(tau * (Float32(x * Float32(pi)) ^ Float32(2.0))))) end
function tmp = code(x, tau) tmp = sin((x * single(pi))) * (sin((x * (single(pi) * tau))) / (tau * ((x * single(pi)) ^ single(2.0)))); end
\begin{array}{l}
\\
\sin \left(x \cdot \pi\right) \cdot \frac{\sin \left(x \cdot \left(\pi \cdot tau\right)\right)}{tau \cdot {\left(x \cdot \pi\right)}^{2}}
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in x around inf 97.1%
*-commutative97.1%
*-commutative97.1%
*-commutative97.1%
associate-*r*97.4%
unpow297.4%
unpow297.4%
swap-sqr97.6%
unpow297.6%
*-commutative97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x tau) :precision binary32 (* (pow (* x PI) -2.0) (/ (* (sin (* x PI)) (sin (* tau (* x PI)))) tau)))
float code(float x, float tau) {
return powf((x * ((float) M_PI)), -2.0f) * ((sinf((x * ((float) M_PI))) * sinf((tau * (x * ((float) M_PI))))) / tau);
}
function code(x, tau) return Float32((Float32(x * Float32(pi)) ^ Float32(-2.0)) * Float32(Float32(sin(Float32(x * Float32(pi))) * sin(Float32(tau * Float32(x * Float32(pi))))) / tau)) end
function tmp = code(x, tau) tmp = ((x * single(pi)) ^ single(-2.0)) * ((sin((x * single(pi))) * sin((tau * (x * single(pi))))) / tau); end
\begin{array}{l}
\\
{\left(x \cdot \pi\right)}^{-2} \cdot \frac{\sin \left(x \cdot \pi\right) \cdot \sin \left(tau \cdot \left(x \cdot \pi\right)\right)}{tau}
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
associate-*r/97.3%
*-commutative97.3%
associate-*r*96.9%
*-commutative96.9%
associate-*l*97.1%
*-commutative97.1%
associate-*r*97.3%
swap-sqr97.3%
pow297.3%
*-commutative97.3%
Applied egg-rr97.3%
expm1-log1p-u97.2%
expm1-udef96.8%
Applied egg-rr96.7%
expm1-def97.1%
expm1-log1p97.5%
*-commutative97.5%
*-commutative97.5%
associate-*r*97.8%
*-commutative97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x tau)
:precision binary32
(let* ((t_1 (* tau (* x PI))))
(*
(/ (sin t_1) t_1)
(+ 1.0 (* -0.16666666666666666 (* (pow PI 2.0) (* x x)))))))
float code(float x, float tau) {
float t_1 = tau * (x * ((float) M_PI));
return (sinf(t_1) / t_1) * (1.0f + (-0.16666666666666666f * (powf(((float) M_PI), 2.0f) * (x * x))));
}
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(-0.16666666666666666) * Float32((Float32(pi) ^ Float32(2.0)) * Float32(x * x))))) end
function tmp = code(x, tau) t_1 = tau * (x * single(pi)); tmp = (sin(t_1) / t_1) * (single(1.0) + (single(-0.16666666666666666) * ((single(pi) ^ single(2.0)) * (x * x)))); 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 + -0.16666666666666666 \cdot \left({\pi}^{2} \cdot \left(x \cdot x\right)\right)\right)
\end{array}
\end{array}
Initial program 98.2%
Taylor expanded in x around 0 87.1%
*-commutative87.1%
unpow287.1%
Simplified87.1%
Final simplification87.1%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (sin t_1) (fma -0.16666666666666666 (/ PI (/ tau x)) (/ 1.0 t_1)))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return sinf(t_1) * fmaf(-0.16666666666666666f, (((float) M_PI) / (tau / x)), (1.0f / t_1));
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * tau)) return Float32(sin(t_1) * fma(Float32(-0.16666666666666666), Float32(Float32(pi) / Float32(tau / x)), Float32(Float32(1.0) / t_1))) end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\sin t_1 \cdot \mathsf{fma}\left(-0.16666666666666666, \frac{\pi}{\frac{tau}{x}}, \frac{1}{t_1}\right)
\end{array}
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 86.4%
fma-def86.4%
associate-/l*86.4%
*-commutative86.4%
*-commutative86.4%
*-commutative86.4%
associate-*r*87.0%
Simplified87.0%
Final simplification87.0%
(FPCore (x tau) :precision binary32 (* (sin (* x (* PI tau))) (+ (* -0.16666666666666666 (/ (* x PI) tau)) (/ 1.0 (* tau (* x PI))))))
float code(float x, float tau) {
return sinf((x * (((float) M_PI) * tau))) * ((-0.16666666666666666f * ((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(Float32(-0.16666666666666666) * Float32(Float32(x * 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(-0.16666666666666666) * ((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 \left(-0.16666666666666666 \cdot \frac{x \cdot \pi}{tau} + \frac{1}{tau \cdot \left(x \cdot \pi\right)}\right)
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 86.4%
Final simplification86.4%
(FPCore (x tau) :precision binary32 (fma (* x x) (* -0.16666666666666666 (* (pow PI 2.0) (+ 1.0 (* tau tau)))) 1.0))
float code(float x, float tau) {
return fmaf((x * x), (-0.16666666666666666f * (powf(((float) M_PI), 2.0f) * (1.0f + (tau * tau)))), 1.0f);
}
function code(x, tau) return fma(Float32(x * x), Float32(Float32(-0.16666666666666666) * Float32((Float32(pi) ^ Float32(2.0)) * Float32(Float32(1.0) + Float32(tau * tau)))), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot \left({\pi}^{2} \cdot \left(1 + tau \cdot tau\right)\right), 1\right)
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in x around 0 81.1%
+-commutative81.1%
*-commutative81.1%
fma-def81.1%
unpow281.1%
distribute-lft-out81.1%
distribute-rgt1-in81.1%
unpow281.1%
Simplified81.1%
Final simplification81.1%
(FPCore (x tau) :precision binary32 (fma (* x x) (* (pow PI 2.0) (+ -0.16666666666666666 (* -0.16666666666666666 (* tau tau)))) 1.0))
float code(float x, float tau) {
return fmaf((x * x), (powf(((float) M_PI), 2.0f) * (-0.16666666666666666f + (-0.16666666666666666f * (tau * tau)))), 1.0f);
}
function code(x, tau) return fma(Float32(x * x), Float32((Float32(pi) ^ Float32(2.0)) * Float32(Float32(-0.16666666666666666) + Float32(Float32(-0.16666666666666666) * Float32(tau * tau)))), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(x \cdot x, {\pi}^{2} \cdot \left(-0.16666666666666666 + -0.16666666666666666 \cdot \left(tau \cdot tau\right)\right), 1\right)
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in x around 0 81.4%
fma-def81.4%
*-commutative81.4%
associate-*l*81.4%
unpow281.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in x around 0 81.1%
+-commutative81.1%
*-commutative81.1%
fma-def81.1%
unpow281.1%
associate-*r*81.1%
distribute-rgt-out81.1%
unpow281.1%
Simplified81.1%
Final simplification81.1%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (sin t_1) (/ 1.0 t_1))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return sinf(t_1) * (1.0f / t_1);
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * tau)) return Float32(sin(t_1) * Float32(Float32(1.0) / t_1)) end
function tmp = code(x, tau) t_1 = x * (single(pi) * tau); tmp = sin(t_1) * (single(1.0) / t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\sin t_1 \cdot \frac{1}{t_1}
\end{array}
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
*-commutative71.8%
associate-*r*71.9%
Simplified71.9%
Final simplification71.9%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* PI (* x tau)))) (/ 1.0 (/ t_1 (sin t_1)))))
float code(float x, float tau) {
float t_1 = ((float) M_PI) * (x * tau);
return 1.0f / (t_1 / sinf(t_1));
}
function code(x, tau) t_1 = Float32(Float32(pi) * Float32(x * tau)) return Float32(Float32(1.0) / Float32(t_1 / sin(t_1))) end
function tmp = code(x, tau) t_1 = single(pi) * (x * tau); tmp = single(1.0) / (t_1 / sin(t_1)); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \pi \cdot \left(x \cdot tau\right)\\
\frac{1}{\frac{t_1}{\sin t_1}}
\end{array}
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
associate-*r*71.8%
Simplified71.8%
associate-*r/71.8%
clear-num71.8%
*-rgt-identity71.8%
*-commutative71.8%
associate-*r*71.9%
*-commutative71.9%
Applied egg-rr71.9%
Final simplification71.9%
(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.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
associate-*r*71.8%
Simplified71.8%
Taylor expanded in x around -inf 71.9%
Final simplification71.9%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* PI (* x tau)))) (/ (sin t_1) t_1)))
float code(float x, float tau) {
float t_1 = ((float) M_PI) * (x * tau);
return sinf(t_1) / t_1;
}
function code(x, tau) t_1 = Float32(Float32(pi) * Float32(x * tau)) return Float32(sin(t_1) / t_1) end
function tmp = code(x, tau) t_1 = single(pi) * (x * tau); tmp = sin(t_1) / t_1; end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \pi \cdot \left(x \cdot tau\right)\\
\frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
associate-*r*71.8%
Simplified71.8%
Taylor expanded in x around inf 71.9%
*-commutative71.9%
*-commutative71.9%
associate-*r*71.7%
*-commutative71.7%
associate-*r*71.9%
Simplified71.9%
Final simplification71.9%
(FPCore (x tau) :precision binary32 (fma -0.16666666666666666 (pow (* PI (* x tau)) 2.0) 1.0))
float code(float x, float tau) {
return fmaf(-0.16666666666666666f, powf((((float) M_PI) * (x * tau)), 2.0f), 1.0f);
}
function code(x, tau) return fma(Float32(-0.16666666666666666), (Float32(Float32(pi) * Float32(x * tau)) ^ Float32(2.0)), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666, {\left(\pi \cdot \left(x \cdot tau\right)\right)}^{2}, 1\right)
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
associate-*r*71.8%
Simplified71.8%
Taylor expanded in x around 0 71.0%
+-commutative71.0%
*-commutative71.0%
fma-def71.0%
associate-*r*71.0%
unpow271.0%
unpow271.0%
unswap-sqr71.0%
*-commutative71.0%
*-commutative71.0%
*-commutative71.0%
unpow271.0%
swap-sqr71.0%
unpow271.0%
Simplified71.0%
Final simplification71.0%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (* (* (pow PI 2.0) (* x x)) (* tau tau)))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * ((powf(((float) M_PI), 2.0f) * (x * x)) * (tau * tau)));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * Float32(Float32((Float32(pi) ^ Float32(2.0)) * Float32(x * x)) * Float32(tau * tau)))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * (((single(pi) ^ single(2.0)) * (x * x)) * (tau * tau))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot \left(\left({\pi}^{2} \cdot \left(x \cdot x\right)\right) \cdot \left(tau \cdot tau\right)\right)
\end{array}
Initial program 98.2%
associate-*r/98.1%
associate-*l/98.0%
associate-/l/98.0%
associate-*r/98.1%
associate-*l*97.5%
associate-*r*97.5%
associate-/r*97.4%
associate-/l/97.5%
swap-sqr97.3%
associate-*r*97.1%
Simplified97.1%
Taylor expanded in x around 0 71.8%
*-commutative71.8%
associate-*r*71.8%
Simplified71.8%
expm1-log1p-u71.9%
expm1-udef71.8%
un-div-inv71.8%
*-commutative71.8%
associate-*r*71.9%
*-commutative71.9%
Applied egg-rr71.9%
Taylor expanded in x around 0 71.0%
unpow271.0%
unpow271.0%
Simplified71.0%
Final simplification71.0%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (pow (+ (+ (* x PI) 1.0) -1.0) 2.0))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * powf((((x * ((float) M_PI)) + 1.0f) + -1.0f), 2.0f));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(Float32(Float32(x * Float32(pi)) + Float32(1.0)) + Float32(-1.0)) ^ Float32(2.0)))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((((x * single(pi)) + single(1.0)) + single(-1.0)) ^ single(2.0))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot {\left(\left(x \cdot \pi + 1\right) + -1\right)}^{2}
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in tau around 0 65.6%
Taylor expanded in x around 0 65.8%
*-commutative65.8%
unpow265.8%
unpow265.8%
swap-sqr65.8%
unpow265.8%
Simplified65.8%
expm1-log1p-u65.8%
expm1-udef65.8%
log1p-udef65.8%
add-exp-log65.8%
Applied egg-rr65.8%
Final simplification65.8%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (* (pow PI 2.0) (* x x)))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * (powf(((float) M_PI), 2.0f) * (x * x)));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * Float32((Float32(pi) ^ Float32(2.0)) * Float32(x * x)))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((single(pi) ^ single(2.0)) * (x * x))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot \left({\pi}^{2} \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in tau around 0 65.6%
Taylor expanded in x around 0 65.8%
*-commutative65.8%
unpow265.8%
unpow265.8%
swap-sqr65.8%
unpow265.8%
Simplified65.8%
unpow-prod-down65.8%
pow265.8%
Applied egg-rr65.8%
Final simplification65.8%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (pow (* x PI) 2.0))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * powf((x * ((float) M_PI)), 2.0f));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(x * Float32(pi)) ^ Float32(2.0)))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((x * single(pi)) ^ single(2.0))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot {\left(x \cdot \pi\right)}^{2}
\end{array}
Initial program 98.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in tau around 0 65.6%
Taylor expanded in x around 0 65.8%
*-commutative65.8%
unpow265.8%
unpow265.8%
swap-sqr65.8%
unpow265.8%
Simplified65.8%
Final simplification65.8%
(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.2%
*-commutative98.2%
times-frac98.0%
associate-*r/98.0%
associate-*r*97.7%
associate-/r*97.6%
associate-/l/97.7%
associate-*l*97.6%
swap-sqr97.4%
associate-*r*97.4%
Simplified97.4%
Taylor expanded in x around 0 64.7%
Final simplification64.7%
herbie shell --seed 2023187
(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))))