From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1014db,6d134459fc7a7fcb X-Google-Attributes: gid1014db,public X-Google-Thread: fa528,6d134459fc7a7fcb X-Google-Attributes: gidfa528,public From: Mathew Hendry Subject: Re: print long double on Tru64 Unix5.0 Date: 2000/07/12 Message-ID: #1/1 X-Deja-AN: 645613668 Content-Transfer-Encoding: 7bit References: <8kig92$mhi$1@news6.isdnet.net> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@uk.uu.net X-Trace: lure.pipex.net 963432640 18681 62.188.162.233 (12 Jul 2000 20:10:40 GMT) Organization: home Mime-Version: 1.0 NNTP-Posting-Date: 12 Jul 2000 20:10:40 GMT Newsgroups: comp.lang.c,comp.unix.tru64 On Wed, 12 Jul 2000 21:13:38 +0200, "Mickael GASTINEAU" wrote: >I have some trouble to print long double data on Tru64 Unix5.0A with the >system call printf(3). >After the 16th digit, it always print 0 for the digits. >But long double has about 33 significant digits on Tru64Unix5.0A. >[...] You need a better standard C library. The simplest approach to printing a floating point number is to scale the number by powers of 10 into the range of the largest available integer type, then to convert that to a string, giving a decimal significand. If you're only getting 16 decimal digits, it's probably because your library is using a 64-bit integer for the intermediate representation. Other libraries (e.g. glibc) use arbitrary precison integer arithmetic to give effectively unlimited precision. -- Mat.