www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/15/03:48:49

From: "M. Schulter" <mschulter AT value DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Significant Digits
Date: 15 Apr 1998 07:23:16 GMT
Organization: Value Net Internetwork Services Inc.
Lines: 35
Message-ID: <6h1n94$4vd$1@vnetnews.value.net>
References: <35338A5C DOT D17E22CA AT e-z DOT net>
NNTP-Posting-Host: value.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Albert Bae <jwbae AT e-z DOT net> wrote:
: Hello,

:    I am making a program that needs high precision because it has to
: numerically integrate a function twice.  I beleive that the double data
: type only gives 7 significant figures.  7 sig. figs. cause a round off
: error that is to large to be acceptable as an output for my program.

Hello, there.

To find out about the precision of different floating-point types in
DJGPP, please see the file /djgpp/include/float.h.

A double in DJGPP is a 64-bit floating-point number that should give you
precision to about 15 decimal places. As someone else mentioned, a float
in DJGPP is a 32-bit floating-point number that would give you roughly six
significant figures -- so a double somehow being demoted to a float could,
as suggested, be one explanation for your problem. 

A long double in DJGPP gives you an extended-precision 80-bit
floating-point number with about 18 digits of precision. Please note that
at least with the standard C library I've used, many of the math functions
are defined as returning a double rather than a long double. 

BTW, the long double returns a size of 12; it has a size of 96 bits (an
even multiple of 32), but in accord with the design of the Intel FPU only
actually uses 80 bits of data. This is analogous to "padding" a struct. 

Most respectfully,

Margo Schulter
mschulter AT value DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019