The MASM Forum

64 bit assembler => 64 Bit Assembler => Topic started by: Gunther on April 11, 2013, 12:13:34 AM

Title: Printing REAL 10 values with the gcc under Linux
Post by: Gunther on April 11, 2013, 12:13:34 AM
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
Title: Re: Printing REAL 10 values with the gcc under Linux
Post by: anta40 on April 11, 2013, 11:17:02 AM
Hi gunther

32-bit code output:
Code: [Select]
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:
Code: [Select]
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?
Title: Re: Printing REAL 10 values with the gcc under Linux
Post by: 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.
Title: Re: Printing REAL 10 values with the gcc under Linux
Post by: Gunther on April 12, 2013, 05:41:18 AM
Hi anta40,

Are those correct?

that's the correct output.

Jochen,

.... 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