Hi,

> > First off, in section 7.2.7 "Primitive-Double and Float
> > operations" there's a typo.  It says "minux" instead of "minux" on the
> > line reading: "{plus,minux,times,divide}Float# :: ...".

Oops, I just realised I made the same typo here :).

> You can use the FFI for all these operations, just import the C
> versions.  You can even use unboxed types if you really want (mostly it
> shouldn't be necessary, though).

Ah, yes, that works too :).  I only suggested it because all the other
Float# functions seem to be exactly what is found in the RealFloat class
and these were "missing"...foreign works too, though.

Out of curiousity, why would I get better performance when using:

  data Log = Log Float#

instead of

  newtype Log = Log Float

?  GHC should be removing the newtype constructor anyway, so I don't
understand the difference.

(FOr some about what I'm doing, I multiply probabilities like 10^-8
together a lot and we always get underflow, even on Doubles.  THe solution
is to represent x by log x, thus 10^-8 is represented as
-8.  Multiplication of logs is trivial (addition) and there are some
tricks to do addition and subtraction without expanding out the log.  I
basically define the Log type above as instances of Num, FLoating, etc. so
I can conveniently use it.)

 - Hal

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to