Re: int to float problem

2003-03-06 Thread Matthew Donadio
[EMAIL PROTECTED] wrote: > > I agree with what you said, > > but I think you may have missed my point. > > Sounds likely on both counts. Probably. I get confused a lot. :) > So now I have to say ... > >denominator $ fromInteger (floor (23 % 45)) > > Is this the same malarkey that you are

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 (resend with addendum)

2003-03-05 Thread Matthew Donadio
[EMAIL PROTECTED] wrote: > Basically, from the algebraic perspective, the float type is > a messy fudge, and does not fit in nicely with any of the > "pure" types. In general the containment I agree with what you said, but I think you may have missed my point. In numeric programming, at least wha

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-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 p

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 thi

Re: int to float problem

2003-03-03 Thread Matthew Donadio
>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. This is my biggest gripe with Haskell, at least for what I do. The numeric class system is

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
"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 t

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

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,

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 defin

Re: int to float problem

2003-02-28 Thread Lennart Augustsson
Use the Prelude function realToFrac. -- Lennart Mike T. Machenry wrote: Hello, 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 st

Re: int to float problem

2003-02-28 Thread Wang Meng
Try intToFloat :: Int -> Float intToFloat n = fromInteger (toInteger n) -W-M- @ @ | \_/ On Fri, 28 Feb 2003, Mike T. Machenry wrote: > Hello, > > I am having a problem. I recently desided I wanted a bunch function to return > float instead of Int. I changed their type and wro

int to float problem

2003-02-28 Thread Mike T. Machenry
Hello, 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 to convert Int to Float. Sadly Haskell wo