At 1:59 -0500 10/31/98, Travis or Kerrin Griggs wrote:
I'm trying to create a typed FloatArray. There's not a lot in the system for converting floats to bytes, so I hacked up something where I use basicAt: to extract the first and second dwords, and then strip the dwords down a byte at a time (a bit more complex then VW where changeClassToThatOf: #[] works handily). But now that I've got it ripped down into 8 bytes, I can't figure out how to get the float back again. I put the 4 byte chunks back together (via bitShift: and +), but can't use basicAt:put: on an instance of a float. Feature, bug,...? Is there a better way to do this anyway?
Travis Griggs
Look at Float>>asTrueFraction; it tears apart a float and builds a fraction out of the same bits. Reverse conversion is done by sending #asFloat to the fraction; an identical float is produced. _______________________________ David N. Smith IBM T J Watson Research Center Hawthorne, NY _______________________________ Any opinions or recommendations herein are those of the author and not of his employer.
squeak-dev@lists.squeakfoundation.org