A while ago I wrote a program which used some factorial functions. I used the long double data type to support "relative" big numbers.
Now, I changed from codeblocks to Visualstudio 2010, I was wondering why my program didn't work any more till I realized after some research that MS has abandonded the long double data type. Is there any special reason for this? To me it looks very like step backwards in terms of technology.
Is there any alternative to use? (I would also be happy with an alternative out of the boost library).
I'm not sure why you think that
long double
was "abandoned", as it is part of the C++ Standard and therefore a compliant implementation must, well, implement it.What they did "abandon" is
long double
overloads of mathematical functions, and they did this because:which, in turn, along with
long double
in older VS versions being 80-bit, is because:Still, that they chose not to support these overloads, even with same-sized
double
andlong double
types (both could have been made 64-bit), is a shame because they are also part of the C++ Standard. But, well, that's Microsoft for you. Intently stubborn.However, although these overloads are essentially deprecated in Visual Studio, they are still available, so you should still be able to use them:
It sounds to me like you have been relying on
long double
to support a specific range of numeric values, and have consequently run into regression issues when that has changed in a different toolchain.If you have a specific numeric range requirement, use fixed-range integral types. Here you have a few options:
stdint.h
- a C99 feature that some C++ toolchains support as an extension;stdint.h
- a C99 feature that Boost re-implements as a library;cstdint
- a C++0x feature that may be of use if you are writing C++0x code.