Jump to content
Sign in to follow this  
n4gix

float64 and uint32 code?

Recommended Posts

Guest timewaster

What does float64 and uint32 do...I understand the rest of the c codemostly but these have me stumped. I looked through the tutorial coming up with nothing. thx for any help (:

Share this post


Link to post
Share on other sites

>What does float64 and uint32 do...I understand the rest of>the c code>mostly but these have me stumped. I looked through the>tutorial coming up with nothing. thx for any help (:float and FLOAT32 are a declarations for a 4 byte floating point variable.double and FLOAT64 are all declarations for an 8 byte floating point variable. Floating point number data from -1.79E + 308 through 1.79E + 308.int is a declaration for a 4 byte integer variable. Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647).UINT32 is a declaration for an "unsigned" integer variableSINT32 is a declaration for a "signed" integer variableConfusing? Certainly, but why all the various ways to declare variables? Part of the answer lies in realizing that the explicit declaration types such as FLOAT64, UINT32, SINT32, et all are part of an older set of C specifications.Better coding will make use of the newer "C Standards" which allow for the data declarations to "fit best" for the machine on which the code is being run, such as int, float, double, etc.*The idea is to fit the types to the machine. On an IBM PC running Windows 3.1, for example, an int and a short are both 16 bits, and a long is 32 bits. On a Windows XP machine or a Macintosh PowerPC, however, a short is 16 bits, and both int and long are 32 bits. The natural word size on a Pentium chip or a PowerPC G3 or G4 chip is 32 bits. Because this allows integers in excess of 2 billion (see Table 3.3), the implementers of C on these processor/operating system combinations did not see a necessity for anything larger; therefore, long is the same as int. For many uses, integers of that size are not needed, so a space-saving short was created. The original IBM PC, on the other hand, has only a 16-bit word, which means that a larger long was needed.Now that 64-bit processors, such as the IBM Itanium, AMD Opteron, and PowerPC G5, are beginning to become more common, there's a need for 64-bit integers, and that's the motivation for the long long type.The most common practice today is to set up long long as 64 bits, long as 32 bits, short as 16 bits, and int to either 16 bits or 32 bits, depending on the machine's natural word size. In principle, however, these four types could represent four distinct sizes.The C standard provides guidelines specifying the minimum allowable size for each basic data type. The minimum range for both short and int is


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest timewaster

(After picking my chin of the floor). If im understanding this, float 32/64 is how much "juice" needed to spend on the varible.(ive noticedmost gauges use 64) >UINT32 is a declaration for an "unsigned" integer variableuint 32 is to decide(im tured of when bla bla bla)>SINT32 is a declaration for a "signed" integer variableTo go get data and ajust your gauge....Am I right?:-hmmm

Share this post


Link to post
Share on other sites

To make life more simple, stick to these three basic declarations:int (four bytes) Use for integers, i.e. whole numbersfloat (eight bytes) Use for floating point, i.e., numbers with decimalsbool (one byte) Use for simple on/off variables, i.e., "true" or "false"Let the computer running the .dll worry about the rest. It will automatically set aside the minimum amount of memory needed for each variable you declare. ;)And no, 32 and 64 simply designate how many bytes of memory to set aside for the variable, IOW you are forcing a specific number of bytes for each variable.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...