Re: Euphoria equivalent to C typecasting
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Aug 02, 2004
- 501 views
Jonas Temple wrote: > > > > I apologize, I copied the wrong section. What I'm really interested in > is in extracting the floating point value from the memory location: > > floatBuffer = (float *) (dataBuffer + bufferIndex); > sprintf(prtBuffer+bufferCount+columnInfo[colIndex].width-16, > "%.8E", *floatBuffer); > This is just a 32-bit floating point number, so you could convert using:
float = float32_to_atom( peek( { dataBuffer + bufferIndex, 4})) -- C writes the output of sprintf to a buffer, but -- we just stick it in a sequence in Euphoria: text = sprintf( "%0.8e", float )
Matt Lewis