Author Topic: Printing REAL 10 values with the gcc under Linux  (Read 5416 times)

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Printing REAL 10 values with the gcc under Linux
« 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, too.

Gunther
Get your facts first, and then you can distort them.

anta40

  • Member
  • ***
  • Posts: 312
Re: Printing REAL 10 values with the gcc under Linux
« Reply #1 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?

jj2007

  • Member
  • *****
  • Posts: 10544
  • Assembler is fun ;-)
    • MasmBasic
Re: Printing REAL 10 values with the gcc under Linux
« Reply #2 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, if somebody is interested.

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: Printing REAL 10 values with the gcc under Linux
« Reply #3 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, if somebody is interested.

fishy or not, the compiler rounding via printf is correct.

Gunther
Get your facts first, and then you can distort them.