Re: int to float problem (resend with addendum)

2003-03-05 Thread b . i . mills
I just fluffed the To: field in the header, so my previous message was bounced, I'm resending this ... sorry if it turns up twice. (I also took the opportunity to make an addendum). Yo, Haskell Integers are not a proper subset of Haskell Floats or Doubles. Haskell does not support real

Re: int to float problem

2003-03-05 Thread b . i . mills
I agree with what you said, but I think you may have missed my point. Sounds likely on both counts. The same thing annoys me, but my work is in exact or symbolic: -- I don't claim this is a practical example -- I'm just saying that it is logically plausible denominator 2 % 3 == 3

Re: int to float problem

2003-03-04 Thread Andrew J Bromage
G'day all. On Mon, Mar 03, 2003 at 12:10:28PM -0500, Matthew Donadio wrote: This is my biggest gripe with Haskell, at least for what I do. The numeric class system is good, but it assumes that the sub-classes are distict, where in fact integers are a proper subset of reals, which are a

Re: int to float problem

2003-03-03 Thread Ketil Z. Malde
Mike T. Machenry [EMAIL PROTECTED] writes: I am having a problem. I recently desided I wanted a bunch function to return float instead of Int. I changed their type and wrote a new function that returned a float. I figured it'd be okay if all the others still returned Int since it's trivial

Re: int to float problem

2003-03-03 Thread Mike T. Machenry
Thank does sound like a pain, but it's better than putting fromIntegral all over my code. Why can't Haskell unify a an expected float with an infered int? It seems that this would make life alot easier. -mike On Sun, Mar 02, 2003 at 11:28:00AM +, Jorge Adriano wrote: Mike T. Machenry

Re: int to float problem

2003-03-03 Thread Ketil Z. Malde
Matthew Donadio [EMAIL PROTECTED] writes: Thank does sound like a pain, but it's better than putting fromIntegral all over my code. Why can't Haskell unify a an expected float with an infered int? It seems that this would make life alot easier. Personally, I think that one of the things that

Re: int to float problem

2003-03-02 Thread Jorge Adriano
Mike T. Machenry [EMAIL PROTECTED] writes: I recently desided I wanted a bunch function to return float instead of Int. [...] I found fromInteger but it didn't seem to work on the return value of the cardinality function for instance. Try fromIntegral, which works for Int and Integer,

Re: int to float problem

2003-03-01 Thread Zdenek Dvorak
Hello, [snip] Try intToFloat :: Int - Float intToFloat n = fromInteger (toInteger n) [snip] Use the Prelude function realToFrac. it sometimes happens to me that I must spend some time browsing prelude to devise somethink like this; it might be useful to have a library for this, that would

Re: int to float problem

2003-03-01 Thread Ferenc Wagner
Mike T. Machenry [EMAIL PROTECTED] writes: I recently desided I wanted a bunch function to return float instead of Int. [...] I found fromInteger but it didn't seem to work on the return value of the cardinality function for instance. Try fromIntegral, which works for Int and Integer, too.