HASKEL - Exercicios
Pesquisas Acadêmicas: HASKEL - Exercicios. Pesquise 862.000+ trabalhos acadêmicosPor: guieloi • 25/8/2014 • 535 Palavras (3 Páginas) • 240 Visualizações
delta :: Float -> Float -> Float -> Float
delta a b c = (b*b) - (4*a*c)
numberNDroots :: Float -> Float -> Float -> Integer
numberNDroots a b c
| (delta a b c) > 0.0 = 2
| (delta a b c) == 0.0 = 1
| (delta a b c) < 0.0 = 0
numberDroots :: Float -> Float -> Float -> Integer
numberDroots a b c
| a == 0 && b == 0 && c == 0 = 3
|otherwise = numberNDroots a b c
rootLow :: Float -> Float -> Float -> Float
rootLow a b c = ( -b - sqrt(delta a b c) ) /(2*a)
rootHigh :: Float -> Float -> Float -> Float
rootHigh a b c = ( -b - sqrt(delta a b c) ) /(2*a)
multi :: Float -> Float -> Float
multi a b
| b == 0 = 0
| b > 0 = multi a (b-1) + a
squareInt :: Integer -> Integer
squareInt a = lower a a
lower :: Integer -> Integer -> Integer
lower a b
| b*b > a = lower a (b-1)
| b*b <= a = b
delta :: Float -> Float -> Float -> Float
delta a b c = (b*b) - (4*a*c)
numberNDroots :: Float -> Float -> Float -> Integer
numberNDroots a b c
| (delta a b c) > 0.0 = 2
| (delta a b c) == 0.0 = 1
| (delta a b c) < 0.0 = 0
numberDroots :: Float -> Float -> Float -> Integer
numberDroots a b c
| a == 0 && b == 0 && c == 0 = 3
|otherwise = numberNDroots a b c
rootLow :: Float -> Float -> Float -> Float
rootLow a b c = ( -b - sqrt(delta a b c) ) /(2*a)
rootHigh :: Float -> Float -> Float -> Float
rootHigh a b c = ( -b - sqrt(delta a b c) ) /(2*a)
multi :: Float -> Float -> Float
multi a b
| b == 0 = 0
| b > 0 = multi a (b-1) + a
squareInt
...