forked from blau_araujo/pbn
exemplos da aula 9
This commit is contained in:
parent
4f2579468b
commit
e1afe4c5b0
2 changed files with 29 additions and 0 deletions
15
curso/exemplos/09/flimits.c
Normal file
15
curso/exemplos/09/flimits.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <stdio.h>
|
||||
#include <float.h> // Para as precisões
|
||||
|
||||
int main(void) {
|
||||
printf("float max : %e\n", FLT_MAX);
|
||||
printf("float max : %e\n", -FLT_MAX);
|
||||
|
||||
printf("double max : %e\n", DBL_MAX);
|
||||
printf("double max : %e\n", -DBL_MAX);
|
||||
|
||||
printf("long double max: %Le\n", LDBL_MAX);
|
||||
printf("long double max: %Le\n", -LDBL_MAX);
|
||||
|
||||
return 0;
|
||||
}
|
14
curso/exemplos/09/precision.c
Normal file
14
curso/exemplos/09/precision.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#include <float.h> // Para as precisões
|
||||
|
||||
int main(void) {
|
||||
float f = 10.0 / 3.0;
|
||||
double d = 10.0 / 3.0;
|
||||
long double ld = 10.0L / 3.0L;
|
||||
|
||||
printf("float (%d): %.20f\n", FLT_DIG, f);
|
||||
printf("double (%d): %.20lf\n", DBL_DIG, d);
|
||||
printf("long double (%d): %.20Lf\n", LDBL_DIG, ld);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue