double double data type

  • Thread starter Thread starter James Simpson
  • Start date Start date
J

James Simpson

Hello,
I tried to declare a double double in my MFC app and I get the following
error:
error C2632: 'double' followed by 'double' is illegal
Now I believe that double double is a valid built-in C++ data type and it
also happens to be the highest precision/largest value built-in type. Why is
the VC++ compiler giving me this error? Is there something I need to do
differently?

Regards,

James Simpson
Straightway Technologies Inc.
 
James said:
Hello,
I tried to declare a double double in my MFC app and I get the following
error:
error C2632: 'double' followed by 'double' is illegal
Now I believe that double double is a valid built-in C++ data type

Well, it's not. You're thinking of "long double".
 
Jeroen Mostert said:
Well, it's not. You're thinking of "long double".

Yes, it is the same pattern that turns "long" into "long long", but it is
"long $1", not "$1 $1".
 
Jeroen said:
Well, it's not. You're thinking of "long double".

Also be aware that under VC++, 'double' and 'long double' have the same
representation - they're both 8-byte floating point. If you're writing
portable code and want to use the most precise floating point type
available, long double is for you even if it makes no difference under VC++.

-cd
 
Aside from writing my own class to handle high precision numeric values, is
there something else I can use to get a high precision floating point? The
code isn't portable (it's an MFC app).

Regards,
James Simpson
Straightway Technologies Inc.
 
James said:
Aside from writing my own class to handle high precision numeric
values, is there something else I can use to get a high precision
floating point? The code isn't portable (it's an MFC app).

Sure. You can use one of the many high precision math libraries that you'll
find out on the net with a little searching. Be aware that the performance
will be orders of magnitude worse than the built-in double type.

-cd
 
Back
Top