Maximum Digits and Bits for C++ unsigned long double

  • Context: Comp Sci 
  • Thread starter Thread starter Deathfish
  • Start date Start date
  • Tags Tags
    C++
Click For Summary

Discussion Overview

The discussion revolves around the maximum digits and bits allocated for the type "unsigned long double" in C++. Participants explore the definitions and distinctions between different data types in C++, particularly focusing on integer and floating-point types, and how these may vary based on the compiler and operating system.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant questions the existence of "unsigned long double," suggesting it is not part of the C++ standard and implies that using it indicates a non-compliant compiler.
  • Another participant seeks clarification on what the maximum values are, particularly in relation to the operating system's architecture (32-bit vs. 64-bit).
  • A further response clarifies the distinction between "unsigned long" (an integer type) and "long double" (a floating-point type), noting that their sizes depend on the specific C++ implementation and referencing the "limits.h" header file for maximum sizes.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the existence of "unsigned long double," with some asserting it is not standard while others seek to understand the implications of different data types and their maximum sizes.

Contextual Notes

The discussion highlights the potential confusion between integer and floating-point types, as well as the variability in type sizes across different C++ implementations and operating systems. There is no resolution on the maximum sizes due to these dependencies.

Deathfish
Messages
80
Reaction score
0
in C++, how many digits and how many bits is the maximum allocated for unsigned long double?
 
Physics news on Phys.org
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.
 
ok so what's the maximum then...

and how does having a 32-bit or 64-bit OS affect this?
 
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K