-- 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 have very close speed to the
-- Text versions;
--
-- Builder versions (both for Text and Bytestring) are slower on single
-- value, but they are much faster on large number of values (up to 20x
-- 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.4.2
module Data.Double.Conversion.Convertable
-- | Type class for floating data types, that can 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 via Builder (both in the in case of bytestring and
-- text) in case of single number is a bit slower, than to text or
-- bytestring directly. But conversion a large amount of numbers to text
-- via Builder (for example using foldr) is much faster than direct
-- conversion to Text (up to 10-15x).
--
-- The same works for bytestrings: conversion, for example, a list of
-- 20000 doubles to bytestring builder and then to bytestring is about 13
-- times faster than direct conversion of this list to bytestring.
--
-- Conversion to text via text builder is a little bit slower, than
-- conversion to bytestring 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
-- | This module left now only for compatibility and should not be used in
-- new projects. Please, use Convertable type class from
-- Data.Double.Conversion.Convertable
--
-- It is espesially recommended to convert a large amount of numbers via
-- bytestring builder using methods of Convertable type class. It is
-- about 10-15x faster.
--
-- Fast, efficient support for converting between double precision
-- floating point values and text.
--
-- Although about 15 times faster than plain show, these functions
-- are slower than their Text counterparts, at roughly
-- half the speed. (This seems to be due to the cost of allocating
-- ByteString values via malloc.)
module Data.Double.Conversion.ByteString
-- | 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.
toExponential :: Int -> Double -> ByteString
-- | Compute a decimal representation with a fixed number of digits after
-- the decimal point. The last emitted digit is rounded.
toFixed :: Int -> Double -> ByteString
-- | Compute precision leading digits of the given value either in
-- exponential or decimal format. The last computed digit is rounded.
toPrecision :: Int -> Double -> ByteString
-- | Compute the shortest string of digits that correctly represent the
-- input number.
toShortest :: Double -> ByteString
-- | This module left now only for compatibility and should not be used in
-- new projects. Please, use Convertable type class from
-- Data.Double.Conversion.Convertable
--
-- It is espesially recommended to convert a large amount of numbers via
-- text builder using methods of Convertable type class. It is about
-- 10-15x faster.
--
-- Fast, efficient support for converting between double precision
-- floating point values and text.
--
-- These functions are about 30 times faster than the default show
-- implementation for the Double type.
module Data.Double.Conversion.Text
-- | 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.
toExponential :: Int -> Double -> Text
-- | Compute a decimal representation with a fixed number of digits after
-- the decimal point. The last emitted digit is rounded.
toFixed :: Int -> Double -> Text
-- | Compute precision leading digits of the given value either in
-- exponential or decimal format. The last computed digit is rounded.
toPrecision :: Int -> Double -> Text
-- | Compute the shortest string of digits that correctly represent the
-- input number.
toShortest :: Double -> Text