Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
Hi
 
double type has 64 bit width and can hold number as small as 1e-308.
i want a data type even smaller than double.
 
i read in help that long double has 80 bit width and can store as small as 1e-4000, but in VC, when i declare a variable with this type, it threats as double type.
 
where is the problem?
 
thanks
Posted 23-Dec-12 8:43am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You might use a library (see, for instance, Arbitrary-precision arithmetic libraries at Wikipedia[^]).
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

MSDN[^] says double and long double are same.
 
but CPP reference says you can define a long double by putting a 'L' at the end read more at Double and Long Double[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Floating points bigger than a double are not as standardized as float or double. It is much more compiler and Platform dependant.
 
http://en.wikipedia.org/wiki/Long_double[^]
 
If you really need more precision, you can either look for another compiler like the one from Intel or look for a library.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 309
1 Richard MacCutchan 295
2 OriginalGriff 270
3 Sharmanuj 146
4 Magic Wonder 129
0 Sergey Alexandrovich Kryukov 5,969
1 OriginalGriff 5,005
2 CPallini 2,473
3 Richard MacCutchan 1,547
4 Abhinav S 1,507


Advertise | Privacy | Mobile
Web04 | 2.8.140814.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100