Floats and Doubles

2002-11-12 Thread Juan Ignacio Garcia Garcia
hello, I have been using some of the functions of the classes Real and Fractional and I have observed that with the funcion toRational we can obtain the fraction that represents a given number. For instance: *P2 toRational (5.2::Float) 5452595 % 1048576 Why we obtain this numbers instead of 52 %

RE: Floats and Doubles

2002-11-12 Thread Simon Marlow
I have been using some of the functions of the classes Real and Fractional and I have observed that with the funcion toRational we can obtain the fraction that represents a given number. For instance: *P2 toRational (5.2::Float) 5452595 % 1048576 Why we obtain this numbers instead of 52

Re: Floats and Doubles

2002-11-12 Thread Lennart Augustsson
Yes, they all seem to be right. You get these funny effects because numbers like 5.2 do not have an exact representation with floating point numbers in base to (like Float and Double most likely have on your machine). The number 5.2 is stored as a slightly different number as a Float, but the

Re: Floats and Doubles

2002-11-12 Thread Jerzy Karczmarczuk
Lennart Augustsson wrote: The number 5.2 is stored as a slightly different number as a Float, but the toRational function is exact so it gives you the number corresponding to the internal representation. Take a course on numerical analysis. :) Nope. Take a course entitled: Why all you

Re: RFC: External library infrastructure

2002-11-12 Thread Andrew J Bromage
G'day all. On Tue, Nov 12, 2002 at 05:25:42PM +, Alastair Reid wrote: So as people try to come up with a distribution and build mechanism that will work for GHC, it would be good to think about how that same mechanism would work for Hugs too. If you will allow me to AOL... Me too!

Re: RFC: External library infrastructure

2002-11-12 Thread Alastair Reid
Could you be more concrete? What extension of the package mechanism did you have in mind? (personally I had in mind a standard autoconf + Makefiles story for the build system, but I'm sure there are better ways). I was thinking add all the things that make packages insufficient to use as

Record of STRefs better than STRef to a Record?

2002-11-12 Thread Jorge Adriano
Hi all, If I use an STRef to a record, will a new record be created each time I want to update a single field? Or can I expect GHC to optimize it and have the field of the record updated in place? Right now I'm using a record of STRefs, like: data E s = E{ refi :: STRef s Int,