HaskellNumber System                Jaiyalas
Basic NumberType      Precision    Instance            Data Structure           Single-     Integral,  Int                ...
More Number  Type       Precision   Instance            Data Structure  Ratio                              (Integral a) =>...
Type : IntegerShow       Num   Fractional   Floating Eq                                  RealFloat             Real       ...
Type : IntShow       Num    Fractional   Floating Eq                                     RealFloat              Real      ...
Type : RationalShow       Num   Fractional   Floating Eq                                  RealFloat             Real      ...
Type : ComplexShow       Num   Fractional   Floating Eq                                  RealFloat             Real       ...
Type : Float & DoubleShow       Num   Fractional   Floating Eq                                  RealFloat             Real...
Casting FunctionsfromInteger          (Num a) => Integer -> a  toInteger         (Integral a) => a -> IntegerfromRational ...
Using NumberFocus on properties Class providedFocus on a particular type
Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> αFocus on a particular typefunc :: Double -> ...
Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> α     - α can be Float, Double,          Rati...
Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α     - α can be Float, Double,          Rationa...
Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α     - α can be Float, Double,          Rationa...
Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α     - α can be Float, Double,          Rationa...
THX.
Upcoming SlideShare
Loading in …5
×

Number System in Haskell

593 views
402 views

Published on

Created in 8 Sep. 2008

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
593
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Number System in Haskell

  1. 1. HaskellNumber System Jaiyalas
  2. 2. Basic NumberType Precision Instance Data Structure Single- Integral, Int minBound ... -1 | 0 | 1 ... maxBound Precision Bounded Arbitrary-Integer Integral ... -1 | 0 | 1 ... Precision Single- Float RealFloat - Precision Double-Double RealFloat - Precision
  3. 3. More Number Type Precision Instance Data Structure Ratio (Integral a) => Ratio a = !a :% !a - RealFrac(Rational) Rational = Ratio IntegerComplex - Floating (RealFloat a) => Complex a = !a :+ !a
  4. 4. Type : IntegerShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
  5. 5. Type : IntShow Num Fractional Floating Eq RealFloat Real RealFracOrd Integral BoundedEnum
  6. 6. Type : RationalShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
  7. 7. Type : ComplexShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
  8. 8. Type : Float & DoubleShow Num Fractional Floating Eq RealFloat Real RealFracOrd IntegralEnum
  9. 9. Casting FunctionsfromInteger (Num a) => Integer -> a toInteger (Integral a) => a -> IntegerfromRational (Fractional a) => Rational -> a toRational (RealFrac a) => a -> Rational (Integral a, Num b) => a -> bfromIntegral fromInteger . toIntegerfromRealFrac (RealFrac a, Fractional b) => a -> b (realToFrac) fromRational . toRational
  10. 10. Using NumberFocus on properties Class providedFocus on a particular type
  11. 11. Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> αFocus on a particular typefunc :: Double -> Double
  12. 12. Using NumberFocus on properties Class providedfunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on a particular typefunc :: Double -> Double - Can be Double only
  13. 13. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
  14. 14. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
  15. 15. Using NumberFocus on what Fractional can dofunc :: (Fractional α) => α -> α - α can be Float, Double, Rational or ComplexFocus on what Double can dofunc :: Double -> Double - Can be Double only
  16. 16. THX.

×