Search
 
SCRIPT & CODE EXAMPLE
 

C

printf c float

printf("%.6f", myFloat);
Comment

print float in c

printf("%.6f", myFloat);
Comment

c printf float value

I want to print a float value which has 2 integer digits and 6 decimal digits after the comma. If I just use printf("%f", myFloat) I'm getting a truncated value.

I don't know if this always happens in C, or it's just because I'm using C for microcontrollers (CCS to be exact), but at the reference it tells that %f get just that: a truncated float.

If my float is 44.556677, I'm printing out "44.55", only the first two decimal digits.
Comment

PREVIOUS NEXT
Code Example
C :: c format specifiers 
C :: how to find sum of two nums 
C :: factorial in c using recursion 
C :: fast inverse square root explained 
C :: get current used proxy windows 7 
C :: scan numbers into array c 
C :: A binary tree whose every node has either zero or two children is called 
C :: c bit access struct 
C :: reverse list in C 
C :: selection sort in c 
C :: check prime number or not c 
C :: multiplicationin c 
C :: how to sort assending in c 
C :: how to modulo in c without use the operator 
C :: c for loop 
C :: strcasecmp c 
C :: c sleep milliseconds 
C :: int to char in c 
C :: measure time in c 
C :: HOW TO ADD FORM IN BOOTSTRAp 
C :: c sizeof operator 
C :: Bitwise Operators in C language 
C :: continue statement in c 
C :: pid of a process in c 
C :: open with overwrite c 
C :: c extern 
C :: threads in c 
C :: c check if character is lower case 
C :: C Syntax of goto Statement 
C :: C/AL Convertion of Decimal to String/Text 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =