News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Printing REAL 10 values with the gcc under Linux

Started by Gunther, April 11, 2013, 12:13:34 AM

Previous topic - Next topic

Gunther

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
You have to know the facts before you can distort them.

anta40

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?

jj2007

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

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, if somebody is interested.

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

Gunther
You have to know the facts before you can distort them.