Thread: short cut of floating point values

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

    short cut of floating point values

    Hi need to know that if I have the following code:
    float j;
    j=.000004
    instead of writing .000004 is there a short cut like Fortran 1.0e-6?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Have you tried it? If you had you'd find that 1.0e-6 worked just like you have it.

    Code:
    itsme@itsme:~/C$ cat scientific.c
    #include <stdio.h>
    
    int main(void)
    {
      float f = 4e-6;
    
      printf("%f\n", f);
    
      return 0;
    }
    Code:
    itsme@itsme:~/C$ gcc -Wall scientific.c -o scientific
    itsme@itsme:~/C$ ./scientific
    0.000004
    itsme@itsme:~/C$
    Last edited by itsme86; 05-12-2006 at 12:44 PM.
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. floating point number comparison
    By lehe in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2009, 07:11 PM
  2. For the numerical recipes in C types!
    By Smattacus in forum C Programming
    Replies: 5
    Last Post: 10-28-2008, 07:57 PM
  3. 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
  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. Color Variety
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 10-23-2002, 09:17 AM