Thread: Float value

  1. #1
    vicky ved

    Post Float value

    Hi all,
    I am working for a project which has 8051 micro, I will not be able have float lib in the project due to the size but have to do float calc.
    so I plan to write my own function for the same
    like for
    finding 25/6 = 4 1/6
    now I need to represent the floating point in 11bits

    any ideas how to do it.

  2. #2
    Use 'Fixed Point'. Decide how much precision you need and that tells you where the decimal point will be.

  3. #3
    vicky ved
    OK Require to represent in 13.11 format and plan to use fixed ponit only. but how do I do it now.

  4. #4
    If you always want two point percision, store 13.11 as 1311. With 11 bits you can store a number up to 2048 unsigned (which would mean a number up to 20.48). That's about as good as you can get without more bits.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  3. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 02:19 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM