I don't get it.
In Codewarrior for Mac OS 9.4, numeric_limits<unsigned char>::digits10 == 2.
Unless I don't understand it properly (most likely!) I thought digits10 was
supposed to represent the number of digits (in base 10) a value of this type
needs. In that case, shouldn't digits10 be 3 for an unsigned char (i.e. 255
can be represented using 3 base 10 digits?), 5 for a 16-bit unsigned short,
10 for 32-bit unsigned int, etc.??
Whereas, in Codewarrior they are 2, 4 and 9 respectively.
The C++ spec (14882), section 18.2.1.2 para 9 states that its 'Number of
base 10 digits that can be represented without change'
I don't think I understand the whole sentence then, but mostly the '...
without change' bit.
Would somebody be kind enough to elaborate please.
Thanks very much.
--
Regards,
Steve. 2 2337
"Steve" <ro**@127.0.0.1> wrote in message
news:BE343B2E.C4B1D%ro**@127.0.0.1... I don't get it.
In Codewarrior for Mac OS 9.4, numeric_limits<unsigned char>::digits10 ==
2. Unless I don't understand it properly (most likely!) I thought digits10
was supposed to represent the number of digits (in base 10) a value of this
type needs. In that case, shouldn't digits10 be 3 for an unsigned char (i.e.
255 can be represented using 3 base 10 digits?), 5 for a 16-bit unsigned
short, 10 for 32-bit unsigned int, etc.??
I am just guessing here, but 2 10 base digits would guarantee me 0..99,
while 3 10 base digits would guarantee me 0..999.
Whereas, in Codewarrior they are 2, 4 and 9 respectively.
The C++ spec (14882), section 18.2.1.2 para 9 states that its 'Number of base 10 digits that can be represented without change'
I don't think I understand the whole sentence then, but mostly the '... without change' bit.
Would somebody be kind enough to elaborate please.
Thanks very much.
-- Regards, Steve.
"Steve" <ro**@127.0.0.1> wrote... I don't get it.
In Codewarrior for Mac OS 9.4, numeric_limits<unsigned char>::digits10 == 2.
Unless I don't understand it properly (most likely!) I thought digits10 was supposed to represent the number of digits (in base 10) a value of this type needs. In that case, shouldn't digits10 be 3 for an unsigned char (i.e. 255 can be represented using 3 base 10 digits?), 5 for a 16-bit unsigned short, 10 for 32-bit unsigned int, etc.??
Whereas, in Codewarrior they are 2, 4 and 9 respectively.
The C++ spec (14882), section 18.2.1.2 para 9 states that its 'Number of base 10 digits that can be represented without change'
I don't think I understand the whole sentence then, but mostly the '... without change' bit.
If std::numeric_limits<unsigned char>::digits10 were 3, it would claim that
all numbers from 0 to 999 could be represented. That's not true. unsigned
char on your system cannot represent values above 255 without slashing the
high-order bits (or, IOW, changing the value).
V This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Neil Zanella |
last post by:
Hello,
I would like to ask how come the design of C++ includes
std::pair. First of all I don't think many programmers
would use it. For starters, what the first and second
members are depends...
|
by: Dave |
last post by:
Hello all,
Is is allowable for me to specialize numeric_limits<> for my own numeric
type? Does this violate any sort of rule against mucking with std?
Thanks,
Dave
|
by: Jamie Burns |
last post by:
Hello,
I just did a simple benchmark:
for (xx=0;xx<100000;xx++) {
rDerived* derived = dynamic_cast<rDerived*>(object);
if (derived) derived->setValue(message.data.messageSetInt.value);
}
...
|
by: Peter Notebaert |
last post by:
I am new to Python and have to create an import library in C that uses
matrices.
These matrices can be one-dimensional (vectors) or two-dimensional. If I
look in the ActivePython 2.4...
|
by: davihigh |
last post by:
My Friends:
I am using std::ofstream (as well as ifstream), I hope that when i
wrote in some std::string(...) with locale, ofstream can convert to
UTF-8 encoding and save file to disk. So does...
|
by: rhythmace |
last post by:
W3C HTML validator passes this:
....
<script type="text/javascript" src="foo.js">
<script type="text/javascript">
....script in here...
</script>
....
|
by: Grizlyk |
last post by:
Hello.
Returning to question of manual class type identification, tell me, for
ordinary inheritance is C++ garantee that
dynamic_cast<Derived*>(Base*)
can be implemented similarly to
...
|
by: john |
last post by:
The code:
#include <iostream>
#include <limits>
int main()
{
using namespace std;
|
by: Peter |
last post by:
I have a WebService which returns a List of RunningReport class
How do I read this XML data on the client side. How do I convert
List<RunningReportfrom the WebService side to List<RunningReporton...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |