Project

General

Profile

« Previous | Next » 

Revision a9b87a15

Added by Pierre-Loïc Garoche about 5 years ago

Extending types to machine types

View differences:

include/io_frontend.c
78 78
  printf("\n");
79 79
  fprintf(file, "%d\n", _V);
80 80
}
81

  
82
void _put_float(FILE* file, char* n, float _V){
83
  if(ISATTY) {
84
    printf("%s = ", n);
85
  } else {
86
    printf("'%s': ", n);
87
  };
88
  printf("'%.*f' ", PREC, _V);
89
  printf("\n");
90
  fprintf(file, "%.*f\n", PREC, _V);
91
}
92

  
81 93
void _put_double(FILE* file, char* n, double _V){
82 94
  if(ISATTY) {
83 95
    printf("%s = ", n);
84 96
  } else {
85 97
    printf("'%s': ", n);
86 98
  };
87
  printf("'%f' ", _V);
99
  printf("'%.*f' ", PREC, _V);
88 100
  printf("\n");
89
  fprintf(file, "%f\n", _V);
101
  fprintf(file, "%.*f\n", PREC, _V);
90 102
}
include/io_frontend.h
22 22
/*@ assigns \nothing; */
23 23
extern void _put_int(FILE* file, char* n, int _V);
24 24

  
25
/*@ assigns \nothing; */
26
extern void _put_float(FILE* file, char* n, float _V);
27

  
25 28
/*@ assigns \nothing; */
26 29
extern void _put_double(FILE* file, char* n, double _V);
27 30

  
include/io_frontend.hpp
70 70
  printf("\n");
71 71
  fprintf(file, "%i\n", _V);
72 72
}
73

  
73 74
void _put_int(FILE* file, char* n, int _V){
74 75
  if(ISATTY) {
75 76
    printf("%s = ", n);
......
80 81
  printf("\n");
81 82
  fprintf(file, "%d\n", _V);
82 83
}
84

  
85
void _put_float(FILE* file, char* n, float _V){
86
  if(ISATTY) {
87
    printf("%s = ", n);
88
  } else {
89
    printf("'%s': ", n);
90
  };
91
  printf("'%.*f' ", PREC, _V);
92
  printf("\n");
93
  fprintf(file, "%.*f\n", PREC, _V);
94
}
95

  
83 96
void _put_double(FILE* file, char* n, double _V){
84 97
  if(ISATTY) {
85 98
    printf("%s = ", n);
86 99
  } else {
87 100
    printf("'%s': ", n);
88 101
  };
89
  printf("'%f' ", _V);
102
  printf("'%.*f' ", PREC, _V);
90 103
  printf("\n");
91
  fprintf(file, "%f\n", _V);
104
  fprintf(file, "%.*f\n", PREC, _V);
92 105
}
93 106

  
94 107
#endif

Also available in: Unified diff