L
lcw1964
This may be in the category of bush-league rudimentary, but I am quite
perplexed on this and diligent Googling has not provided me with a
clear straight answer--perhaps I don't know how to ask the quesion.
I have begun to familiarize myself here with the gcc compiler in a
win32 environment, in the form of MinGW using both Dev C++ and MSYS as
interfaces.
I have recompiled some old math code that uses long double types
throughout and provides the corresponding range and precision (up to 18
digits, with exponents up to about -/+ 4900) when compiled under an
older version of BC++.
In the MinGW incarnation of gcc, I have made a couple of adjustments to
get it to compile--in particular, _atold() doesn't exist, and atof() is
prototyped only in stdlib.h whereas in BC++ it is listed in math.h too.
However, I kept all of my long double declarations and outputs as that,
and used all of the long double versions of the math functions--expl(),
fabsl(), etc. The file complied but the output was gibberish. It took a
little googling to find that I had to recast the long double output as
double so printf() could meaningfully display it.
However, I have come to suspect that MinGW's long double isn't really
long double, and that somewhere in the process the range and precision
of of the floating point math has been restricted to the double range.
For example, in the original code under BC++ (not MSVC++, which is well
known to recast everything as double) I can generate a meaningful
answer of, say 1.34598900000098888e-2345, whereas the MinGW compiled
version will render this tiny value as simply 0.
My question is this--does MinGW offer the "true" long double floating
point 80bit type, and if so how can I get my programs to display
results of the sort I mentioned in the previous paragraph is printf()
needs recasting to double in order to handle it?
I know that the C language in general is not the best environment in
which to do extended precision math work (one would be better off
mastering a high or arbitrary precision library), but I would like to
get the most precision and range out of my calculations under MinGW if
this is available.
many thanks,
Les
perplexed on this and diligent Googling has not provided me with a
clear straight answer--perhaps I don't know how to ask the quesion.
I have begun to familiarize myself here with the gcc compiler in a
win32 environment, in the form of MinGW using both Dev C++ and MSYS as
interfaces.
I have recompiled some old math code that uses long double types
throughout and provides the corresponding range and precision (up to 18
digits, with exponents up to about -/+ 4900) when compiled under an
older version of BC++.
In the MinGW incarnation of gcc, I have made a couple of adjustments to
get it to compile--in particular, _atold() doesn't exist, and atof() is
prototyped only in stdlib.h whereas in BC++ it is listed in math.h too.
However, I kept all of my long double declarations and outputs as that,
and used all of the long double versions of the math functions--expl(),
fabsl(), etc. The file complied but the output was gibberish. It took a
little googling to find that I had to recast the long double output as
double so printf() could meaningfully display it.
However, I have come to suspect that MinGW's long double isn't really
long double, and that somewhere in the process the range and precision
of of the floating point math has been restricted to the double range.
For example, in the original code under BC++ (not MSVC++, which is well
known to recast everything as double) I can generate a meaningful
answer of, say 1.34598900000098888e-2345, whereas the MinGW compiled
version will render this tiny value as simply 0.
My question is this--does MinGW offer the "true" long double floating
point 80bit type, and if so how can I get my programs to display
results of the sort I mentioned in the previous paragraph is printf()
needs recasting to double in order to handle it?
I know that the C language in general is not the best environment in
which to do extended precision math work (one would be better off
mastering a high or arbitrary precision library), but I would like to
get the most precision and range out of my calculations under MinGW if
this is available.
many thanks,
Les