dataframe-parsing-1.0.2.1: Shared text/binary parsing helpers for the dataframe ecosystem.
Safe HaskellNone
LanguageHaskell2010

DataFrame.Internal.Parsing.Fast.Double

Description

Fast Double slice parser, BIT-EXACT with readByteStringDouble (bytestring-lexing's readSigned readDecimal/readExponential).

Instead of replaying the reference parser's Integer-mantissa chain, the fast path replays its exact floating-point operation sequence (fromInteger whole + fromInteger part / 10^k, then * 10^^e) using Word64 digit accumulation and tables of 10 ^ k / recip (10 ^ k) built with the very same (^)/recip calls. Whenever a component exceeds the 19-significant-digit Word64 window (or the exponent could wrap Int), exactness is in doubt and we fall back to the reference parser on the raw slice.

Synopsis

Documentation

parseDoubleField# :: ByteString -> Int -> Int -> (# Int#, Double# #) Source #

Result is (# ok, value #) with ok 0 or 1. Caller guarantees 0 <= start <= end <= length buf.