
(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 (* PI (* tau x)))) (* (/ (sin t_1) t_1) (/ (sin (* PI x)) (* PI x)))))
float code(float x, float tau) {
float t_1 = ((float) M_PI) * (tau * x);
return (sinf(t_1) / t_1) * (sinf((((float) M_PI) * x)) / (((float) M_PI) * x));
}
function code(x, tau) t_1 = Float32(Float32(pi) * Float32(tau * x)) return Float32(Float32(sin(t_1) / t_1) * Float32(sin(Float32(Float32(pi) * x)) / Float32(Float32(pi) * x))) end
function tmp = code(x, tau) t_1 = single(pi) * (tau * x); tmp = (sin(t_1) / t_1) * (sin((single(pi) * x)) / (single(pi) * x)); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \pi \cdot \left(tau \cdot x\right)\\
\frac{\sin t_1}{t_1} \cdot \frac{\sin \left(\pi \cdot x\right)}{\pi \cdot x}
\end{array}
\end{array}
Initial program 97.6%
associate-*l*97.0%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in x around inf 97.6%
associate-*r*97.2%
*-commutative97.2%
*-commutative97.2%
*-commutative97.2%
*-commutative97.2%
associate-*r*97.7%
*-commutative97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x tau) :precision binary32 (* (/ (sin (* PI x)) (* PI x)) (/ (sin (* tau (* PI x))) (* x (* PI tau)))))
float code(float x, float tau) {
return (sinf((((float) M_PI) * x)) / (((float) M_PI) * x)) * (sinf((tau * (((float) M_PI) * x))) / (x * (((float) M_PI) * tau)));
}
function code(x, tau) return Float32(Float32(sin(Float32(Float32(pi) * x)) / Float32(Float32(pi) * x)) * Float32(sin(Float32(tau * Float32(Float32(pi) * x))) / Float32(x * Float32(Float32(pi) * tau)))) end
function tmp = code(x, tau) tmp = (sin((single(pi) * x)) / (single(pi) * x)) * (sin((tau * (single(pi) * x))) / (x * (single(pi) * tau))); end
\begin{array}{l}
\\
\frac{\sin \left(\pi \cdot x\right)}{\pi \cdot x} \cdot \frac{\sin \left(tau \cdot \left(\pi \cdot x\right)\right)}{x \cdot \left(\pi \cdot tau\right)}
\end{array}
Initial program 97.6%
associate-*l*97.0%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in x around -inf 97.2%
Final simplification97.2%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* x (* PI tau)))) (* (/ (sin (* PI x)) (* PI x)) (/ (sin t_1) t_1))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
return (sinf((((float) M_PI) * x)) / (((float) M_PI) * x)) * (sinf(t_1) / t_1);
}
function code(x, tau) t_1 = Float32(x * Float32(Float32(pi) * tau)) return Float32(Float32(sin(Float32(Float32(pi) * x)) / Float32(Float32(pi) * x)) * Float32(sin(t_1) / t_1)) end
function tmp = code(x, tau) t_1 = x * (single(pi) * tau); tmp = (sin((single(pi) * x)) / (single(pi) * x)) * (sin(t_1) / t_1); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\pi \cdot tau\right)\\
\frac{\sin \left(\pi \cdot x\right)}{\pi \cdot x} \cdot \frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.6%
associate-*l*97.0%
associate-*l*97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x tau) :precision binary32 (* (sin (* tau (* PI x))) (/ (/ (sin (* PI x)) tau) (pow (* PI x) 2.0))))
float code(float x, float tau) {
return sinf((tau * (((float) M_PI) * x))) * ((sinf((((float) M_PI) * x)) / tau) / powf((((float) M_PI) * x), 2.0f));
}
function code(x, tau) return Float32(sin(Float32(tau * Float32(Float32(pi) * x))) * Float32(Float32(sin(Float32(Float32(pi) * x)) / tau) / (Float32(Float32(pi) * x) ^ Float32(2.0)))) end
function tmp = code(x, tau) tmp = sin((tau * (single(pi) * x))) * ((sin((single(pi) * x)) / tau) / ((single(pi) * x) ^ single(2.0))); end
\begin{array}{l}
\\
\sin \left(tau \cdot \left(\pi \cdot x\right)\right) \cdot \frac{\frac{\sin \left(\pi \cdot x\right)}{tau}}{{\left(\pi \cdot x\right)}^{2}}
\end{array}
Initial program 97.6%
associate-*r/97.5%
associate-*l/97.5%
associate-/l/97.3%
associate-*r/97.2%
associate-*l*96.7%
associate-*r*96.8%
associate-/r*96.8%
associate-/l/96.8%
swap-sqr96.6%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in x around -inf 96.4%
Taylor expanded in tau around inf 96.5%
times-frac96.3%
*-commutative96.3%
*-commutative96.3%
associate-*r*96.6%
*-commutative96.6%
*-commutative96.6%
unpow296.6%
unpow296.6%
swap-sqr96.8%
unpow296.8%
times-frac96.9%
Simplified97.0%
Final simplification97.0%
(FPCore (x tau) :precision binary32 (* (/ (sin (* tau (* PI x))) tau) (* (sin (* PI x)) (pow (* PI x) -2.0))))
float code(float x, float tau) {
return (sinf((tau * (((float) M_PI) * x))) / tau) * (sinf((((float) M_PI) * x)) * powf((((float) M_PI) * x), -2.0f));
}
function code(x, tau) return Float32(Float32(sin(Float32(tau * Float32(Float32(pi) * x))) / tau) * Float32(sin(Float32(Float32(pi) * x)) * (Float32(Float32(pi) * x) ^ Float32(-2.0)))) end
function tmp = code(x, tau) tmp = (sin((tau * (single(pi) * x))) / tau) * (sin((single(pi) * x)) * ((single(pi) * x) ^ single(-2.0))); end
\begin{array}{l}
\\
\frac{\sin \left(tau \cdot \left(\pi \cdot x\right)\right)}{tau} \cdot \left(\sin \left(\pi \cdot x\right) \cdot {\left(\pi \cdot x\right)}^{-2}\right)
\end{array}
Initial program 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
*-commutative96.6%
associate-*l/96.6%
associate-/l*96.8%
associate-*r*96.6%
*-commutative96.6%
associate-*l*96.7%
associate-/l*96.5%
*-commutative96.5%
associate-*r*96.6%
swap-sqr96.8%
pow296.8%
*-commutative96.8%
Applied egg-rr96.8%
expm1-log1p-u96.8%
Applied egg-rr96.8%
expm1-log1p-u96.5%
expm1-udef96.1%
Applied egg-rr96.3%
expm1-def96.7%
expm1-log1p97.0%
*-commutative97.0%
associate-*r*97.1%
*-commutative97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (x tau)
:precision binary32
(let* ((t_1 (* x (* PI tau))))
(*
(/ (sin t_1) t_1)
(+ 1.0 (* -0.16666666666666666 (* (pow PI 2.0) (* x x)))))))
float code(float x, float tau) {
float t_1 = x * (((float) M_PI) * tau);
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(x * Float32(Float32(pi) * tau)) 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 = x * (single(pi) * tau); 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 := x \cdot \left(\pi \cdot tau\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 97.6%
associate-*l*97.0%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in x around 0 82.7%
*-commutative82.7%
unpow282.7%
Simplified82.7%
Final simplification82.7%
(FPCore (x tau)
:precision binary32
(let* ((t_1 (* tau (* PI x))))
(*
(/ (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 * (((float) M_PI) * x);
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(Float32(pi) * x)) 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 * (single(pi) * x); 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(\pi \cdot x\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 97.6%
Taylor expanded in x around 0 82.7%
*-commutative82.7%
unpow282.7%
Simplified82.7%
Final simplification82.7%
(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 97.6%
associate-*r/97.5%
associate-*l/97.5%
associate-/l/97.3%
associate-*r/97.2%
associate-*l*96.7%
associate-*r*96.8%
associate-/r*96.8%
associate-/l/96.8%
swap-sqr96.6%
associate-*r*96.5%
Simplified96.5%
add-sqr-sqrt96.3%
sqrt-unprod96.5%
swap-sqr96.5%
associate-*r*96.7%
expm1-log1p-u96.6%
associate-*r*96.4%
swap-sqr96.4%
sqrt-unprod96.2%
add-sqr-sqrt96.4%
*-commutative96.4%
Applied egg-rr96.4%
Taylor expanded in x around inf 96.6%
*-commutative96.6%
*-commutative96.6%
unpow296.6%
unpow296.6%
swap-sqr96.8%
unpow296.8%
Simplified96.8%
Taylor expanded in x around 0 81.8%
fma-def81.8%
associate-/l*81.8%
*-commutative81.8%
associate-*r*82.3%
Simplified82.3%
Final simplification82.3%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* tau (* PI x)))) (* (sin t_1) (+ (* -0.16666666666666666 (/ (* PI x) tau)) (/ 1.0 t_1)))))
float code(float x, float tau) {
float t_1 = tau * (((float) M_PI) * x);
return sinf(t_1) * ((-0.16666666666666666f * ((((float) M_PI) * x) / tau)) + (1.0f / t_1));
}
function code(x, tau) t_1 = Float32(tau * Float32(Float32(pi) * x)) return Float32(sin(t_1) * Float32(Float32(Float32(-0.16666666666666666) * Float32(Float32(Float32(pi) * x) / tau)) + Float32(Float32(1.0) / t_1))) end
function tmp = code(x, tau) t_1 = tau * (single(pi) * x); tmp = sin(t_1) * ((single(-0.16666666666666666) * ((single(pi) * x) / tau)) + (single(1.0) / t_1)); end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \left(\pi \cdot x\right)\\
\sin t_1 \cdot \left(-0.16666666666666666 \cdot \frac{\pi \cdot x}{tau} + \frac{1}{t_1}\right)
\end{array}
\end{array}
Initial program 97.6%
associate-*r/97.5%
associate-*l/97.5%
associate-/l/97.3%
associate-*r/97.2%
associate-*l*96.7%
associate-*r*96.8%
associate-/r*96.8%
associate-/l/96.8%
swap-sqr96.6%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in x around -inf 96.4%
Taylor expanded in x around 0 82.3%
Final simplification82.3%
(FPCore (x tau) :precision binary32 (fma (* (pow PI 2.0) (+ -0.16666666666666666 (* -0.16666666666666666 (* tau tau)))) (* x x) 1.0))
float code(float x, float tau) {
return fmaf((powf(((float) M_PI), 2.0f) * (-0.16666666666666666f + (-0.16666666666666666f * (tau * tau)))), (x * x), 1.0f);
}
function code(x, tau) return fma(Float32((Float32(pi) ^ Float32(2.0)) * Float32(Float32(-0.16666666666666666) + Float32(Float32(-0.16666666666666666) * Float32(tau * tau)))), Float32(x * x), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left({\pi}^{2} \cdot \left(-0.16666666666666666 + -0.16666666666666666 \cdot \left(tau \cdot tau\right)\right), x \cdot x, 1\right)
\end{array}
Initial program 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in x around 0 75.4%
+-commutative75.4%
fma-def75.4%
associate-*r*75.4%
distribute-rgt-out75.4%
unpow275.4%
unpow275.4%
Simplified75.4%
Final simplification75.4%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* tau (* PI x)))) (/ (sin t_1) t_1)))
float code(float x, float tau) {
float t_1 = tau * (((float) M_PI) * x);
return sinf(t_1) / t_1;
}
function code(x, tau) t_1 = Float32(tau * Float32(Float32(pi) * x)) return Float32(sin(t_1) / t_1) end
function tmp = code(x, tau) t_1 = tau * (single(pi) * x); tmp = sin(t_1) / t_1; end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := tau \cdot \left(\pi \cdot x\right)\\
\frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.6%
associate-*r/97.5%
associate-*l/97.5%
associate-/l/97.3%
associate-*r/97.2%
associate-*l*96.7%
associate-*r*96.8%
associate-/r*96.8%
associate-/l/96.8%
swap-sqr96.6%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in x around 0 67.6%
associate-/r*67.5%
Simplified67.5%
Taylor expanded in x around -inf 67.8%
Final simplification67.8%
(FPCore (x tau) :precision binary32 (let* ((t_1 (* PI (* tau x)))) (/ (sin t_1) t_1)))
float code(float x, float tau) {
float t_1 = ((float) M_PI) * (tau * x);
return sinf(t_1) / t_1;
}
function code(x, tau) t_1 = Float32(Float32(pi) * Float32(tau * x)) return Float32(sin(t_1) / t_1) end
function tmp = code(x, tau) t_1 = single(pi) * (tau * x); tmp = sin(t_1) / t_1; end
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \pi \cdot \left(tau \cdot x\right)\\
\frac{\sin t_1}{t_1}
\end{array}
\end{array}
Initial program 97.6%
associate-*l*97.0%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in x around inf 97.6%
associate-*r*97.2%
*-commutative97.2%
*-commutative97.2%
*-commutative97.2%
*-commutative97.2%
associate-*r*97.7%
*-commutative97.7%
Simplified97.7%
expm1-log1p-u97.3%
expm1-udef97.3%
*-commutative97.3%
*-commutative97.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 67.8%
Final simplification67.8%
(FPCore (x tau) :precision binary32 (fma -0.16666666666666666 (pow (* x (* PI tau)) 2.0) 1.0))
float code(float x, float tau) {
return fmaf(-0.16666666666666666f, powf((x * (((float) M_PI) * tau)), 2.0f), 1.0f);
}
function code(x, tau) return fma(Float32(-0.16666666666666666), (Float32(x * Float32(Float32(pi) * tau)) ^ Float32(2.0)), Float32(1.0)) end
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666, {\left(x \cdot \left(\pi \cdot tau\right)\right)}^{2}, 1\right)
\end{array}
Initial program 97.6%
associate-*r/97.5%
associate-*l/97.5%
associate-/l/97.3%
associate-*r/97.2%
associate-*l*96.7%
associate-*r*96.8%
associate-/r*96.8%
associate-/l/96.8%
swap-sqr96.6%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in x around 0 67.6%
associate-/r*67.5%
Simplified67.5%
Taylor expanded in x around 0 66.3%
+-commutative66.3%
*-commutative66.3%
fma-def66.3%
*-commutative66.3%
associate-*l*66.3%
unpow266.3%
unpow266.3%
unpow266.3%
unswap-sqr66.3%
swap-sqr66.3%
unpow266.3%
Simplified66.3%
Final simplification66.3%
(FPCore (x tau) :precision binary32 (+ 1.0 (* -0.16666666666666666 (pow (+ (+ (* PI x) 1.0) -1.0) 2.0))))
float code(float x, float tau) {
return 1.0f + (-0.16666666666666666f * powf((((((float) M_PI) * x) + 1.0f) + -1.0f), 2.0f));
}
function code(x, tau) return Float32(Float32(1.0) + Float32(Float32(-0.16666666666666666) * (Float32(Float32(Float32(Float32(pi) * x) + Float32(1.0)) + Float32(-1.0)) ^ Float32(2.0)))) end
function tmp = code(x, tau) tmp = single(1.0) + (single(-0.16666666666666666) * ((((single(pi) * x) + single(1.0)) + single(-1.0)) ^ single(2.0))); end
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot {\left(\left(\pi \cdot x + 1\right) + -1\right)}^{2}
\end{array}
Initial program 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in tau around 0 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
unpow260.5%
unpow260.5%
swap-sqr60.5%
unpow260.5%
Simplified60.5%
expm1-log1p-u60.5%
expm1-udef60.5%
log1p-udef60.5%
add-exp-log60.5%
Applied egg-rr60.5%
Final simplification60.5%
(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(x * Float32(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(x \cdot \left(x \cdot {\pi}^{2}\right)\right)
\end{array}
Initial program 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in tau around 0 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
unpow260.5%
unpow260.5%
swap-sqr60.5%
unpow260.5%
Simplified60.5%
*-commutative60.5%
unpow-prod-down60.5%
pow260.5%
pow260.5%
associate-*r*60.5%
*-commutative60.5%
pow260.5%
Applied egg-rr60.5%
Final simplification60.5%
(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 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in tau around 0 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
unpow260.5%
unpow260.5%
swap-sqr60.5%
unpow260.5%
Simplified60.5%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
unpow260.5%
Simplified60.5%
Final simplification60.5%
(FPCore (x tau) :precision binary32 (+ 1.0 (* (pow (* PI x) 2.0) -0.16666666666666666)))
float code(float x, float tau) {
return 1.0f + (powf((((float) M_PI) * x), 2.0f) * -0.16666666666666666f);
}
function code(x, tau) return Float32(Float32(1.0) + Float32((Float32(Float32(pi) * x) ^ Float32(2.0)) * Float32(-0.16666666666666666))) end
function tmp = code(x, tau) tmp = single(1.0) + (((single(pi) * x) ^ single(2.0)) * single(-0.16666666666666666)); end
\begin{array}{l}
\\
1 + {\left(\pi \cdot x\right)}^{2} \cdot -0.16666666666666666
\end{array}
Initial program 97.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in tau around 0 60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in x around 0 60.5%
*-commutative60.5%
unpow260.5%
unpow260.5%
swap-sqr60.5%
unpow260.5%
Simplified60.5%
Final simplification60.5%
(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.6%
*-commutative97.6%
times-frac97.3%
associate-*r/97.3%
associate-*r*97.1%
associate-/r*97.0%
associate-/l/97.1%
associate-*l*96.8%
swap-sqr96.6%
associate-*r*96.6%
Simplified96.6%
Taylor expanded in x around 0 59.4%
Final simplification59.4%
herbie shell --seed 2023227
(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))))