truncated int?

This is a discussion on truncated int? within the C Programming forums, part of the General Programming Boards category; I need to write a function that takes 2 floats and returns the truncated integer average of the two floats. ...

  1. #1
    Unregistered
    Guest

    truncated int?

    I need to write a function that takes 2 floats and returns the truncated integer average of the two floats.
    What is a truncated integer?
    Thanks

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >What is a truncated integer?
    Code:
    trunĚcate   Pronunciation Key  (trngkt)
    tr.v. trunĚcatĚed, trunĚcatĚing, trunĚcates 
      1. To shorten by or as if by cutting off. See Synonyms at shorten. 
      2. To shorten (a number) by dropping one or more digits after the decimal point.
    In other words, find the average and assign that value to an integer. But be very careful with the floating-point values you assign to an integer, the rules that C has for such conversions can often result in undefined behavior.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  2. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  3. getting a headache
    By sreetvert83 in forum C++ Programming
    Replies: 41
    Last Post: 09-30-2005, 06:20 AM
  4. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM
  5. easy if you know how to use functions...
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 01-31-2002, 07:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21