Exemplo n.º 1
0
int main(void)
{
  int i;
  float h;
  float ergebnis, differenz;

  printf("\nWert von i   exp(1 + h) - exp(1)) / h      Fehler:");
  printf("\n==================================================\n");

  for (i=1; i<=22; i++)
    {
      h = float_pow(10,-i);   

      ergebnis = (float_exp(1 + h) - float_exp(1)) / h;

      differenz = ergebnis - float_exp(1);

      if (differenz<0)
        differenz = differenz * (-1.0);

      printf(" i = %d\t:  \t%.15f  ",i,ergebnis);
      printf(" \t%.15f\n",differenz);

    }
  return 0;
}
Exemplo n.º 2
0
Arquivo: utils.c Projeto: AEUG/400plus
void calculate_dof(int focal_length, int focus_distance, int av, char *min, char *max) {
	float fl =    1.0f * focal_length;
	float fd = 1000.0f * focus_distance;

	float fn = float_pow(2.0f, ((float)av / 8.0f - 1) / 2.0f); // Precise F-Number = 2^(n/2), 1/8 EV resolution
	float cof = 0.019f; // Circle of confusion

	// Hyperfocal
	float hf  = fl + fl * fl / (fn * cof);
	float aux = fd * (hf - fl) / 1000.0f;

	// Min distance
	display_float(min, aux / (hf + fd - 2.0f * fl));

	// Max distance
	if (hf >= fd)
		display_float(max, aux / (hf - fd));
	else
		sprintf(max, "%s", LP_WORD(L_S_INFINITE));
}