<commit_before>-- |
-- Module    : Numeric.MathFunctions.Constants
-- Copyright : (c) 2009, 2011 <NAME>
-- License   : BSD3
--
-- Maintainer  : <EMAIL>
-- Stability   : experimental
-- Portability : portable
--
-- Constant values common to much numeric code.

module Numeric.MathFunctions.Constants
    (
      m_epsilon
    , m_huge
    , m_tiny
    , m_1_sqrt_2
    , m_2_sqrt_pi
    , m_ln_sqrt_2_pi
    , m_max_exp
    , m_sqrt_2
    , m_sqrt_2_pi
    , m_pos_inf
    , m_neg_inf
    , m_NaN
    ) where

-- | A very large number.
m_huge :: Double
m_huge = 1.7976931348623157e308
{-# INLINE m_huge #-}

m_tiny :: Double
m_tiny = 2.2250738585072014e-308
{-# INLINE m_tiny #-}

-- | The largest 'Int' /x/ such that 2**(/x/-1) is approximately
-- representable as a 'Double'.
m_max_exp :: Int
m_max_exp = 1024

-- | @sqrt 2@
m_sqrt_2 :: Double
m_sqrt_2 = 1.4142135623730950488016887242096980785696718753769480731766
{-# INLINE m_sqrt_2 #-}

-- | @sqrt (2 * pi)@
m_sqrt_2_pi :: Double
m_sqrt_2_pi = 2.5066282746310005024157652848110452530069867406099383166299
{-# INLINE m_sqrt_2_pi #-}

-- | @2 / sqrt pi@
m_2_sqrt_pi :: Double
m_2_sqrt_pi = 1.1283791670955125738961589031215451716881012586579977136881
{-# INLINE m_2_sqrt_pi #-}

-- | @1 / sqrt 2@
m_1_sqrt_2 :: Double
m_1_sqrt_2 = 0.7071067811865475244008443621048490392848359376884740365883
{-# INLINE m_1_sqrt_2 #-}

-- | The smallest 'Double' &#949; such that 1 + &#949; &#8800; 1.
m_epsilon :: Double
m_epsilon = encodeFloat (signif+1) expo - 1.0
    where (signif,expo) = decodeFloat (1.0::Double)

-- | @log(sqrt((2*pi))@
m_ln_sqrt_2_pi :: Double
m_ln_sqrt_2_pi = 0.9189385332046727417803297364056176398613974736377834128171
{-# INLINE m_ln_sqrt_2_pi #-}

-- | Positive infinity.
m_pos_inf :: Double
m_pos_inf = 1/0
{-# INLINE m_pos_inf #-}

-- | Negative infinity.
m_neg_inf :: Double
m_neg_inf = -1/0
{-# INLINE m_neg_inf #-}

-- | Not a number.
m_NaN :: Double
m_NaN = 0/0
{-# INLINE m_NaN #-}<commit_msg>Better documentation for constants<commit_after>-- |
-- Module    : Numeric.MathFunctions.Constants
-- Copyright : (c) 2009, 2011 <NAME>
-- License   : BSD3
--
-- Maintainer  : <EMAIL>
-- Stability   : experimental
-- Portability : portable
--
-- Constant values common to much numeric code.

module Numeric.MathFunctions.Constants
    (
      -- * IEE754 constants
      m_epsilon
    , m_huge
    , m_tiny
    , m_max_exp
    , m_pos_inf
    , m_neg_inf
    , m_NaN
      -- * Mathematical constants
    , m_1_sqrt_2
    , m_2_sqrt_pi
    , m_ln_sqrt_2_pi
    , m_sqrt_2
    , m_sqrt_2_pi
    , m_eulerMascheroni
    ) where

----------------------------------------------------------------
-- IEE754 constants
----------------------------------------------------------------

-- | A very large number.
m_huge :: Double
m_huge = 1.7976931348623157e308
{-# INLINE m_huge #-}

m_tiny :: Double
m_tiny = 2.2250738585072014e-308
{-# INLINE m_tiny #-}

-- | The largest 'Int' /x/ such that 2**(/x/-1) is approximately
-- representable as a 'Double'.
m_max_exp :: Int
m_max_exp = 1024

-- | Positive infinity.
m_pos_inf :: Double
m_pos_inf = 1/0
{-# INLINE m_pos_inf #-}

-- | Negative infinity.
m_neg_inf :: Double
m_neg_inf = -1/0
{-# INLINE m_neg_inf #-}

-- | Not a number.
m_NaN :: Double
m_NaN = 0/0
{-# INLINE m_NaN #-}



----------------------------------------------------------------
-- Mathematical constants
----------------------------------------------------------------

-- | @sqrt 2@
m_sqrt_2 :: Double
m_sqrt_2 = 1.4142135623730950488016887242096980785696718753769480731766
{-# INLINE m_sqrt_2 #-}

-- | @sqrt (2 * pi)@
m_sqrt_2_pi :: Double
m_sqrt_2_pi = 2.5066282746310005024157652848110452530069867406099383166299
{-# INLINE m_sqrt_2_pi #-}

-- | @2 / sqrt pi@
m_2_sqrt_pi :: Double
m_2_sqrt_pi = 1.1283791670955125738961589031215451716881012586579977136881
{-# INLINE m_2_sqrt_pi #-}

-- | @1 / sqrt 2@
m_1_sqrt_2 :: Double
m_1_sqrt_2 = 0.7071067811865475244008443621048490392848359376884740365883
{-# INLINE m_1_sqrt_2 #-}

-- | The smallest 'Double' &#949; such that 1 + &#949; &#8800; 1.
m_epsilon :: Double
m_epsilon = encodeFloat (signif+1) expo - 1.0
    where (signif,expo) = decodeFloat (1.0::Double)

-- | @log(sqrt((2*pi))@
m_ln_sqrt_2_pi :: Double
m_ln_sqrt_2_pi = 0.9189385332046727417803297364056176398613974736377834128171
{-# INLINE m_ln_sqrt_2_pi #-}

-- | Euler–Mascheroni constant (γ = 0.57721...)
m_eulerMascheroni :: Double
m_eulerMascheroni = 0.5772156649015328606065121
{-# INLINE m_eulerMascheroni #-}
{'fraction_non_alphanumeric': 0.18097139055222888, 'fraction_numerical': 0.1871811931692171, 'mean_word_length': 2.711934156378601, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2471356', 'n_tokens_mistral': 2327, 'n_tokens_neox': 1839, 'n_words': 340}