Scientific Notation

This is a discussion on Scientific Notation within the C Programming forums, part of the General Programming Boards category; Is there anyway to get a double type variable to print in scientific notation? My problem is to print some ...

  1. #1
    Unregistered
    Guest

    Question Scientific Notation

    Is there anyway to get a double type variable to print in scientific notation? My problem is to print some values to a file, but I end up with BIG values that would make MUCH more sense if I printed them in scientific notation.

  2. #2
    Unregistered
    Guest
    I think I solved the scientific notation problem, (the values were printed to a file, so I looked up fprintf) but one of my values is

    -1.#QNAN

    any idea why?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    NAN is Not A Number

    Undefined floating point results (eg. divide by 0) result in either a quiet NAN (QNAN) or a signalling NAN. A signalling NAN would have halted your program.

    Any operation on a NAN results in a NAN, so it doesn't go away just like that.

    Basically, you've got a math problem - either in the calculation, or because you're providing an uninitialised float as input.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Scientific notation
    By manzoor in forum C++ Programming
    Replies: 6
    Last Post: 11-13-2007, 09:46 AM
  2. Formating Scientific Notation Output
    By RedSoxFan in forum C Programming
    Replies: 2
    Last Post: 12-21-2005, 10:38 AM
  3. Scientific notation
    By Lionmane in forum C Programming
    Replies: 9
    Last Post: 06-02-2005, 12:10 AM
  4. Reading scientific notation
    By PunkyBunny300 in forum C Programming
    Replies: 1
    Last Post: 04-24-2003, 10:22 PM

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