-- 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: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, -- 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: -- http://github.com/LeventErkok/FloatingHex/ @package FloatingHex @version 0.1 -- | Reading/Writing hexadecimal floating-point numbers. -- -- See: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, -- 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: -- http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, -- 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: -- --
-- {-# LANGUAGE QuasiQuotes #-}
-- import Data.Numbers.FloatingHex
--
-- f :: Double
-- f = [hf|0x1.f44abd5aa7ca4p+25|]
--
--
-- With these definitions, f will be equal to the number
-- 6.5574266708245546e7
hf :: QuasiQuoter
-- | Show a floating-point value in the hexadecimal format.
--
-- NB. While this function will print a faithful (i.e., correct) value,
-- it is not 100% compatible with the %a modifier as found in
-- the C's printf implementation.
--
-- -- >>> showHFloat (212.21 :: Double) "" -- "0x1.a86b851eb851fp7" -- -- >>> showHFloat (-12.76 :: Float) "" -- "-0xc.c28f6p0" --showHFloat :: RealFloat a => a -> ShowS