# Sinc function - and sinc neural networks - and function approximation for the former

**URL:** <https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483>\
**Category:** General Usage\
**Created:** [September 11, 2020, 10:17pm UTC](https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483 "2020-09-11T22:17:21Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 12, 2020, 3:08pm UTC](https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483/4 "2020-09-12T15:08:13Z")

</div>

> [@Palli](#):
>
> I’m not sure the Julia implementation is as fast as it could be.

Explicitly calling `factorial` and computing powers of `x` _separately_ for each term in a Taylor series is not a good approach. Not only is this very slow (you have a lot of redundant computations!), but it can also overflow to `0*Inf` if you compute enough terms.

See, for example, the [new implementation of the `cosc` function in Base](https://github.com/JuliaLang/julia/blob/eee48c58c0601858c3497d6982f7dea2d37ed88e/base/special/trig.jl#L1096-L1125) for an example of how to compute a Taylor series iteratively (to arbitrary precision), with specialized cases (`evalpoly` with hardcoded coefficients to a fixed order) for single and double precision.

---

_[View the full topic](https://discourse.julialang.org/t/sinc-function-and-sinc-neural-networks-and-function-approximation-for-the-former/46483)._
