1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
-- |
-- Module : Numeric.MathFunctions.Constants
-- Copyright : (c) 2009, 2011 Bryan O'Sullivan
-- License : BSD3
--
-- Maintainer : bos@serpentine.com
-- Stability : experimental
-- Portability : portable
--
-- Constant values common to much numeric code.
module Numeric.MathFunctions.Constants
(
-- * IEE754 constants
m_epsilon
, m_sqrt_eps
, m_huge
, m_tiny
, m_max_exp
, m_pos_inf
, m_neg_inf
, m_NaN
, m_max_log
, m_min_log
-- * 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
----------------------------------------------------------------
-- | Largest representable finite value.
m_huge :: Double
m_huge = 1.7976931348623157e308
{-# INLINE m_huge #-}
-- | The smallest representable positive normalized value.
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 #-}
-- | Maximum possible finite value of @log x@
m_max_log :: Double
m_max_log = 709.782712893384
{-# INLINE m_max_log #-}
-- | Logarithm of smallest normalized double ('m_tiny')
m_min_log :: Double
m_min_log = -708.3964185322641
{-# INLINE m_min_log #-}
----------------------------------------------------------------
-- 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' ε such that 1 + ε ≠ 1.
m_epsilon :: Double
m_epsilon = encodeFloat (signif+1) expo - 1.0
where (signif,expo) = decodeFloat (1.0::Double)
-- | @sqrt m_epsilon@
--
-- @since 0.3.3.0
m_sqrt_eps :: Double
m_sqrt_eps = 1.4901161193847656e-8
-- | @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 #-}
|