{-|
Module      : PhysicsConstants
Description : Provides useful physics constants

Note that all SI /defined/ quantities are rational numbers as they are
/precisely/ defined as such. Any experimentally derived constants are provided
as doubles in as much precision as is known modulo floating point errors.

-}

module PhysicsConstants
       ( -- * Constants
         nGSI
       , cSI
       , cAU
       , au
       , aukm
       , secondsInDay
       , aGMtoSIGM
       ) where

-- | Speed of light in SI units (m s^-1)
cSI :: Rational -- Maaaaybe will need to use FixedPoint for everything
cSI = 299792458

-- | Speed of light in au units (au days^-1)
cAU :: Rational
cAU = cSI/au * secondsInDay

-- | Newton's Gravitational constant in SI units (m^3 kg^-1 s^-2), usually unused.
nGSI :: Double
nGSI = 6.674e-11

-- | Standard Astronomical Unit (au) as defined by IAU2012 in metres
au :: Rational
au = 1.495978707e11

-- | Standard Astronomical Unit (au) as defined by IAU2012 in kilometres
aukm :: Rational
aukm = 1.495978707e8

-- | SI Defined number of seconds in non-standard unit day
secondsInDay :: Rational
secondsInDay = 86400

-- | Converts Astronomical GM (au^3 days^-2) to SIkm GM (km^3 s^-2)
aGMtoSIGM :: Floating f => f -> f
aGMtoSIGM gm = fromRational ((aukm^^(3::Int))/(secondsInDay^^(2::Int))) * gm