Thread: floating point array

  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,401
    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, 08: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, 04:29 PM
  3. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  4. Illegal use of floating point...(In C)
    By OmnipotentCow in forum C Programming
    Replies: 5
    Last Post: 05-31-2003, 06:26 PM
  5. Replies: 2
    Last Post: 09-10-2001, 12:00 PM