Sorry for the all caps up above, I was trying to prove a point. This one is short and sweet – have you ever had a problem importing points from an external file? Did your point numbers happen to be pretty high? I mean high as in the 4 billion range – that’s a 4 with nine zeroes after it. I haven’t – until a few days ago. A user sent in a point file with really high numbers, and they wouldn’t import. I had a hunch that the high numbers had something to do with it, so I spoke with some members of our development team about it. I’m about to get into a detailed math discussion, so you might want to learn more after the jump.
To really discuss this, let’s talk about signed integers and unsigned integers. An integer is a whole number. The number can have a positive value, a negative value, or no value (zero.) With respect to computer programming, any number is stored as bits - ones and zeroes – binary code. When a computer program is written, the programmer must decide how many bits are used to store any given number.
Most modern computers store memory in units of 8 bits, also called a byte. Math in these computers can be done using bytes, but is most often done in much larger units – these larger units are short integers (16 bits), long integers (32 bits) or double integers (64 bits.) The following is the number range that each integer type can store for unsigned integers:
Short Integers – any number between 0 and 216-1, or 65,535.
Long Integers – any number between 0 and 232-1, or 4,294,967,295.
Double Integers – any number between 0 and 264-1, or 18,446,744,73,709,551,615.
Now let’s look at the number range that each integer type can store for signed integers:
Short Integers: any number between –32,768 to 32,767
Long Integers: any number between –2,147,483,648 to 2,147,483,647
Double Integers: any number between –9,223,372,036,854,775,808 to 92,223,372,036,854,775,807.
(note – the above information was taken from this website and offers much more in-depth information on this subject.)
Armed with this knowledge and knowing that some of the code for Civil 3D still has to be 32 bit compatible, we can realize that no number can be longer than a long integer when working with points. Furthermore, some code requires the use of signed integers, which further reduces the numeric availability for certain tasks – importing points being one of those.
My customer had his reasons for the large point numbers, but once I told him to reduce them to fall into the correct range, everything worked smoothly. Keep this in mind if you ever find yourself in this same situation.