Thread: truncated int?

  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,897
    >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, 02: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, 05: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