Fwd: [Haskell-cafe] A simple question
Marc Charpentier
mc at 3virgule14.net
Wed Nov 3 07:06:49 EST 2004
Thank you all for the friendly and helpful explanations - and for your
patience.
The solution to my problem is finally
f :: Double -> Double
f i = (-1)**i/(2**(10*i)) * (-2^5/(4*i+1)-1/(4*i+3)+2^8/(10*i+1)
-2^6/(10*i+3)-2^2/(10*i+5)-2^2/(10*i+7)+1/(10*i+9))
I had confused (^) and (**) due the fact that
1.0/2^16
or
(-1.0)^2/2^16
are accepted.
The important sentence in the Gentle Tutorial is
" It is easy to forget at times that numerals are overloaded, and not
implicitly coerced to the various numeric types,"
(Finding my errors was made somewhat difficult due to the following
messages I got while testing my conjectures:
*Main> let i=1 in 1/2^i
0.5
*Main> let i=1 in i/2^i
Ambiguous type variable `a' in these top-level constraints:
`Fractional a' arising from use of `/' at <interactive>:1
`Integral a' arising from use of `^' at <interactive>:1
:-)
)
Thanks to all.
Marc Charpentier
More information about the Haskell-Cafe
mailing list