Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Prelude/Floating_Double.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module Prelude(Floating(..)) where

import Ratio

instance  Floating Double where
    pi                  =  3.1415926535897932384626433832795028841972
    exp x               =  exp x        -- MAGIC
    log x               =  log x        -- MAGIC
    sqrt x              =  sqrt x       -- MAGIC
    sin x               =  sin x        -- MAGIC
    cos x               =  cos x        -- MAGIC
    tan x               =  tan x        -- MAGIC
    asin x              =  asin x       -- MAGIC
    acos x              =  acos x       -- MAGIC
    atan x              =  atan x       -- MAGIC
    x ** y              =  x ** y       -- MAGIC
    sinh x              = fromRational (1%2) * (exp x - exp (-x))
    cosh x              = fromRational (1%2) * (exp x + exp (-x))
    tanh x              = (a-b)/(a+b) where a = exp x ; b = exp (-x)
    asinh x = log (x + sqrt (1+x*x))
    acosh x = log (x + (x+1) * sqrt ((x-1)/(x+1)))
    atanh x = log ((x+1) / sqrt (1 - x*x))


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.