I'm watching over the type_traits
, and accidentally came across the fact, that float
is not considered to be an integral type. It was kinda surprise for me.
I looked through the web to find appropriate information, but couldn't find anything concerning that fact. All I could find is something like this:
If T is an integral type (bool, char, char16_t, char32_t, wchar_t, short, int, long, long long, including any signed, unsigned, and cv-qualified variants), provides the member constant value equal true. For any other type, value is false.
So the question here: Why did the C++ Standards Committee decide that float is not an integral type?
An integral type is one which has only integers - whole numbers. The purpose of floating point types is to represent non-integers as well.
There are four main types of data: string, integer, float, and boolean. Of these, only boolean is not an integral data type.
An integer is a whole number and a floating-point value, or float, is a number that has a decimal place.
Integral data types are data types that represent whole numbers. They are used to store data that cannot be fractional, such as counts or measurements. Integral data types are typically stored as 32-bit or 64-bit values.
An integral type is one which has only integers - whole numbers. The purpose of floating point types is to represent non-integers as well.
From the Wikipedia page on integer (computer science):
In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With