Changes in libcfa/src/iostream.cfa [3c5dee4:0efb269]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r3c5dee4 r0efb269 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 13 12:46:45201913 // Update Count : 6 5012 // Last Modified On : Sat Apr 20 14:02:43 2019 13 // Update Count : 617 14 14 // 15 15 … … 23 23 extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))); 24 24 #include <float.h> // DBL_DIG, LDBL_DIG 25 #include <math.h> // modff, modf, modlf26 25 #include <complex.h> // creal, cimag 27 26 } … … 157 156 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 158 157 fmt( os, "%g", f ); 159 float tempi;160 if ( isfinite( f ) && modff( f, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point161 158 return os; 162 159 } // ?|? … … 168 165 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 169 166 fmt( os, "%.*lg", DBL_DIG, d ); 170 // fmt( os, "%lg", d );171 double tempi;172 if ( isfinite( d ) && modf( d, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point173 167 return os; 174 168 } // ?|? … … 180 174 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 181 175 fmt( os, "%.*Lg", LDBL_DIG, ld ); 182 // fmt( os, "%Lg", ld );183 long double tempi;184 if ( isfinite( ld ) && modfl( ld, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point185 176 return os; 186 177 } // ?|? … … 191 182 ostype & ?|?( ostype & os, float _Complex fc ) { 192 183 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 193 float temp = crealf( fc ), tempi; 194 fmt( os, "%g", temp ); 195 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 196 temp = cimagf( fc ); 197 fmt( os, "%+g", temp ); 198 if ( isfinite( temp ) && modff( temp, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point 199 fmt( os, "i" ); 184 fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) ); 200 185 return os; 201 186 } // ?|? … … 206 191 ostype & ?|?( ostype & os, double _Complex dc ) { 207 192 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 208 double temp = creal( dc ), tempi; 209 fmt( os, "%.*lg", DBL_DIG, temp ); 210 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 211 temp = cimag( dc ); 212 fmt( os, "%+.*lg", DBL_DIG, temp ); 213 if ( isfinite( temp ) && modf( temp, &tempi ) == 0.0D ) fmt( os, "." ); // always print decimal point 214 fmt( os, "i" ); 215 // fmt( os, "%lg%+lgi", creal( dc ), cimag( dc ) ); 193 fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) ); 216 194 return os; 217 195 } // ?|? … … 222 200 ostype & ?|?( ostype & os, long double _Complex ldc ) { 223 201 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 224 long double temp = creall( ldc ), tempi; 225 fmt( os, "%.*Lg", LDBL_DIG, temp ); 226 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 227 temp = cimagl( ldc ); 228 fmt( os, "%+.*Lg", LDBL_DIG, cimagl( ldc ) ); 229 if ( isfinite( temp ) && modfl( temp, &tempi ) == 0.0L ) fmt( os, "." ); // always print decimal point 230 fmt( os, "i" ); 231 // fmt( os, "%Lg%+Lgi", creall( ldc ), cimagl( ldc ) ); 202 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 232 203 return os; 233 204 } // ?|? … … 523 494 } // ?|? 524 495 496 525 497 // manipulators 526 498 istype & ?|?( istype & is, istype & (* manip)( istype & ) ) { … … 529 501 530 502 istype & nl( istype & is ) { 531 fmt( is, "%*[ ^\n]" ); // ignore characters to newline503 fmt( is, "%*[ \t\f\n\r\v]" ); // ignore whitespace 532 504 return is; 533 505 } // nl
Note: See TracChangeset
for help on using the changeset viewer.