[Start work on numeric types John Goerzen **20070612083613] { hunk ./en/book-shortcuts.xml 8 +Int"> +Float"> +Double"> +Rational"> hunk ./en/ch05-typeclasses.xml 398 - FIXME + Haskell has a powerful set of numeric types. You can using everyting + from fast 32-bit or 64-bit integers to arbitrary-precision rational + numbers. Yet you probably know that operators such as + + can work with just about all of these. This + feature is implemented using typeclasses. As a side benefit, it + allows you to define your own numeric types and make them first-class + citizens in Haskell. hunk ./en/ch05-typeclasses.xml 406 + + Let's begin our discussion of the typeclasses surrounding nmeric + types with an examination of the types themselves. describes the most + commonly-used numeric types in Haskell. Note that there are also + many more numeric types available for specific purposes such as + interfacing to C. + + + Selected Numeric Types + + + + + + Type + Description + + + + + &Double; + Double-precision floating point + + + &Float; + Single-precision floating point + + + + Fixed-precision integer; minimum range [-2^29..2^29-1] + + + &Integer; + Arbitrary-precision integer; range limited only by + machine resources + + + &Rational; + Arbitrary-precision rational numbers. Stored as a + ratio of two &Integer;s. + + + +
+ + }