packages feed

fixed 0.2.1 → 0.2.1.1

raw patch · 5 files changed

+66/−38 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Numeric.Fixed: getFixed :: Fixed -> CInt
- Numeric.Fixed: instance Bounded Fixed
- Numeric.Fixed: instance Enum Fixed
- Numeric.Fixed: instance Eq Fixed
- Numeric.Fixed: instance Floating Fixed
- Numeric.Fixed: instance Fractional Fixed
- Numeric.Fixed: instance Num Fixed
- Numeric.Fixed: instance Ord Fixed
- Numeric.Fixed: instance Real Fixed
- Numeric.Fixed: instance RealFloat Fixed
- Numeric.Fixed: instance RealFrac Fixed
- Numeric.Fixed: instance Show Fixed
- Numeric.Fixed: instance Storable Fixed
- Numeric.Fixed: instance Typeable Fixed
+ Numeric.Fixed: [getFixed] :: Fixed -> CInt
+ Numeric.Fixed: instance Foreign.Storable.Storable Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Classes.Eq Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Classes.Ord Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Enum.Bounded Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Enum.Enum Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Float.Floating Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Float.RealFloat Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Num.Num Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Real.Fractional Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Real.Real Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Real.RealFrac Numeric.Fixed.Fixed
+ Numeric.Fixed: instance GHC.Show.Show Numeric.Fixed.Fixed

Files

.travis.yml view
@@ -1,49 +1,55 @@-language: haskell+# NB: don't set `language: haskell` here +# See also https://github.com/hvr/multi-ghc-travis for more information env:-  - GHCVER=7.8.3-  - GHCVER=head+ # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's+ # no package for earlier cabal versions in the PPA+ - GHCVER=7.4.2 CABALVER=1.16+ - GHCVER=7.6.3 CABALVER=1.16+ - GHCVER=7.8.4 CABALVER=1.18+ - GHCVER=7.10.1 CABALVER=1.22+ - GHCVER=head CABALVER=1.22  matrix:   allow_failures:-    - env: GHCVER=head+   - env: GHCVER=head CABALVER=1.22 +# Note: the distinction between `before_install` and `install` is not+#       important. before_install:-  # If $GHCVER is the one travis has, don't bother reinstalling it.-  # We can also have faster builds by installing some libraries with-  # `apt`. If it isn't, install the GHC we want from hvr's PPA along-  # with cabal-1.18.-  - |-    if [ $GHCVER = `ghc --numeric-version` ]; then-      # Try installing some of the build-deps with apt-get for speed.-      travis/cabal-apt-install --enable-tests $MODE-      export CABAL=cabal-    else-      # Install the GHC we want from hvr's PPA-      travis_retry sudo add-apt-repository -y ppa:hvr/ghc-      travis_retry sudo apt-get update-      travis_retry sudo apt-get install cabal-install-1.18 ghc-$GHCVER happy-      export CABAL=cabal-1.18-      export PATH=/opt/ghc/$GHCVER/bin:$PATH-    fi-  # Uncomment whenever hackage is down.-  # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && $CABAL update-  - $CABAL update--  # Update happy when building with GHC head-  - |-    if [ $GHCVER = "head" ] || [ $GHCVER = "7.8.3" ]; then-      $CABAL install happy alex-      export PATH=$HOME/.cabal/bin:$PATH-    fi+ - travis_retry sudo add-apt-repository -y ppa:hvr/ghc+ - travis_retry sudo apt-get update+ - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH+ - cabal --version  install:-  - $CABAL install --dependencies-only --enable-tests-  - $CABAL configure --enable-tests $MODE+ - travis_retry cabal update+ - cabal install --only-dependencies +# Here starts the actual work to be performed for the package under+# test; any command which exits with a non-zero exit code causes the+# build to fail. script:-  - $CABAL build-  - $CABAL test --show-details=always+ # -v2 provides useful information for debugging+ - cabal configure -v2++ # this builds all libraries and executables+ # (including tests/benchmarks)+ - cabal build++ # tests that a source-distribution can be generated+ - cabal sdist++ # check that the generated source-distribution can be built & installed+ - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;+   cd dist/;+   if [ -f "$SRC_TGZ" ]; then+      cabal install --force-reinstalls "$SRC_TGZ";+   else+      echo "expected '$SRC_TGZ' not found";+      exit 1;+   fi  notifications:   irc:
CHANGELOG.markdown view
@@ -1,3 +1,9 @@+0.2.1.1+-------+* Minor documentation improvements.+* Require `base >= 4.7` properly in the source repository as the implementation uses `coerce`, so it doesn't work on GHC < 7.8.+  This was fixed by maintenance releases to hackage previously.+ 0.2.1 ----- * Fixed bug in `signum`
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2014 Edward Kmett+Copyright 2014-2015 Edward Kmett  All rights reserved. 
fixed.cabal view
@@ -1,6 +1,6 @@ name:          fixed category:      Numeric-version:       0.2.1+version:       0.2.1.1 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -27,6 +27,6 @@  library   hs-source-dirs: src-  build-depends: base >= 4 && < 5+  build-depends: base >= 4.7 && < 5   ghc-options: -Wall -fwarn-tabs -O2   exposed-modules: Numeric.Fixed
src/Numeric/Fixed.hs view
@@ -1,4 +1,18 @@ {-# LANGUAGE CApiFFI, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}+-----------------------------------------------------------------------------+-- |+-- Copyright   :  (C) 2014-15 Edward Kmett+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  experimental+-- Portability :  non-portable+--+-- Fixed precision arithmetic. This format is the same format used by+-- OpenGL ES 1's @GLfixed@ data type:+--+-- One sign bit, 15 bits to the left of the decimal place and 16 bits+-- to the right packed into a 32-bit integer.+----------------------------------------------------------------------------- module Numeric.Fixed    ( Fixed(..)   , fromFixed@@ -16,9 +30,11 @@ -- | A signed 2s complement 15.16 scale fixed precision number newtype {-# CTYPE "signed int" #-} Fixed = Fixed { getFixed :: CInt } deriving (Eq,Ord,Typeable,Storable) +-- | Convert from a 'Fixed' precision value to a 'Double' fromFixed :: Fixed -> Double fromFixed (Fixed x) = fromIntegral x / 65536 +-- | Convert from a 'Double' to a 'Fixed' precision value toFixed :: Double -> Fixed toFixed x = Fixed $ floor (x * 65536 + 0.5)