HasBigDecimal alternatives and similar packages
Based on the "Math" category.
Alternatively, view HasBigDecimal alternatives based on common mentions on social networks and blogs.
-
vector
An efficient implementation of Int-indexed arrays (both mutable and immutable), with a powerful loop optimisation framework . -
statistics
A fast, high quality library for computing with statistics in Haskell. -
HerbiePlugin
GHC plugin that improves Haskell code's numerical stability -
hgeometry
HGeometry is a library for computing with geometric objects in Haskell. It defines basic geometric types and primitives, and it implements some geometric data structures and algorithms. The main two focusses are: (1) Strong type safety, and (2) implementations of geometric algorithms and data structures that have good asymptotic running time guarantees. -
dimensional
Dimensional library variant built on Data Kinds, Closed Type Families, TypeNats (GHC 7.8+). -
computational-algebra
General-Purpose Computer Algebra System as an EDSL in Haskell -
matrix
A Haskell native implementation of matrices and their operations. -
mwc-random
A very fast Haskell library for generating high quality pseudo-random numbers. -
numhask
A haskell numeric prelude, providing a clean structure for numbers and operations that combine them. -
vector-space
Vector & affine spaces, linear maps, and derivatives -
poly
Fast polynomial arithmetic in Haskell (dense and sparse, univariate and multivariate, usual and Laurent) -
cf
"Exact" real arithmetic for Haskell using continued fractions (Not formally proven correct) -
bayes-stack
Framework for Gibbs sampling of probabilistic models -
optimization
Some numerical optimization methods implemented in Haskell -
rampart
:european_castle: Determine how intervals relate to each other. -
equational-reasoning
Agda-style equational reasoning in Haskell -
safe-decimal
Safe and very efficient arithmetic operations on fixed decimal point numbers -
sbvPlugin
Formally prove properties of Haskell programs using SBV/SMT. -
monoid-subclasses
Subclasses of Monoid with a solid theoretical foundation and practical purposes -
polynomial
Haskell library for manipulating and evaluating polynomials -
eigen
Haskel binding for Eigen library. Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. -
manifold-random
Coordinate-free hypersurfaces as Haskell types -
modular-arithmetic
A useful type for working with integers modulo some constant.
Collect and Analyze Billions of Data Points in Real Time
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of HasBigDecimal or a related project?
README
HasBigDecimal
This module defines the type 'BigDecimal' which provides a representation of arbitrary precision decimal numbers. 'BigDecimal' is a native Haskell implementation based on arbitrary sized 'Integer' values. The implementation was inspired by Java BigDecimals.
BigDecimal instantiates the typeclasses 'Num', 'Fractional' and 'Real'. It is thus possible to use all common operators like '+', '-', '*', '/', '' on them.
Some examples from a ghci REPL
λ> a = BigDecimal 144 2
λ> toString a
"1.44"
λ> b = sqrt a
λ> toString b
"1.2"
λ> b * b
BigDecimal 144 2
λ> b * b * b
BigDecimal 1728 3
λ> b^2
BigDecimal 144 2
λ> c = fromString "123.4567890"
λ> c
BigDecimal 1234567890 7
λ> a / c
BigDecimal 1166400010614240096589584878965222398584 41
λ> roundBD it (halfUp 10)
BigDecimal 116640001 10
λ> divide (a, c) $ halfUp 20
BigDecimal 1166400010614240097 20
BigFloating
in addition to the pretty complete BigDecimal module there is the rather scetchy BigFloating module. BigFloating contains a few first step to let BigDecimal instantiate the Floating typeclass. As of now it contains arbitrary precision implementations for pi (based on Chudnovskis algorithm), sqrt and nthroot (based on Newtons classic algorithm). All trigonometric functions, log and exp are still missing. All code contributions are most welcome! Here are some working examples:
λ> r = sqrt (BigDecimal 2 0)
λ> toString r
"1.4142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727"
λ> r^2*pi
BigDecimal 6283185307179586476925286766559005768394338798750211641949889184615632812572417997256069650684234135488875159962758271904785109490094314219117662951460673928547017151357805018682925970564827587058974690236729643325013696514697383143361638452329945607739055327681644609147889519349178329780951524191191 300
λ> toString it
"6.283185307179586476925286766559005768394338798750211641949889184615632812572417997256069650684234135488875159962758271904785109490094314219117662951460673928547017151357805018682925970564827587058974690236729643325013696514697383143361638452329945607739055327681644609147889519349178329780951524191191"
λ> sqr 2 (halfUp 50)
BigDecimal 141421356237309504880168872420969807856967187537695 50
λ> sqr 2 (halfUp 500)
BigDecimal 141421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140798968725339654633180882964062061525835239505474575028775996172983557522033753185701135437460340849884716038689997069900481503054402779031645424782306849293691862158057846311159666871301301561856898723724 500