Maximum Digits and Bits for C++ unsigned long double

  • Comp Sci
  • Thread starter Deathfish
  • Start date
  • Tags
    C++
In summary, there is no such thing as an unsigned long double in standard C++. The maximum size of integer and floating point types depends on the C++ implementation, which can be found in the "limits.h" header file.
  • #1
Deathfish
86
0
in C++, how many digits and how many bits is the maximum allocated for unsigned long double?
 
Physics news on Phys.org
  • #2
None. There is no such thing as an unsigned long double, at least not in the standard. If you have such a beast you are using a non-compliant C++ compiler.
 
  • #3
ok so what's the maximum then...

and how does having a 32-bit or 64-bit OS affect this?
 
  • #4
What's the maximum of what? I think that you are confusing two different types: unsigned long (or unsigned long int) and long double.

The first is an integer type and the second is a floating point type. The sizes of these types depends on your particular C++ implementation. You should have a header file named "limits.h" that will indicate the largest sizes of ints, long ints, floats, doubles, and so on.
 
  • #5


The maximum number of digits and bits allocated for an unsigned long double in C++ varies depending on the specific compiler and system architecture being used. However, in general, the maximum number of digits for an unsigned long double is approximately 19 and the maximum number of bits is typically 64. This is due to the fact that an unsigned long double is typically represented using a 64-bit floating-point format, allowing for a maximum of 2^64 possible values. However, the exact number of digits and bits may differ slightly depending on the specific implementation. It is important for programmers to be aware of these limitations when working with unsigned long doubles in C++.
 

Related to Maximum Digits and Bits for C++ unsigned long double

1.

What is the purpose of the "unsigned long double" datatype in C++?

The "unsigned long double" datatype in C++ is a floating-point datatype that is used to store very large numbers with a high degree of precision. It is typically used for scientific and mathematical calculations where accuracy is critical.

2.

How does the "unsigned long double" datatype differ from other floating-point datatypes in C++?

The "unsigned long double" datatype differs from other floating-point datatypes in C++ in terms of the range of values it can store and the level of precision it offers. It can store larger numbers than the "float" and "double" datatypes, and has a higher precision than the "float" datatype.

3.

What is the size of the "unsigned long double" datatype in C++?

The size of the "unsigned long double" datatype in C++ may vary depending on the compiler and system architecture, but it is typically 8 bytes or 64 bits. This is twice the size of the "double" datatype, which is 4 bytes or 32 bits.

4.

Can the "unsigned long double" datatype be used for all types of calculations in C++?

Yes, the "unsigned long double" datatype can be used for all types of calculations in C++ that require a high level of precision and a large range of values. However, it is important to note that using this datatype may result in slower performance compared to other floating-point datatypes.

5.

Are there any potential drawbacks to using the "unsigned long double" datatype in C++?

One potential drawback of using the "unsigned long double" datatype in C++ is that it may not be supported by all compilers or systems, which could lead to compatibility issues. Additionally, since it is a larger datatype, it may take up more memory and potentially impact the performance of the program.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Programming and Computer Science
Replies
6
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
Back
Top