Difference between revisions of "Cum transform un numar intreg intr-un numar real ?"
Jump to navigation
Jump to search
m |
|||
Line 12: | Line 12: | ||
''round :: Float -> Int'' -- rotunjeste la intregul cel mai apropiat |
''round :: Float -> Int'' -- rotunjeste la intregul cel mai apropiat |
||
+ | |||
+ | ---- |
||
+ | [http://www.haskell.org/haskellwiki/Ro/Haskell <= Inapoi la pagina principala Ro/Haskell ] |
Revision as of 11:07, 25 October 2007
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