Scientific notation with 'default precision' (decimal places matching show)
Modulerebase-1.21.2Haskell2010
Rebase.Data.ByteString.Builder
- 2 types
- 66 values
- Packagerebase-1.21.2
- Exports68
- LanguageHaskell2010
- LicenceMIT
- SourceRealFloat.hs
Instances6IsList, Show, IsString, Semigroup, Monoid, Item
IsList BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.InternalShow BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphanIsString BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphanSemigroup BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.InternalMonoid BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internaltype Item Builder = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
Encode each byte of a StrictByteString using its fixed-width hex encoding.
Encode an IEEE Double using 16 nibbles.
Encode an IEEE Float using 8 nibbles.
Decimal encoding of an Int16 using the ASCII digits.
Encode a Int16 using 4 nibbles.
Decimal encoding of an Int32 using the ASCII digits.
Encode a Int32 using 8 nibbles.
Decimal encoding of an Int64 using the ASCII digits.
Encode a Int64 using 16 nibbles.
Decimal encoding of an Int8 using the ASCII digits.
e.g.
toLazyByteString (int8Dec 42) = "42"
toLazyByteString (int8Dec (-1)) = "-1"Encode a Int8 using 2 nibbles (hexadecimal digits).
Decimal encoding of an Int using the ASCII digits.
Decimal encoding of an Integer using the ASCII digits.
Encode each byte of a LazyByteString using its fixed-width hex encoding.
Decimal encoding of a Word16 using the ASCII digits.
Shortest hexadecimal encoding of a Word16 using lower-case characters.
Encode a Word16 using 4 nibbles.
Decimal encoding of a Word32 using the ASCII digits.
Shortest hexadecimal encoding of a Word32 using lower-case characters.
Encode a Word32 using 8 nibbles.
Decimal encoding of a Word64 using the ASCII digits.
Shortest hexadecimal encoding of a Word64 using lower-case characters.
Encode a Word64 using 16 nibbles.
Decimal encoding of a Word8 using the ASCII digits.
Shortest hexadecimal encoding of a Word8 using lower-case characters.
Encode a Word8 using 2 nibbles (hexadecimal digits).
Decimal encoding of a Word using the ASCII digits.
Shortest hexadecimal encoding of a Word using lower-case characters.
Create a Builder denoting the same sequence of bytes as a StrictByteString. The Builder inserts large StrictByteStrings directly, but copies small ones to ensure that the generated chunks are large on average.
Create a Builder denoting the same sequence of bytes as a lazy LazyByteString. The Builder inserts large chunks of the LazyByteString directly, but copies small ones to ensure that the generated chunks are large on average.
Construct a Builder that copies the SH.ShortByteString.
Execute a Builder and return the generated chunks as a LazyByteString. The work is performed lazy, i.e., only when a chunk of the LazyByteString is forced.
Char8 encode a Char.
UTF-8 encode a Char.
Char7 encode a Char.
Encode a Double in big endian format.
Encode a Double in little endian format.
Encode a Float in big endian format.
Encode a Float in little endian format.
Encode an Int16 in big endian format.
Encode an Int16 in little endian format.
Encode an Int32 in big endian format.
Encode an Int32 in little endian format.
Encode an Int64 in big endian format.
Encode an Int64 in little endian format.
Encode a single signed byte as-is.
Encode a Word16 in big endian format.
Encode a Word16 in little endian format.
Encode a Word32 in big endian format.
Encode a Word32 in little endian format.
Encode a Word64 in big endian format.
Encode a Word64 in little endian format.
Encode a single unsigned byte as-is.
Format type for use with formatFloat and formatDouble.
Returns a rendered Double. Matches show in displaying in standard or scientific notation
doubleDec = formatDouble generic
Returns a rendered Float. Matches show in displaying in standard or scientific notation
floatDec = formatFloat generic
Returns a rendered Double. Returns the 'shortest' representation in scientific notation and takes an optional precision argument in standard notation. Also see doubleDec.
With standard notation, the precision argument is used to truncate (or extend with 0s) the 'shortest' rendered Float. The 'default precision' does no such modifications and will return as many decimal places as the representation demands.
e.g
formatDouble (standard 1) 1.2345e-2"0.0"formatDouble (standard 10) 1.2345e-2"0.0123450000"formatDouble standardDefaultPrecision 1.2345e-2"0.01234"formatDouble scientific 12.345"1.2345e1"formatDouble generic 12.345"12.345"
Returns a rendered Float. Returns the 'shortest' representation in scientific notation and takes an optional precision argument in standard notation. Also see floatDec.
With standard notation, the precision argument is used to truncate (or extend with 0s) the 'shortest' rendered Float. The 'default precision' does no such modifications and will return as many decimal places as the representation demands.
e.g
formatFloat (standard 1) 1.2345e-2"0.0"formatFloat (standard 10) 1.2345e-2"0.0123450000"formatFloat standardDefaultPrecision 1.2345e-2"0.01234"formatFloat scientific 12.345"1.2345e1"formatFloat generic 12.345"12.345"
Standard or scientific notation depending on the exponent. Matches show
Standard notation with n decimal places
Standard notation with the 'default precision' (decimal places matching show)
Char8 encode a String.
UTF-8 encode a String.
Note that stringUtf8 performs no codepoint validation and consequently may emit invalid UTF-8 if asked (e.g. single surrogates).
Output a Builder to a Handle. The Builder is executed directly on the buffer of the Handle. If the buffer is too small (or not present), then it is replaced with a large enough buffer.
It is recommended that the Handle is set to binary and
System.IO.BlockBuffering mode. See System.IO.hSetBinaryMode and
System.IO.hSetBuffering.
This function is more efficient than hPut . toLazyByteString because in
many cases no buffer allocation has to be done. Moreover, the results of
several executions of short Builders are concatenated in the Handles
buffer, therefore avoiding unnecessary buffer flushes.
Char7 encode a String.
Write a Builder to a file.
Similarly to hPutBuilder, this function is more efficient than using hPut . toLazyByteString with a file handle.