/* Realni tipovi podataka */

/* C99 kod - npr. mesanje deklaracija i koda */

#include <stdio.h>
#include <float.h>

int main() {
  /* Rasponi */
  float f_min = FLT_MIN;
  float f_max = FLT_MAX;
  printf("float [%g, %g]\n", f_min, f_max);
  printf("float [%f, %f]\n", f_min, f_max);
  printf("float - decimal digits: %d\n", FLT_DIG);
  printf("Size of float is %d bytes\n", sizeof(float));

  double d_min = DBL_MIN;
  double d_max = DBL_MAX;
  printf("double [%g, %g]\n", d_min, d_max);
  printf("double [%f, %f]\n", d_min, d_max);
  printf("double - decimal digits: %d\n", DBL_DIG);
  printf("Size of double is %d bytes\n", sizeof(double));

  long double ld_min = LDBL_MIN;
  long double ld_max = LDBL_MAX;
  printf("long double [%Lg, %Lg]\n", ld_min, ld_max);
  printf("long double [%Lf, %Lf]\n", ld_min, ld_max);
  printf("long double - decimal digits: %d\n", LDBL_DIG);
  printf("Size of long double is %d bytes\n", sizeof(long double));

  float f1 = 1.3f;      /* f naglasava da je float literal u pitanju */
  printf("float f1 = 1.3f; --> f1 = %f\n", f1);
  float f2 = .3e7f;     /* Literali se mogu zapisivati i u naucnoj notaciji */
  printf("float f2 = .3e7f; --> f2 = %f\n", f2);
  float f3 = 34.56f;    /* Vrednosti se predstavljaju samo do na odredjenu preciznost */
  printf("float f3 = 34.56f; --> f3 = %f\n", f3);
  float f4 = 123456789;         /* Konverzija celobrojnog literala - opet problem sa preciznoscu */
  printf("float f4 = 123456789; --> f4 = %f\n", f4);
  float f5 = 0.1;       /* f nije navedeno - konverzija double literala */
  printf("float f5 = 0.1f; --> f5 = %f\n", f5);

  double d1 = 34.56;    /* Double ima vecu preciznost */
  printf("double d1 = 34.56f; --> d1 = %f\n", d1);
  double d2 = 123456789;
  printf("double d2 = 123456789; --> d2 = %f\n", d2);

}