[Haskell-cafe] Typing problems with basic arithmetic - help!

Marcin Tustin mm3 at zepler.net
Fri Sep 23 15:10:55 EDT 2005

    Thanks for this: All I have to do now is fix the fact that my maths is stupidly screwed!

On Fri, Sep 23, 2005 at 02:23:10PM -0400, J. Garrett Morris wrote:
> Haskell doesn't do automatic numeric conversion for you - you need to
> use fromIntegral to go from an integral type (like 2) to a floating
> point type (as you'd need for division) and you can use round or trunc
> to go the other direction.  There's similarly a fromRational function
> to convert from rational numbers to just about anything else you'd
> need.  A couple of applications of those functions - probably mainly
> around your divisions - should fix things up.
>  /g

More information about the Haskell-Cafe mailing list