matrix-as-xyz-0.1.2.2: Read and Display Jones-Faithful notation for spacegroup and planegroup

Copyright(c) Jun Narumi 2018
LicenseBSD3
Maintainernarumij@gmail.com
Stabilityexperimental
Portability?
Safe HaskellSafe
LanguageHaskell2010

Data.Ratio.ParseFloat

Description

Floating point parser

Temporary solution to the problem below

ghci> realToFrac (read "1.1" :: Double) :: Rational
2476979795053773 % 2251799813685248
Synopsis

Documentation

readFloatingPoint :: Integral a => String -> Ratio a Source #

Obtain fractions from floating point representation string

>>> readFloatingPoint "1.1"
11 % 10
>>> readFloatingPoint "0.5"
1 % 2
>>> readFloatingPoint ".5"
1 % 2
>>> readFloatingPoint "10."
10 % 1
>>> readFloatingPoint "10"
10 % 1
>>> readFloatingPoint "10.2"
51 % 5
>>> readFloatingPoint "1e-1"
1 % 10
>>> readFloatingPoint "-0.5e-1"
(-1) % 20
>>> readFloatingPoint "5e2"
500 % 1
>>> readFloatingPoint "5e+2"
500 % 1

floating :: Integral a => CharParser () (Ratio a) Source #

Parser section