Re: Double -> non-double function :)

2002-04-04 Thread Dylan Thurston
On Wed, Apr 03, 2002 at 11:15:04AM -0800, Hal Daume III wrote: > I'm looking for a (not-necessarily Haskell 98 compliant, as long as it > works in GHC) way to get at the internal representation of Doubles. I can > use decodeDouble# to get at it, but I need something equivalent to > encodeDouble#

Re: Double -> non-double function :)

2002-04-03 Thread Jay Cox
On Wed, 3 Apr 2002, Hal Daume III wrote: > I found one way: > > doubleToInts d = runST ( > do arr <- newDoubleArray (1,2) >writeDoubleArray arr 1 d >i1 <- readIntArray arr 1 >i2 <- readIntArray arr 2 >return (i1,i2)) > > intsToDouble (i1,i2) = runST ( > do

Re: Double -> non-double function :)

2002-04-03 Thread Hal Daume III
I found one way: doubleToInts d = runST ( do arr <- newDoubleArray (1,2) writeDoubleArray arr 1 d i1 <- readIntArray arr 1 i2 <- readIntArray arr 2 return (i1,i2)) intsToDouble (i1,i2) = runST ( do arr <- newDoubleArray (1,2) writeIntArray arr 1 i1

Double -> non-double function :)

2002-04-03 Thread Hal Daume III
I'm looking for a (not-necessarily Haskell 98 compliant, as long as it works in GHC) way to get at the internal representation of Doubles. I can use decodeDouble# to get at it, but I need something equivalent to encodeDouble# to go the other way, and I cannot find such a function anywhere. Any s