Float value

This is a discussion on Float value within the C Programming forums, part of the General Programming Boards category; Hi all, I am working for a project which has 8051 micro, I will not be able have float lib ...

  1. #1
    vicky ved
    Guest

    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.
    vicky

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

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

  4. #4
    Unregistered
    Guest
    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, 04:25 PM
  2. Replies: 14
    Last Post: 06-28-2006, 02: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, 12:58 PM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM

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