The altfloat package
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
realToFracfunction goes through
Rational, which loses information as
Rationalcannot represent all floating point values.
Making floating types an instance of
Ordmakes no sense.
Ordis for totally ordered data types, which floats are not. As a result, a number of library functions (such as
sort) produce nonsensical results.
Enuminstance for floating types similarly makes little sense. While
Integer, limiting their usefulness,
succcan be defined in a much more useful way.
Functions that should care about negative zeros, such as
abs, 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
CDoublein 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. All are currently addressed except for rounding modes and exceptions.
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.
|Versions||0.2, 0.2.1, 0.2.2, 0.3, 0.3.1|
|Dependencies||base (==4.*), ghc-prim, integer [details]|
|Uploaded||Thu Jan 21 21:08:45 UTC 2010 by NickBowler|
|Downloads||1374 total (11 in the last 30 days)|
|Rating||0.0 (0 ratings) [clear rating]|
|Status||Docs not available [build log]
All reported builds failed as of 2016-12-30 [all 7 reports]
Hackage Matrix CI
For package maintainers and hackage trustees