diff options
author | Joe Crayne <joe@jerkface.net> | 2019-06-12 20:20:41 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-06-12 20:20:41 -0400 |
commit | 71c593388559e4d6963fdbbd1ed57908e7ce62ef (patch) | |
tree | f9ccb8a6fe03c4d2664854ea126fb330174a1406 | |
parent | 500a6ca99eb5b878a4d79706d48f776d2bd2b450 (diff) |
crayne: Support scientific notation.
-rw-r--r-- | src/Wavefront.hs | 4 |
1 files 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 | |||
189 | nextToken tok bs = tok $ L.dropWhile (not . isSpace) bs | 189 | nextToken tok bs = tok $ L.dropWhile (not . isSpace) bs |
190 | 190 | ||
191 | parseFloats tok bs cont = case L.splitAt 10 (tok bs) of | 191 | parseFloats tok bs cont = case L.splitAt 10 (tok bs) of |
192 | (ds,bs') -> case F.readSigned F.readDecimal (L.toStrict ds) of | 192 | (ds,bs') -> case F.readSigned F.readExponential (L.toStrict ds) of |
193 | Just (x,b) -> parseFloats tok (reconsChunk b bs') (cont . (x :)) | 193 | Just (x,b) -> parseFloats tok (reconsChunk b bs') (cont . (x :)) |
194 | Nothing -> cont [] bs | 194 | Nothing -> cont [] bs |
195 | 195 | ||
196 | parseFloatsN 0 _ bs cont = cont [] bs | 196 | parseFloatsN 0 _ bs cont = cont [] bs |
197 | parseFloatsN n tok bs cont = case L.splitAt 10 (tok bs) of | 197 | parseFloatsN n tok bs cont = case L.splitAt 10 (tok bs) of |
198 | (ds,bs') -> case F.readSigned F.readDecimal (L.toStrict ds) of | 198 | (ds,bs') -> case F.readSigned F.readExponential (L.toStrict ds) of |
199 | Just (x,b) -> parseFloatsN (n-1) tok (reconsChunk b bs') (cont . (x :)) | 199 | Just (x,b) -> parseFloatsN (n-1) tok (reconsChunk b bs') (cont . (x :)) |
200 | Nothing -> cont [] bs | 200 | Nothing -> cont [] bs |
201 | 201 | ||