altfloat: Alternative floating point support for GHC.
A replacement for the standard Haskell floating point types and supporting functions. There are a number of shortcomings which I feel severely hinder Haskell's utility for numerical computation. These shortcomings include
There is no way to sanely convert between Haskell's floating types -- not even between Double and CDouble. The implementation of the
realToFrac
function goes throughRational
, which loses information asRational
cannot represent all floating point values.Making floating types an instance of
Ord
makes no sense.Ord
is for totally ordered data types, which floats are not. As a result, a number of library functions (such asmax
andsort
) produce nonsensical results.The
Enum
instance for floating types similarly makes little sense. WhilefromEnum
andtoEnum
functions useInt
instead ofInteger
, limiting their usefulness,pred
andsucc
can be defined in a much more useful way.Functions that should care about negative zeros, such as
signum
andabs
, do not.Some functions, such as
floor
, have nonsensical behaviour for non-finite input.The selection of floating point library functions pales in comparison to C. This problem is made worse since, as noted above, it is impossible to convert losslessly from
Double
toCDouble
in order to use the FFI.There is no mechanism for handling rounding modes or exceptions.
This package is intended to address all of the above issues, and more. Also provided, for convenience, is an alternative to the standard Prelude which includes features from this library and the non-overlapping parts of the standard Prelude.
Modules
[Index]
Flags
Automatic Flags
Name | Description | Default |
---|---|---|
splitinteger | Use the new split integer packages that come with GHC 6.12. | Enabled |
integergmp | Use the integer-gmp package as opposed to integer-simple. | Enabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- altfloat-0.3.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1 |
---|---|
Dependencies | base (>=4 && <5), ghc-prim, integer, integer-gmp, integer-simple [details] |
License | LicenseRef-OtherLicense |
Author | Nick Bowler |
Maintainer | nbowler@draconx.ca |
Category | Numerical |
Home page | http://repo.or.cz/w/altfloat.git |
Source repo | head: git clone git://repo.or.cz/altfloat.git |
Uploaded | by NickBowler at 2010-02-21T00:02:48Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 4412 total (21 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |