fptest 0.2.2.0 → 0.2.3.0
raw patch · 4 files changed
+65/−60 lines, 4 filesdep ~HUnitdep ~QuickCheckdep ~base
Dependency ranges changed: HUnit, QuickCheck, base, parsec3-numbers
Files
- README.md +12/−5
- fptest.cabal +45/−45
- src/FPParse.hs +2/−4
- src/FPTypes.hs +6/−6
README.md view
@@ -4,7 +4,8 @@ There are two sets of tests so far: -##QTrial##+## QTrial ##+ **QTrial** is the floating point benchmark described in *IEEE Standard 754 for Binary Floating-Point Arithmetic* by Prof. W. Kahan [Download link](http://www.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF) You should just be able to `cabal run qtrial` from the main directory or `runhaskell QTrial.hs` from `src`.@@ -56,9 +57,7 @@ This is fine for the Float cases, but the test illustrates an issue with the Double case that is the subject of [this ticket](https://ghc.haskell.org/trac/ghc/ticket/9534). -##FPTest##--** FPTest is being refactored so that it can be run in cabal **+## FPTest ## **FPTest** runs a sequence of floating point test vectors generated by IBM's [FPGen Floating-Point Test Generator](https://www.research.ibm.com/haifa/projects/verification/fpgen/), which@@ -84,7 +83,7 @@ and 'strtod' libraries, the spare 0 sits to the right (so the 23-bit significand 'f' is *left* justified in the 24-bit hexadecimal representation). The IBM representation *right* justifies the 23 bits of significand in the 24-bit hexadecimal representation; the first hexadecimal digit of the significand represents 3 bits.-The IBM representation also has a fixed format, including trailing zeros.+The IBM representation also has a fixed length format, including trailing zeros. Some test vectors also uses lower case versions of certain specification elements. @@ -108,3 +107,11 @@ There is not a great deal of point in testing some of these facilities from Haskell; where they are accessible it would just be testing an underlying C library, which it might be better to to directly.+++## Other tests ##++* [FBench](https://www.fourmilab.ch/fbench/) by John Walker, founder of AutoDeck, Inc + is a complete optical design raytracing algorithm, shorn of its user interface.+ The benchmark, which has been going since 1980 has been ported from C to a variety of languages,+ including [Haskell](http://www.fourmilab.ch/fourmilog/archives/2012-09/001395.html)
fptest.cabal view
@@ -6,37 +6,37 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.2.0+version: 0.2.3.0 synopsis: IEEE754r floating point conformance tests description: A series of floating point conformance tests for Haskell. - Currently implemented are:+ Currently implemented are: - QTrial, the floating point benchmark described in / IEEE Standard 754 for Binary Floating-Point- Arithmetic / by Prof. W. Kahan <http://www.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF>+ QTrial, the floating point benchmark described in / IEEE Standard 754 for Binary Floating-Point+ Arithmetic / by Prof. W. Kahan <http://www.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF> - This can be run with a simple @cabal run qtrial@.+ This can be run with a simple @cabal run qtrial@. - - FPTest runs a sequence of floating point test vectors generated by IBM's- <https://www.research.ibm.com/haifa/projects/verification/fpgen/ FPGen Floating-Point Test Generator>.+ + FPTest runs a sequence of floating point test vectors generated by IBM's+ <https://www.research.ibm.com/haifa/projects/verification/fpgen/ FPGen Floating-Point Test Generator>. - This is done either by interpreting the tests or by translating the tests- into a Haskell HUnit test suite script that can just be executed using- @runhaskell@.+ This is done either by interpreting the tests or by translating the tests+ into a Haskell HUnit test suite script that can just be executed using+ @runhaskell@. - The IBM test vectors are available from- <https://www.research.ibm.com/haifa/projects/verification/fpgen/ here>.+ The IBM test vectors are available from+ <https://www.research.ibm.com/haifa/projects/verification/fpgen/ here>. - You will, most likely, want the binary tests unless you have a decimal machine.- Only 32-bit float tests are provided (not 64-bit double ones) although FPTest supports Doubles.+ You will, most likely, want the binary tests unless you have a decimal machine.+ Only 32-bit float tests are provided (not 64-bit double ones) although FPTest supports Doubles. - The syntax of the test vectors can be found - <https://www.research.ibm.com/haifa/projects/verification/fpgen/syntax.txt here> or in Chapter 4- <https://www.research.ibm.com/haifa/projects/verification/fpgen/papers/ieee-test-suite-v2.pdfs- Floating-Point Test-Suite for IEEE here>+ The syntax of the test vectors can be found + <https://www.research.ibm.com/haifa/projects/verification/fpgen/syntax.txt here> or in Chapter 4+ <https://www.research.ibm.com/haifa/projects/verification/fpgen/papers/ieee-test-suite-v2.pdfs+ Floating-Point Test-Suite for IEEE here> homepage: https://github.com/jrp2014/fptest @@ -48,18 +48,18 @@ maintainer: jrp@dial.pipex.com -bug-reports: https://github.com/jrp2014/fptest/issues+bug-reports: https://github.com/jrp2014/fptest/issues -stability: alpha+stability: alpha -copyright: 2014 John Pavel and 2004 IBM Corp+copyright: 2014, 2018 John Pavel and 2004 IBM Corp category: Math -tested-with: GHC ==7.8.3+tested-with: GHC ==7.8.3 -data-files: *.fptest-data-dir: test_suite+data-files: *.fptest+data-dir: test_suite build-type: Simple @@ -68,43 +68,43 @@ cabal-version: >=1.10 source-repository head- type: git- location: https://github.com/jrp2014/fptest.git- branch: master+ type: git+ location: https://github.com/jrp2014/fptest.git+ branch: master executable qtrial main-is: QTrial.hs- build-depends: base >=4.7 && <4.8, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.3, parsec3-numbers >=0.0 && <0.1, QuickCheck >=2.7 && <2.8, test-framework-quickcheck2 >=0.3 && <0.4+ build-depends: base >=4.7 && <5, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.7, parsec3-numbers >=0.0 && <0.2, QuickCheck >=2.7 && <3, test-framework-quickcheck2 >=0.3 && <0.4 hs-source-dirs: src- ghc-options: -Wall -fno-warn-missing-signatures+ ghc-options: -Wall -fno-warn-missing-signatures default-language: Haskell2010 executable fptest- build-depends: base >=4.7 && <4.8, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.3, parsec3-numbers >=0.0 && <0.1, QuickCheck >=2.7 && <2.8, test-framework-quickcheck2 >=0.3 && <0.4- main-is: FPMain.hs- hs-source-dirs: src- ghc-options: -Wall- other-modules: FPTypes, FPParse, FPRun+ build-depends: base >=4.7 && <5, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.7, parsec3-numbers >=0.0 && <0.2, QuickCheck >=2.7 && <3, test-framework-quickcheck2 >=0.3 && <0.4+ main-is: FPMain.hs+ hs-source-dirs: src+ ghc-options: -Wall+ other-modules: FPTypes, FPParse, FPRun default-language: Haskell2010 -- TODO:: put these tests into a separate test file test-suite qtrial-quickcheck- build-depends: base >=4.7 && <4.8, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.3, parsec3-numbers >=0.0 && <0.1, QuickCheck >=2.7 && <2.8, test-framework-quickcheck2 >=0.3 && <0.4+ build-depends: base >=4.7 && <5, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.7, parsec3-numbers >=0.0 && <0.2, QuickCheck >=2.7 && <3, test-framework-quickcheck2 >=0.3 && <0.4 - default-language: Haskell2010- hs-source-dirs: src- main-is: QTrial.hs- type: exitcode-stdio-1.0+ default-language: Haskell2010+ hs-source-dirs: src+ main-is: QTrial.hs+ type: exitcode-stdio-1.0 test-suite fptest-quickcheck- build-depends: base >=4.7 && <4.8, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.3, parsec3-numbers >=0.0 && <0.1, QuickCheck >=2.7 && <2.8, test-framework-quickcheck2 >=0.3 && <0.4+ build-depends: base >=4.7 && <5, parsec >=3.1 && <3.2, test-framework >=0.8 && <0.9, test-framework-hunit >=0.3 && <0.4, HUnit >=1.2 && <1.7, parsec3-numbers >=0.0 && <0.2, QuickCheck >=2.7 && <3, test-framework-quickcheck2 >=0.3 && <0.4 - default-language: Haskell2010- hs-source-dirs: test src- main-is: FPTestTest.hs- type: exitcode-stdio-1.0+ default-language: Haskell2010+ hs-source-dirs: test src+ main-is: FPTestTest.hs+ type: exitcode-stdio-1.0 test-suite doctest build-depends: base, doctest, Glob
src/FPParse.hs view
@@ -88,11 +88,9 @@ formatSpec = try (do f1 <- basicFormatSpec- f2 <- basicFormatSpec- return (ComparisonFormat f1 f2)) <|>+ ComparisonFormat f1 <$> basicFormatSpec) <|> do- f <- basicFormatSpec- return (BasicFormat f)+ BasicFormat <$> basicFormatSpec basicFormatSpec :: GenParser Char st BasicFormat basicFormatSpec = binarySpec <|> decimalSpec
src/FPTypes.hs view
@@ -89,7 +89,7 @@ data Format = BasicFormat BasicFormat | ComparisonFormat BasicFormat BasicFormat deriving (Show, Eq) -instance Display (Format) where+instance Display Format where display (BasicFormat bf) = display bf display (ComparisonFormat bf1 bf2) = display bf1 ++ display bf2 @@ -102,7 +102,7 @@ data BasicFormat = Binary32 | Binary64 | Binary128 | Decimal32 | Decimal64 | Decimal128 deriving (Show, Eq) -instance Display (BasicFormat) where+instance Display BasicFormat where display Binary32 = "b32" display Binary64 = "b64" display Binary128 = "b128"@@ -129,7 +129,7 @@ {- | For the moment, 'display' the 'Operation' in Haskell format as it is less cryptic than the native test specification format -}-instance Display (Operation) where+instance Display Operation where display = show {- display Add = "+" display Subtract = "-"@@ -178,7 +178,7 @@ data RoundingMode = PositiveInfinity | NegativeInfinity | Zero | NearestEven | NearestAwayFromZero deriving (Show, Eq) -instance Display (RoundingMode) where+instance Display RoundingMode where display PositiveInfinity = ">" display NegativeInfinity = "<" display Zero = "0"@@ -190,7 +190,7 @@ data TrappedException = TrappedInexact | TrappedUnderflow | TrappedOverflow | TrappedDivisionByZero | TrappedInvalid deriving (Show, Eq) -instance Display (TrappedException) where+instance Display TrappedException where display TrappedInexact = "x" display TrappedUnderflow = "u" display TrappedOverflow = "o"@@ -203,7 +203,7 @@ ExtraordinaryUnderflow | InexactTinyUnderflow | TinyInexactUnderflow | Overflow | DivisionByZero | Invalid deriving (Show, Eq) -instance Display (Exception) where+instance Display Exception where display Inexact = "x" display ExtraordinaryUnderflow = "u" display InexactTinyUnderflow = "v"