fixed 0.2.1.1 → 0.3
raw patch · 5 files changed
+11/−9 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Numeric.Fixed: newtype Fixed
+ Numeric.Fixed: newtype {-# CTYPE "signed int" #-} Fixed
Files
- .travis.yml +0/−2
- CHANGELOG.markdown +4/−0
- README.markdown +1/−1
- fixed.cabal +2/−2
- src/Numeric/Fixed.hs +4/−4
.travis.yml view
@@ -4,8 +4,6 @@ env: # 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
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.3+---+* Fixed an outstanding bug in round.+ 0.2.1.1 ------- * Minor documentation improvements.
README.markdown view
@@ -1,7 +1,7 @@ fixed ==== -[](http://travis-ci.org/ekmett/fixed)+[](https://hackage.haskell.org/package/fixed) [](http://travis-ci.org/ekmett/fixed) This package supplies signed fixed-precision values 15 bits above the decimal, 16 bits below.
fixed.cabal view
@@ -1,6 +1,6 @@ name: fixed category: Numeric-version: 0.2.1.1+version: 0.3 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -9,7 +9,7 @@ stability: provisional homepage: http://github.com/ekmett/fixed bug-reports: http://github.com/ekmett/fixed/issues-copyright: Copyright (C) 2014 Edward A. Kmett+copyright: Copyright (C) 2014-2015 Edward A. Kmett build-type: Simple tested-with: GHC == 7.8.3 synopsis: Signed 15.16 precision fixed point arithmetic
src/Numeric/Fixed.hs view
@@ -13,7 +13,7 @@ -- 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 +module Numeric.Fixed ( Fixed(..) , fromFixed , toFixed@@ -72,13 +72,13 @@ toRational (Fixed i) = toInteger i % 65536 instance RealFrac Fixed where- properFraction (Fixed a) + properFraction (Fixed a) | a >= 0 = (fromIntegral (unsafeShiftR a 16), Fixed (a .&. 0xffff)) | otherwise = (negate $ fromIntegral $ unsafeShiftR (negate a) 16, Fixed $ (a .&. 0xffff) - 0x10000)- truncate (Fixed a) + truncate (Fixed a) | a >= 0 = fromIntegral (unsafeShiftR a 16) | otherwise = negate $ fromIntegral $ unsafeShiftR (negate a) 16- round (Fixed f) = fromIntegral $ unsafeShiftR (f + 0x800) 16 + round (Fixed f) = fromIntegral $ unsafeShiftR (f + 0x8000) 16 ceiling (Fixed f) = fromIntegral $ unsafeShiftR (f + 0xffff) 16 floor (Fixed f) = fromIntegral $ unsafeShiftR f 16