-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
414 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h -optP-Iincludes | ||
:set -v0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
dist | ||
docs | ||
wiki | ||
TAGS | ||
tags | ||
wip | ||
contrib | ||
.DS_Store | ||
.*.swp | ||
.*.swo | ||
*.o | ||
*.hi | ||
.svn | ||
*~ | ||
*# | ||
Makefile | ||
Makefile.in | ||
aclocal.m4 | ||
analytics.buildinfo | ||
autom4te.cache | ||
autoscan.log | ||
config.log | ||
config.guess | ||
config.status | ||
config.sub | ||
config.h | ||
config.h.in | ||
configure | ||
configure.scan | ||
depcomp | ||
install-sh | ||
missing | ||
www | ||
stamp-h1 | ||
config.h.in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: haskell | ||
before_install: | ||
# Uncomment whenever hackage is down. | ||
# - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && cabal update | ||
- cabal update | ||
|
||
# Try installing some of the build-deps with apt-get for speed. | ||
- travis/cabal-apt-install $mode | ||
|
||
install: | ||
- cabal configure -flib-Werror $mode | ||
- cabal build | ||
|
||
script: | ||
- $script && hlint src --cpp-define HLINT | ||
|
||
notifications: | ||
irc: | ||
channels: | ||
- "irc.freenode.org#haskell-lens" | ||
skip_join: true | ||
template: | ||
- "\x0313compensated\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" | ||
|
||
env: | ||
- mode="--enable-tests" script="cabal test --show-details=always" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" Add the following to your .vimrc to automatically load this on startup | ||
|
||
" if filereadable(".vim.custom") | ||
" so .vim.custom | ||
" endif | ||
|
||
function StripTrailingWhitespace() | ||
let myline=line(".") | ||
let mycolumn = col(".") | ||
silent %s/ *$// | ||
call cursor(myline, mycolumn) | ||
endfunction | ||
|
||
" enable syntax highlighting | ||
syntax on | ||
|
||
" search for the tags file anywhere between here and / | ||
set tags=TAGS;/ | ||
|
||
" highlight tabs and trailing spaces | ||
set listchars=tab:‗‗,trail:‗ | ||
set list | ||
|
||
" f2 runs hasktags | ||
map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR> | ||
|
||
" strip trailing whitespace before saving | ||
" au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace() | ||
|
||
" rebuild hasktags after saving | ||
au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
0.1 | ||
--- | ||
* Split from [analytics](https://github.com/analytics/analytics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "hint" HLint.Default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright 2013 Edward Kmett | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the author nor the names of his contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | ||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
compensated | ||
=========== | ||
|
||
[![Build Status](https://secure.travis-ci.org/ekmett/compensated.png)](http://travis-ci.org/ekmett/compensated) | ||
|
||
This package provides a form of compensated arithmetic that lets you perform many operations on chains of doubles at higher precision. | ||
|
||
In particular addition, multiplication, etc. on a `Compensated Double` is done with twice as many bits of `significand` as on a raw `Double`. | ||
|
||
This construction is designed so that it can be iterated. | ||
|
||
This was forked from the [analytics](http://github.com/analytics/analytics.git) repository after repeated requests. | ||
|
||
Work still needs to be done to properly support most `Floating` operations, but everything below that level of the numeric hierarchy should work. | ||
|
||
Contact Information | ||
------------------- | ||
|
||
Contributions and bug reports are welcome! | ||
|
||
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net. | ||
|
||
-Edward Kmett |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/runhaskell | ||
\begin{code} | ||
{-# OPTIONS_GHC -Wall #-} | ||
module Main (main) where | ||
|
||
import Data.List ( nub ) | ||
import Data.Version ( showVersion ) | ||
import Distribution.Package ( PackageName(PackageName), Package, PackageId, InstalledPackageId, packageVersion, packageName ) | ||
import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) ) | ||
import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks ) | ||
import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose, copyFiles ) | ||
import Distribution.Simple.BuildPaths ( autogenModulesDir ) | ||
import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), Flag(..), fromFlag, HaddockFlags(haddockDistPref)) | ||
import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) ) | ||
import Distribution.Text ( display ) | ||
import Distribution.Verbosity ( Verbosity, normal ) | ||
import System.FilePath ( (</>) ) | ||
|
||
main :: IO () | ||
main = defaultMainWithHooks simpleUserHooks | ||
{ buildHook = \pkg lbi hooks flags -> do | ||
generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi | ||
buildHook simpleUserHooks pkg lbi hooks flags | ||
, postHaddock = \args flags pkg lbi -> do | ||
copyFiles normal (haddockOutputDir flags pkg) [("images","Hierarchy.png")] | ||
postHaddock simpleUserHooks args flags pkg lbi | ||
} | ||
|
||
haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath | ||
haddockOutputDir flags pkg = destDir where | ||
baseDir = case haddockDistPref flags of | ||
NoFlag -> "." | ||
Flag x -> x | ||
destDir = baseDir </> "doc" </> "html" </> display (packageName pkg) | ||
|
||
generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () | ||
generateBuildModule verbosity pkg lbi = do | ||
let dir = autogenModulesDir lbi | ||
createDirectoryIfMissingVerbose verbosity True dir | ||
withLibLBI pkg lbi $ \_ libcfg -> do | ||
withTestLBI pkg lbi $ \suite suitecfg -> do | ||
rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines | ||
[ "module Build_" ++ testName suite ++ " where" | ||
, "deps :: [String]" | ||
, "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg)) | ||
] | ||
where | ||
formatdeps = map (formatone . snd) | ||
formatone p = case packageName p of | ||
PackageName n -> n ++ "-" ++ showVersion (packageVersion p) | ||
|
||
testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)] | ||
testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys | ||
|
||
\end{code} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: compensated | ||
category: Numeric | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 1.8 | ||
license-file: LICENSE | ||
author: Edward A. Kmett | ||
maintainer: Edward A. Kmett <ekmett@gmail.com> | ||
stability: provisional | ||
homepage: http://github.com/analytics/compensated/ | ||
bug-reports: http://github.com/analytics/compensated/issues | ||
copyright: Copyright (C) 2013 Edward A. Kmett | ||
build-type: Custom | ||
tested-with: GHC == 7.4.1, GHC == 7.6.1 | ||
synopsis: Compensated floating-point arithmetic | ||
description: This package provides compensated floating point arithmetic. | ||
|
||
extra-source-files: | ||
.travis.yml | ||
.ghci | ||
.gitignore | ||
.vim.custom | ||
travis/cabal-apt-install | ||
travis/config | ||
AUTHORS.markdown | ||
README.markdown | ||
CHANGELOG.markdown | ||
|
||
source-repository head | ||
type: git | ||
location: git://github.com/analytics/compensated.git | ||
|
||
-- You can disable the doctests test suite with -f-test-doctests | ||
flag test-doctests | ||
default: True | ||
manual: True | ||
|
||
flag lib-Werror | ||
default: False | ||
manual: True | ||
|
||
library | ||
build-depends: | ||
base >= 4.3 && < 5, | ||
bifunctors >= 3.2 && < 4, | ||
binary >= 0.5 && < 0.6, | ||
comonad >= 3 && < 4, | ||
deepseq >= 1.3 && < 1.5, | ||
distributive >= 0.3 && < 1, | ||
generic-deriving == 1.4.*, | ||
hashable >= 1.1.2.3 && < 1.3, | ||
lens >= 3.8 && < 3.9, | ||
log-domain >= 0.2 && < 1, | ||
semigroupoids >= 3.0.2 && < 4, | ||
semigroups >= 0.8.4 && < 1, | ||
safecopy >= 0.8.1 && < 0.9, | ||
vector >= 0.9 && < 0.11 | ||
|
||
exposed-modules: | ||
Numeric.Compensated | ||
|
||
if flag(lib-Werror) | ||
ghc-options: -Werror | ||
|
||
ghc-options: -Wall -fwarn-tabs -O2 | ||
hs-source-dirs: src | ||
|
||
test-suite doctests | ||
type: exitcode-stdio-1.0 | ||
main-is: doctests.hs | ||
ghc-options: -Wall -threaded | ||
hs-source-dirs: tests | ||
|
||
if !flag(test-doctests) | ||
buildable: False | ||
else | ||
build-depends: | ||
base, | ||
directory >= 1.0, | ||
doctest >= 0.9.1, | ||
filepath, | ||
generic-deriving, | ||
semigroups >= 0.9, | ||
simple-reflect >= 0.3.1 | ||
|
||
if impl(ghc<7.6.1) | ||
ghc-options: -Werror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.