fork download
  1. #include <stdio.h>
  2. #include <locale.h>
  3.  
  4. int main()
  5. {
  6. setlocale(LC_ALL, "RU");
  7.  
  8. float f;
  9. double d;
  10. long double ld;
  11.  
  12.  
  13. f = -50.15;
  14. d = -50.15;
  15. ld = -50.15;
  16.  
  17.  
  18. printf("-50.15 in float type: %.40e", f);
  19. printf("\n-50.15 in double type: %.40e", d);
  20. printf("\n-50.15 in long double type: %.40Le", ld);
  21.  
  22. f = 1.3756e+20;
  23. d = 1.3756e+20;
  24. ld = 1.3756e+20;
  25.  
  26.  
  27. printf("\n\n1.3756e+20 in float type: %.40e", f);
  28. printf("\n1.3756e+20 in double type: %.40e", d);
  29. printf("\n1.3756e+20 in long double type: %.40Le", ld);
  30.  
  31.  
  32. f = 1.3756e-20;
  33. d = 1.3756e-20;
  34. ld = 1.3756e-20;
  35.  
  36.  
  37. printf("\n\n1.3756e-20 in float type: %.40e", f);
  38. printf("\n1.3756e-20 in double type: %.40e", d);
  39. printf("\n1.3756e-20 in long double type: %.40Le", ld);
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
-50.15 in float type:       -5.0150001525878906250000000000000000000000e+01
-50.15 in double type:      -5.0149999999999998578914528479799628257751e+01
-50.15 in long double type: -5.0149999999999998578914528479799628257751e+01

1.3756e+20 in float type:       1.3755999650807860428800000000000000000000e+20
1.3756e+20 in double type:      1.3756000000000000000000000000000000000000e+20
1.3756e+20 in long double type: 1.3756000000000000000000000000000000000000e+20

1.3756e-20 in float type:       1.3756000662059779092054106683362668661630e-20
1.3756e-20 in double type:      1.3756000000000000942152312507737451942692e-20
1.3756e-20 in long double type: 1.3756000000000000942152312507737451942692e-20