I've attached to this post the archive LongPI.zip. It's zipped under Windows, but the sources are native Linux sources (both: 32 and 64 bit). There isn't any problem under Linux, because the REAL10 native data type is supported under that operating system. For more background information you may wish to check this thread (http://masm32.com/board/index.php?topic=1768.0), too.
Gunther
Hi gunther
32-bit code output:
Layout of data types:
=====================
Long Double (REAL10) = 12 Bytes
Double (REAL8) = 8 Bytes
Float (REAL4) = 4 Bytes
Results:
========
PI = 3.14159265358979323846264338327 ...
PI as Long Double Value = 3.1415926535897932385
PI as Double Value = 3.141592653589793
PI as Float Value = 3.141593
64-bit code output:
Layout of data types:
=====================
Long Double (REAL10) = 16 Bytes
Double (REAL8) = 8 Bytes
Float (REAL4) = 4 Bytes
Results:
========
PI = 3.14159265358979323846264338327 ...
PI as Long Double Value = 3.1415926535897932385
PI as Double Value = 3.141592653589793
PI as Float Value = 3.141593
Are those correct?
.... 32385
The "5" looks fishy. The REAL10 stored in the FPU with fldpi holds a zero instead.
We had a long thread in the old forum (http://www.masmforum.com/board/index.php?topic=18253.msg154482#msg154482), if somebody is interested.
Hi anta40,
Quote from: anta40 on April 11, 2013, 11:17:02 AM
Are those correct?
that's the correct output.
Jochen,
Quote from: jj2007 on April 11, 2013, 03:38:23 PM
.... 32385
The "5" looks fishy. The REAL10 stored in the FPU with fldpi holds a zero instead.
We had a long thread in the old forum (http://www.masmforum.com/board/index.php?topic=18253.msg154482#msg154482), if somebody is interested.
fishy or not, the compiler rounding via printf is correct.
Gunther