half 0.2.0.1 → 0.2.1
raw patch · 5 files changed
+19/−12 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- .travis.yml +1/−3
- CHANGELOG.markdown +4/−0
- README.markdown +1/−1
- half.cabal +1/−1
- src/Numeric/Half.hs +12/−7
.travis.yml view
@@ -1,8 +1,6 @@ language: haskell env:- - GHCVER=7.4.2- - GHCVER=7.6.3 - GHCVER=7.8.3 - GHCVER=head @@ -53,4 +51,4 @@ - "irc.freenode.org#haskell-lens" skip_join: true template:- - "\x0313gl\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"+ - "\x0313half\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.2.1+-----+* Removed need for `GeneralizedNewtypeDeriving` and `ScopedTypeVariables`.+ 0.2.0.1 ------- * Fixed source repository location
README.markdown view
@@ -1,7 +1,7 @@ half ==== -[](http://travis-ci.org/ekmett/half)+[](https://hackage.haskell.org/package/half) [](http://travis-ci.org/ekmett/half) This package supplies half-precision floating point values w/ 1 bit of sign, 5 bits of exponent, 11 bits of mantissa trailing a leading 1 bit with proper underflow.
half.cabal view
@@ -1,6 +1,6 @@ name: half category: Numeric-version: 0.2.0.1+version: 0.2.1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE
src/Numeric/Half.hs view
@@ -1,7 +1,5 @@ {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveDataTypeable #-} ----------------------------------------------------------------------------- -- |@@ -38,6 +36,7 @@ import Data.Function (on) import Data.Typeable import Foreign.C.Types+import Foreign.Ptr (castPtr) import Foreign.Storable import Text.Read @@ -49,8 +48,14 @@ foreign import ccall unsafe "hs_halfToFloat" fromHalf :: Half -> Float -- {-# RULES "fromHalf" realToFrac = fromHalf #-} -newtype {-# CTYPE "unsigned short" #-} Half = Half { getHalf :: CUShort } deriving (Storable, Typeable)+newtype {-# CTYPE "unsigned short" #-} Half = Half { getHalf :: CUShort } deriving (Typeable) +instance Storable Half where+ sizeOf = sizeOf . getHalf+ alignment = alignment . getHalf+ peek = peek . castPtr+ poke p = poke (castPtr p) . getHalf+ instance Show Half where showsPrec d h = showsPrec d (fromHalf h) @@ -132,16 +137,16 @@ pattern SNaN = Half 0x7dff -- | Smallest positive half-pattern HALF_MIN = 5.96046448e-08 :: Half +pattern HALF_MIN = Half 0x0001 -- 5.96046448e-08 -- | Smallest positive normalized half-pattern HALF_NRM_MIN = 6.10351562e-05 :: Half+pattern HALF_NRM_MIN = Half 0x0400 -- 6.10351562e-05 -- | Largest positive half-pattern HALF_MAX = 65504.0 :: Half+pattern HALF_MAX = Half 0x7bff -- 65504.0 -- | Smallest positive e for which half (1.0 + e) != half (1.0)-pattern HALF_EPSILON = 0.00097656 :: Half+pattern HALF_EPSILON = Half 0x1400 -- 0.00097656 -- | Number of base 10 digits that can be represented without change pattern HALF_DIG = 2