C/C++: calculer le logarithme naturel d’un nombre

Author:

 calcul
{filelink=14002}

#include

#include 

int main(void)
{
double x[ ] = { 1E-100, 0.5, 2, exp(1), 10, 1E+100 };

puts("       x           log(x)           log10(x)n"
     " ----------------------------------------------");
for ( int i = 0; i < sizeof(x) / sizeof(x[0]); ++i )
{
  printf("%#10.3G  %+17.10G %+17.10Gn",
         x[i],  log(x[i]), log10(x[i]) );
}

  return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *