Click here to Skip to main content
15,887,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is some background. I'm handling some special I/O device which provides counts as a 32-bit DWORD. I must convert the DWORD to double precision integer or DINT. What is the difference between a DINT and 32-bit integer that we already know? How do I use a DINT? Thanks!
Posted
Updated 22-Nov-10 9:06am
v2
Comments
Alain Rist 22-Nov-10 15:47pm    
DINT is not a standard C++ type, it is probably defined somewhere you have access, otherwise you could not use it. Please provide the type definition. cheers,

I don't know how "Double Integer" got this name. After some digging, I am able to say its definition is actually identical to what we know as 32-bit integer today. The name seems to come from the legacy 16-bit world. This is an answer to my question.
 
Share this answer
 
v2
Comments
Alain Rist 29-Dec-10 2:27am    
What is the difference with the answer I gave one month ago?
Jun Du 29-Dec-10 8:12am    
Actually no big difference from your post dated Nov 23 (but not Nov 22). Didn't quite follow what you suggested there.
Alain Rist 29-Dec-10 10:26am    
Sorry, I didn't feel cryptic :)
Hi Jun,

Your DINT type looks like an exotic name for the good old INT defined in WinNT.h (a 32 bits signed integer on Windows supported 32 and 64 bits platforms).

So
#include <WinNT.h>
typedef INT DINT;
should be enough :)
cheers,
AR
 
Share this answer
 
Your question isn't quite clear because a double precision type is a floating point number. An integer is a whole number. You could also mean that you want QWORD instead od a DWORD. Meaning a 64 bit integer instead of 32 bit. The ISO C9X type for c would be long long and unsigned long long.

Whatever type you use, you should cast (or round floating points) properly.


http://www.cppreference.com/wiki/data_types[^]

http://msdn.microsoft.com/en-us/library/s3f49ktz%28VS.80%29.aspx[^]

Good luck!
 
Share this answer
 
Hi !!!

Could you please provides few lines, like where you are stucked exactly?I used dint() & aint() in fortran a long back. I will be much pleased to help you?
 
Share this answer
 
Comments
Jun Du 22-Nov-10 18:33pm    
This is the feedback I got from the vender:

"Double Integer. This is usually a 32-bit integer, with the 32nd bit being the sign bit. The lower and upper limits of a DINT are -2147483648 and 2147483647."

I am still struggling at what the difference is between this DINT and the 32-bit integer we used everyday.
Jun Du 30-Nov-10 14:26pm    
I don't know how "Double Integer" got this name. After some experiments, I am able to say its definition is actually identical to what we know as 32-bit integer today. Maybe the name came from the 16-bit legacy, I guess.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900