-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast conversion between single and double precision floating point and text -- -- A library that performs fast, accurate conversion between floating -- point and text. -- -- This library is implemented as bindings to the C++ -- double-conversion library written by Florian Loitsch at -- Google: https://github.com/floitsch/double-conversion. -- -- Now it can convert single precision numbers, and also it can create -- Builder, instead of bytestring or text. -- -- The Text versions of these functions are about 30 times faster -- than the default show implementation for the Double -- type. -- -- The ByteString versions are slower than the Text -- versions; roughly half the speed. (This seems to be due to the cost of -- allocating ByteString values via malloc.) -- -- Builder versions are slower on single value, but they are much faster -- on large number of values (up to 50x faster on list with 20000 -- doubles). -- -- As a final note, be aware that the bytestring-show package is -- about 50% slower than simply using show. @package double-conversion @version 2.0.3.0 module Data.Double.Conversion.Convertable -- | Type class for floating data types, that cen be converted, using -- double-conversion library -- -- Default instanced convert input to Double and then make Bytestring -- Builder from it. -- -- list of functions : -- -- toExponential: Compute a representation in exponential format with the -- requested number of digits after the decimal point. The last emitted -- digit is rounded. If -1 digits are requested, then the shortest -- exponential representation is computed. -- -- toPrecision: Compute precision leading digits of the given -- value either in exponential or decimal format. The last computed digit -- is rounded. -- -- toFixed: Compute a decimal representation with a fixed number of -- digits after the decimal point. The last emitted digit is rounded. -- -- toShortest: Compute the shortest string of digits that correctly -- represent the input number. -- -- Conversion to text is twice faster than conversion to bytestring -- Conversion to text via Builder (both in the in case of bytestring and -- text) in case of single number is much slower, than to text or -- bytestring directly. (2-3x) But conversion large amount of numbers to -- text via Builder is much faster than directly (up to 50x). Conversion -- to text via text builder is a little slower, then via bytestring -- builder class (RealFloat a, IsString b) => Convertable a b toExponential :: Convertable a b => Int -> a -> b toExponential :: (Convertable a b, b ~ Builder) => Int -> a -> b toPrecision :: Convertable a b => Int -> a -> b toPrecision :: (Convertable a b, b ~ Builder) => Int -> a -> b toFixed :: Convertable a b => Int -> a -> b toFixed :: (Convertable a b, b ~ Builder) => Int -> a -> b toShortest :: Convertable a b => a -> b toShortest :: (Convertable a b, b ~ Builder) => a -> b instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Double Data.ByteString.Builder.Internal.Builder instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Float Data.ByteString.Builder.Internal.Builder instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Double Data.ByteString.Internal.ByteString instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Float Data.ByteString.Internal.ByteString instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Double Data.Text.Internal.Text instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Float Data.Text.Internal.Text instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Double Data.Text.Internal.Builder.Builder instance Data.Double.Conversion.Convertable.Convertable GHC.Types.Float Data.Text.Internal.Builder.Builder