Re: Euphoria equivalent to C typecasting

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu