From 71c593388559e4d6963fdbbd1ed57908e7ce62ef Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Wed, 12 Jun 2019 20:20:41 -0400 Subject: crayne: Support scientific notation. --- src/Wavefront.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Wavefront.hs b/src/Wavefront.hs index d53c786..de9cb21 100644 --- a/src/Wavefront.hs +++ b/src/Wavefront.hs @@ -189,13 +189,13 @@ nextToken :: (L.ByteString -> L.ByteString) -> L.ByteString -> L.ByteString nextToken tok bs = tok $ L.dropWhile (not . isSpace) bs parseFloats tok bs cont = case L.splitAt 10 (tok bs) of - (ds,bs') -> case F.readSigned F.readDecimal (L.toStrict ds) of + (ds,bs') -> case F.readSigned F.readExponential (L.toStrict ds) of Just (x,b) -> parseFloats tok (reconsChunk b bs') (cont . (x :)) Nothing -> cont [] bs parseFloatsN 0 _ bs cont = cont [] bs parseFloatsN n tok bs cont = case L.splitAt 10 (tok bs) of - (ds,bs') -> case F.readSigned F.readDecimal (L.toStrict ds) of + (ds,bs') -> case F.readSigned F.readExponential (L.toStrict ds) of Just (x,b) -> parseFloatsN (n-1) tok (reconsChunk b bs') (cont . (x :)) Nothing -> cont [] bs -- cgit v1.2.3