Hello Daniel,
Friday, May 21, 2010, 11:55:35 PM, you wrote:
> xf = (fromRational $ toRational xd) :: Float
> xf = double2Float xd
> am still surprised how often such kinds of unobvious problems occur
> while programming in Haskell
does it mean that all other languages you are used doesn't have
On Sunday 23 May 2010 13:12:16, wren ng thornton wrote:
> Daniel Fischer wrote:
> > There are more rules elsewhere. If you compile with optimisations, GHC
> > turns your realToFrac into double2Float# nicely, so it's okay to use
> > realToFrac.
> > However, without optimisations, no rules fire, so y
Daniel Fischer wrote:
There are more rules elsewhere. If you compile with optimisations, GHC
turns your realToFrac into double2Float# nicely, so it's okay to use
realToFrac.
However, without optimisations, no rules fire, so you'll get
(fromRational . toRational).
That must be new, because it
By the way, speaking of floating-point precision, is there a real reason why
haskell forces us to write :
foreign import ccall unsafe "math.h frexp" c_frexp::CDouble->(Ptr CInt)->IO ()
foreign import ccall unsafe "math.h ldexp" c_ldexp::CDouble->CInt->IO CDouble
ulp::Double->Double
ulp x=unsafeP
dvde:
> Dear Haskellers,
>
> I just want to share an observation. I had to convert a Double to a
> Float value in an inner loop of an application, and I used somethin like
> this:
>
> xf = (fromRational $ toRational xd) :: Float
>
> The program works on windows but it did not on OSX - it was to
On Friday 21 May 2010 22:06:43, Henning Thielemann wrote:
> On Fri, 21 May 2010, Daniel van den Eijkel wrote:
> > Dear Haskellers,
> >
> > I just want to share an observation. I had to convert a Double to a
> > Float value in an inner loop of an application, and I used somethin
> > like this:
> >
>
I see. And I changed the code, it works well. Thanks for that!
Daniel
Henning Thielemann schrieb:
On Fri, 21 May 2010, Daniel van den Eijkel wrote:
Dear Haskellers,
I just want to share an observation. I had to convert a Double to a
Float value in an inner loop of an application, and I use
On Fri, 21 May 2010, Daniel van den Eijkel wrote:
Dear Haskellers,
I just want to share an observation. I had to convert a Double to a Float
value in an inner loop of an application, and I used somethin like this:
xf = (fromRational $ toRational xd) :: Float
I think realToFrac is the func
Dear Haskellers,
I just want to share an observation. I had to convert a Double to a
Float value in an inner loop of an application, and I used somethin like
this:
xf = (fromRational $ toRational xd) :: Float
The program works on windows but it did not on OSX - it was too slow.
Now, after b