-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Read and write hexadecimal floating point numbers
--   
--   Read and write hexadecimal floating point numbers. Provides a
--   quasiquoter for entering hex-float literals, and a function for
--   printing them in hexadecimal.
--   
--   See: <a>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a>,
--   pages 57-58. We slightly diverge from the standard and do not allow
--   for the "floating-suffix," as the type inference of Haskell makes this
--   unnecessary.
--   
--   For details, please see:
--   <a>http://github.com/LeventErkok/FloatingHex/</a>
@package FloatingHex
@version 0.5


-- | Reading/Writing hexadecimal floating-point numbers.
--   
--   See: <a>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a>,
--   pages 57-58. We slightly diverge from the standard and do not allow
--   for the "floating-suffix," as the type inference of Haskell makes this
--   unnecessary.
module Data.Numbers.FloatingHex

-- | A quasiquoter for hexadecimal floating-point literals. See:
--   <a>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a>,
--   pages 57-58. We slightly diverge from the standard and do not allow
--   for the "floating-suffix," as the type inference of Haskell makes this
--   unnecessary.
--   
--   Example:
--   
--   <pre>
--   {-# LANGUAGE QuasiQuotes #-}
--   import Data.Numbers.FloatingHex
--   
--   f :: Double
--   f = [hf|0x1.f44abd5aa7ca4p+25|]
--   </pre>
--   
--   With these definitions, <tt>f</tt> will be equal to the number
--   <tt>6.5574266708245546e7</tt>
hf :: QuasiQuoter

-- | Due to intricacies of conversion between <tt>Float</tt> and
--   <tt>Double</tt> types (see
--   <a>http://ghc.haskell.org/trac/ghc/ticket/3676</a>), we explicitly
--   introduce a class to do the reading properly.
class RealFloat a => FloatingHexReader a

-- | Convert a hex-float from a string, if possible.
readHFloat :: FloatingHexReader a => String -> Maybe a

-- | Show a floating-point value in the hexadecimal format, similar to the
--   <tt>%a</tt> specifier in C's printf.
--   
--   <pre>
--   &gt;&gt;&gt; showHFloat (212.21 :: Double) ""
--   "0x1.a86b851eb851fp7"
--   
--   &gt;&gt;&gt; showHFloat (-12.76 :: Float) ""
--   "-0x1.9851ecp3"
--   
--   &gt;&gt;&gt; showHFloat (-0 :: Double) ""
--   "-0x0p+0"
--   </pre>
showHFloat :: RealFloat a => a -> ShowS
instance Data.Numbers.FloatingHex.FloatingHexReader GHC.Types.Double
instance Data.Numbers.FloatingHex.FloatingHexReader GHC.Types.Float
