Mail Archives: djgpp/1998/04/15/03:48:49
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 -