Advertisement
luizaspan

Precisão float e double

Apr 30th, 2015
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. // precisão float e double
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(void)
  6. {
  7.  
  8.   float x=1.01020304050607080900;
  9.   double y=1.01020304050607080900;
  10.  
  11.   printf("\n%22.20f <- float\n",x);
  12.   printf("1.01020304050607080900 <- original\n");
  13.   printf("%22.20f <- double\n\n",x);
  14.  
  15.   return 0;
  16.  
  17. }
  18.  
  19. // pensar no número em notação científica
  20. // float: 7 digitos significativos (=6 depois da virgula) como 1.01020304050607080900 -> 1.020304e-8
  21. // double: 16 dígitos significativos (=15 depoisa da virgula)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement