floating point array

This is a discussion on floating point array within the C# Programming forums, part of the General Programming Boards category; how do i create a floating point array, the only way i have been able to compile a float type ...

  1. #1
    budding software engineer luigi40's Avatar
    Join Date
    Jun 2004
    Location
    South Coast UK
    Posts
    61

    Question floating point array

    how do i create a floating point array, the only way i have been able to compile a float type array is using the 'F' suffix however that would be rather tedious for a 100 element array which is what the book is asking for?

    Code:
    float[] x = {6.8F};
    also a search on google/this board only reveals type double, does this mean when the book says 'floating-point array' they mean type double?
    You will never know unless you try!

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    In general, I always use doubles instead of floats. I think that floats are implicitly converted to doubles whenever you call one of the built-in functions that operate on floats. That'll also solve the F thing.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    budding software engineer luigi40's Avatar
    Join Date
    Jun 2004
    Location
    South Coast UK
    Posts
    61

    reply

    In general, I always use doubles instead of floats. I think that floats are implicitly converted to doubles whenever you call one of the built-in functions that operate on floats. That'll also solve the F thing.
    yes i agree the reason i asked was that the question in the Deitel book says
    Determine the smallest and largest values contained in 99-element floating point array w
    i thought it would be a pain to have to write an algorithm just to append the F suffix to each element. i guess i just use double and not worry about it
    You will never know unless you try!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. checking for floating point number
    By ssharish2005 in forum C Programming
    Replies: 6
    Last Post: 10-18-2005, 09:14 PM
  2. Floating point #'s, why so much talk about it?
    By scuzzo84 in forum C Programming
    Replies: 5
    Last Post: 09-20-2005, 05:29 PM
  3. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 08:48 PM
  4. Illegal use of floating point...(In C)
    By OmnipotentCow in forum C Programming
    Replies: 5
    Last Post: 05-31-2003, 07:26 PM
  5. Replies: 2
    Last Post: 09-10-2001, 01:00 PM

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