• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Issue with GDB printing long doubles (128 bit)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue with GDB printing long doubles (128 bit)


  • Subject: Issue with GDB printing long doubles (128 bit)
  • From: "Dr. Rolf Jansen" <email@hidden>
  • Date: Tue, 21 Mar 2006 16:15:48 -0300

In a bigger Objective-C project, GDB confused me by displaying non exact 128 bit long double floating point values. Fortunately, after some tests it turned out, that the values are correctly handled by my program, and it is only an issue of the GDB print command.

Please consider the following test program:

#include <stdio.h>
#include <math.h>

int main (int argc, const char * argv[])
{
   float        pi_f;
   double       pi_d;
   long double  pi_ld;

   // 32 bit float - 7 significant digits
   sscanf("3.1415927", "%f", &pi_f);

   // 64 bit double - 15 significant digits
   sscanf("3.141592653589793", "%lf", &pi_d);

   // 128 bit long double - 32 significant digits
   sscanf("3.1415926535897932384626433832795", "%Lf", &pi_ld);

   printf("%1.7f\n%1.15lf\n%1.31Lf\n", pi_f, pi_d, pi_ld);

   return(0);
}

Building and running results as expected in:

   [Session started at 2006-03-21 15:04:25 -0300.]
   3.1415927
   3.141592653589793
   3.1415926535897932384626433832795

   Test has exited with status 0.


However, if I stop this in GDB just until return, the GDB-print command for pi_f and pi_d give exact results as expected for the given type, but GDB-print for the pi_ld variable is inexact:


      (gdb) print pi_f
      $1 = 3.14159274
      (gdb) print pi_d
      $2 = 3.1415926535897931
      (gdb) print pi_ld
      $3 = 3.1415926535897931159979634685441852

should be: 3.1415926535897932384626433832795

Is this a known issue? I consider this however not major problem, since the compiled program itself seems to work correctly.

Best regards

Dr. Rolf Jansen
Director R&D
SurTec International GmbH
Zwingenberg Bergstrasse
Germany


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: RezMerger size limitation .r --> .rsrc
  • Next by Date: Re: RezMerger size limitation .r --> .rsrc
  • Previous by thread: Re: RezMerger size limitation .r --> .rsrc
  • Next by thread: Symbol stripping tips + handy script
  • Index(es):
    • Date
    • Thread