# Sinc function

### From HaskellWiki

(Difference between revisions)
|         |                                                                                                                                                                                                                                                           |         |                                                                                                                                                                                                                                                                   |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|         |                                                                                                                                                                                                                                                           |         |                                                                                                                                                                                                                                                                   |
| Line 1: |                                                                                                                                                                                                                                                           | Line 1: |                                                                                                                                                                                                                                                                   |
|         | == Sinc function ==                                                                                                                                                                                                                                       |         | == Sinc function ==                                                                                                                                                                                                                                               |
|         |                                                                                                                                                                                                                                                           |         |                                                                                                                                                                                                                                                                   |
| -       | The sinc function <math>sin(x)/x</math> is a useful function that is a little tricky to use because it becomes 0/0 as x tends to 0.  Here is an implementation taken from the [http://www.boost.org/boost/math/special_functions/sinc.hpp Boost] library. | +       | The sinc function <math>\frac{sin(x)}{x}</math> is a useful function that is a little tricky to use because it becomes 0/0 as x tends to 0.  Here is an implementation taken from the [http://www.boost.org/boost/math/special_functions/sinc.hpp Boost] library. |
|         |                                                                                                                                                                                                                                                           |         |                                                                                                                                                                                                                                                                   |
|         | <pre>                                                                                                                                                                                                                                                     |         | <pre>                                                                                                                                                                                                                                                             |

## Sinc function

The sinc function $\frac{sin(x)}{x}$ is a useful function that is a little tricky to use because it becomes 0/0 as x tends to 0. Here is an implementation taken from the Boost library.

```epsilon :: RealFloat a => a
epsilon = encodeFloat 1 (fromIntegral $ 1-floatDigits epsilon)

{- Boosted from Boost http://www.boost.org/boost/math/special_functions/sinc.hpp -}
sinc :: (RealFloat a) => a -> a
sinc x | (abs x) >= taylor_n_bound = (sin x)/x
       | otherwise = 1 - (x^2/6) + (x^4/120)
 where
  taylor_n_bound = sqrt $ sqrt epsilon
```
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 1, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.3, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8599498867988586, "perplexity_flag": "middle"}