Message Boards Message Boards

How to import IEEE754 floating point numbers into Wolfram, without any change of values?

Posted 2 days ago

Hello,

I need to import some floating point numbers generated in a C program (double or long double) on an IEEE754 compliant computer, into a MATHEMATICA program. The essential issue is that I have to be sure that in both programs I have IDENTICAL values of these numbers. Is there any way to do this? It seems to me that transferring numbers written in decimal format, or converting the decimal format to exact rational numbers does not do the job, since the decimal format may not be fully equivalent to the binary content, due to representation errors (in the C program).

Lesław

POSTED BY: Leslaw Bieniasz

Maybe BinaryRead[...,type] with type set to "Real64" or "Real128"? This assumes the numbers were not exported as decimals by the C program that created them.

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract