value will not fit in type!!

This is a discussion on value will not fit in type!! within the Windows Programming forums, part of the Platform Specific Boards category; I need to put -3.402823e38 into a 2d 32bit float safearray, however vc7 converts this value to -3.402821e38 when I ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    10

    value will not fit in type!!

    I need to put -3.402823e38 into a 2d 32bit float safearray, however vc7 converts this value to -3.402821e38 when I try to assign this value to a float??

    WHY??

  2. #2
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    Because it stores numbers as a binary decimal, not every number can necessarily be stored with perfect precision in that form.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    You may want to use double, which is much more precise, because it uses 8bytes instead of 4.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 02:17 PM
  2. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  3. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

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