# digit « float « C Data Type Q&A

Home
C Data Type Q&A
 1 binary 2 bit 3 byte 4 char 5 character 6 decimal 7 Development 8 float 9 hex 10 integer 11 prime 12 random 13 struct
 C Data Type Q&A » float » digit

### 1. counting float digits (hw) C    stackoverflow.com

i need to count digits from a float number and keep the number. i can use scanf for %f or %c but not %s, and i can use getchar(). i can use ...

### 2. Get precision of about 20-30 digits in C    stackoverflow.com

So, I'm trying to calculate a certain value to a rather large precision. The expression in C is:

``````long double t = 2.0L+.2L*(sp)+s.missRate*50L;
``````
my result is: `11.575345` But the 'real' result is: `11.575345222971968` I'm ...

### 3. Fortran/C Interlanguage problems: results differ in the 14th digit    stackoverflow.com

I have to use C and Fortran together to do some simulations. In their course I use the same memory in both programming language parts, by defining a pointer in C ...

### 4. I can print digits with putchar but how to print floats with put char?    cboard.cprogramming.com

double atof(char s[]) { double val, power; int i, sign; for(i=0;isspace(s[i]); i++)// skip white space ; sign = (s[i] == '-') ? -1 : 1; if (s[i] == '+' || s[i] == '-') i++; for (val =0.0; isdigit(s[i]);i++) val = 10.0 * val + (s[i]-'0'); if (s[i] == '.') i++; for(power = 1.0; isdigit(s[i]); i++) { val = 10.0 * val ...