packages feed

double-conversion 2.0.1.0 → 2.0.2.0

raw patch · 8 files changed

+60/−21 lines, 8 filesdep +HUnitdep +test-framework-hunitdep −integerdep −integer-gmpPVP ok

version bump matches the API change (PVP)

Dependencies added: HUnit, test-framework-hunit

Dependencies removed: integer, integer-gmp

API changes (from Hackage documentation)

Files

README.markdown view
@@ -3,7 +3,7 @@ double-conversion is a fast Haskell library for converting between double precision floating point numbers and text strings.  It is implemented as a binding to the V8-derived C++ [double-conversion-library](http://code.google.com/p/double-conversion/).+library](https://github.com/floitsch/double-conversion).  # Join in! 
benchmarks/Benchmarks.hs view
@@ -3,7 +3,7 @@ import Criterion.Main import qualified Data.Double.Conversion.ByteString as B import qualified Data.Double.Conversion.Text as T-import Foreign.C.Types (CInt, CDouble)+import Foreign.C.Types (CInt(CInt), CDouble(CDouble)) import qualified Data.Text as T import qualified Text.Show.ByteString as BS 
cbits/hs-double-conversion.cc view
@@ -4,7 +4,7 @@  using namespace double_conversion; -static const int kToShortestLength = 24;+static const int kToShortestLength = 26;  extern "C" int _hs_ToShortestLength(void)
double-conversion.cabal view
@@ -1,5 +1,5 @@ name:           double-conversion-version:        2.0.1.0+version:        2.0.2.0 license:        BSD3 license-file:   LICENSE homepage:       https://github.com/bos/double-conversion@@ -17,7 +17,7 @@     .     This library is implemented as bindings to the C++     @double-conversion@ library written by Florian Loitsch at Google:-    <http://code.google.com/p/double-conversion/>.+    <https://github.com/floitsch/double-conversion>.     .     The 'Text' versions of these functions are about 30 times faster     than the default 'show' implementation for the 'Double' type.@@ -71,7 +71,16 @@     double-conversion/src/fixed-dtoa.cc     double-conversion/src/strtod.cc -  extra-libraries: stdc+++  if os(windows)+    if arch(x86_64)+      extra-libraries: stdc++-6 gcc_s_seh-1+    else+      extra-libraries: stdc++-6 gcc_s_dw2-1+  else+    if os(darwin)+      extra-libraries: c+++    else+      extra-libraries: stdc++    include-dirs:     double-conversion/src@@ -98,24 +107,19 @@    ghc-options: -Wall -  cpp-options: -DINTEGER_GMP--  if impl(ghc >= 6.11)-    build-depends: integer-gmp >= 0.2--  if impl(ghc >= 6.9) && impl(ghc < 6.11)-    build-depends: integer >= 0.1 && < 0.2- test-suite tests   type: exitcode-stdio-1.0   hs-source-dirs: tests   main-is: Properties.hs+  other-modules: Regressions   ghc-options: -Wall   build-depends:+    HUnit,     base,     bytestring,     double-conversion,     test-framework,+    test-framework-hunit,     test-framework-quickcheck2,     text 
double-conversion/src/double-conversion.cc view
@@ -494,10 +494,17 @@ // because it constant-propagated the radix and concluded that the last // condition was always true. By moving it into a separate function the // compiler wouldn't warn anymore.+#if _MSC_VER+#pragma optimize("",off) static bool IsDecimalDigitForRadix(int c, int radix) {   return '0' <= c && c <= '9' && (c - '0') < radix; }-+#pragma optimize("",on)+#else+static bool inline IsDecimalDigitForRadix(int c, int radix) {+	return '0' <= c && c <= '9' && (c - '0') < radix;+}+#endif // Returns true if 'c' is a character digit that is valid for the given radix. // The 'a_character' should be 'a' or 'A'. //
double-conversion/src/utils.h view
@@ -58,10 +58,11 @@     defined(__hppa__) || defined(__ia64__) || \     defined(__mips__) || \     defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \+    defined(_POWER) || defined(_ARC_PPC) || \     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \     defined(__SH4__) || defined(__alpha__) || \     defined(_MIPS_ARCH_MIPS32R2) || \-    defined(__AARCH64EL__)+    defined(__AARCH64EL__) || defined(__aarch64__) #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #elif defined(__mc68000__) #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
tests/Properties.hs view
@@ -1,9 +1,10 @@-import Test.Framework (defaultMain)+import Test.Framework (Test, defaultMain, testGroup) import Test.Framework.Providers.QuickCheck2 (testProperty) import qualified Data.ByteString.Char8 as B import qualified Data.Double.Conversion.ByteString as B import qualified Data.Double.Conversion.Text as T import qualified Data.Text as T+import qualified Regressions  shortest :: (Double -> String) -> Double -> Double -> Bool shortest f a b = case read (f ab) of@@ -12,8 +13,11 @@                       | otherwise     -> ba == ab   where ab = a / b +tests :: Test+tests = testGroup "Properties" [+    testProperty "b_shortest" $ shortest (B.unpack . B.toShortest)+  , testProperty "t_shortest" $ shortest (T.unpack . T.toShortest)+  ]+ main :: IO ()-main = defaultMain [-         testProperty "b_shortest" $ shortest (B.unpack . B.toShortest)-       , testProperty "t_shortest" $ shortest (T.unpack . T.toShortest)-       ]+main = defaultMain [tests, Regressions.tests]
+ tests/Regressions.hs view
@@ -0,0 +1,23 @@+module Regressions+    (+      tests+    ) where++import Data.Double.Conversion.Text (toShortest)+import Test.HUnit (Assertion, assertEqual)+import Data.Text (unpack)+import Numeric (showFFloat)+import qualified Test.Framework as F+import qualified Test.Framework.Providers.HUnit as F++toShortest_overflow :: Assertion+toShortest_overflow = do+  let val = -2.9658956854023756e-5+  assertEqual "rendering a long number doesn't crash"+              (showFFloat Nothing val "") (unpack (toShortest val))++tests :: F.Test+tests = F.testGroup "Regressions"+  [+    F.testCase "toShortest_overflow" toShortest_overflow+  ]