Thread: incorrect initialisation

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    55

    incorrect initialisation

    Hi,
    I've got an array of type float and when I initialise a number eg 9.04, it stores it as 9.03999996. Numbers are not exactly right, so why does this happen?
    I'm using linux, gcc 3.4.6, and ddd if this has anything to do with it...

    Cheers
    Spiros

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    55
    cheers!, the section on compairing numbers was a real eye openerr!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hash Table outputting incorrect number
    By Paul Skinner in forum C Programming
    Replies: 4
    Last Post: 11-20-2008, 06:19 AM
  2. Static member (map) / constructor initialisation problem
    By drrngrvy in forum C++ Programming
    Replies: 9
    Last Post: 12-28-2005, 12:03 PM
  3. It is not incorrect to use void main
    By momo20016 in forum A Brief History of Cprogramming.com
    Replies: 41
    Last Post: 12-22-2002, 10:17 AM
  4. Replies: 3
    Last Post: 07-24-2002, 08:46 AM
  5. 'The parameter is incorrect' - LoadImage
    By DarkAvenger in forum Windows Programming
    Replies: 1
    Last Post: 04-12-2002, 02:53 PM