Personal tools

Cum transform un numar intreg intr-un numar real ?

From HaskellWiki

Revision as of 10:44, 25 October 2007 by Ha$kell (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ca un exercitiu, puteti scrie si dumneavoastra o functie care sa transforme un intreg intr-un real sau invers dar aceste functii sunt deja definite:


Incercati sa folositi:

fromInt :: Int -> Float -- transforma un Int intr-un Float .

ceiling  :: Float -> Int -- rotunjeste la intregul imediat superior

floor :: Float -> Int -- rotunjeste la intregul imediat inferior

round :: Float -> Int -- rotunjeste la intregul cel mai apropiat