Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    r3c5dee4 r0efb269  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 13 12:46:45 2019
    13 // Update Count     : 650
     12// Last Modified On : Sat Apr 20 14:02:43 2019
     13// Update Count     : 617
    1414//
    1515
     
    2323extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
    2424#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    25 #include <math.h>                                                                               // modff, modf, modlf
    2625#include <complex.h>                                                                    // creal, cimag
    2726}
     
    157156                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    158157                fmt( os, "%g", f );
    159                 float tempi;
    160                 if ( isfinite( f ) && modff( f, &tempi ) == 0.0F ) fmt( os, "." ); // always print decimal point
    161158                return os;
    162159        } // ?|?
     
    168165                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    169166                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 point
    173167                return os;
    174168        } // ?|?
     
    180174                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
    181175                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 point
    185176                return os;
    186177        } // ?|?
     
    191182        ostype & ?|?( ostype & os, float _Complex fc ) {
    192183                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 ) );
    200185                return os;
    201186        } // ?|?
     
    206191        ostype & ?|?( ostype & os, double _Complex dc ) {
    207192                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 ) );
    216194                return os;
    217195        } // ?|?
     
    222200        ostype & ?|?( ostype & os, long double _Complex ldc ) {
    223201                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 ) );
    232203                return os;
    233204        } // ?|?
     
    523494        } // ?|?
    524495
     496
    525497        // manipulators
    526498        istype & ?|?( istype & is, istype & (* manip)( istype & ) ) {
     
    529501
    530502        istype & nl( istype & is ) {
    531                 fmt( is, "%*[^\n]" );                                                   // ignore characters to newline
     503                fmt( is, "%*[ \t\f\n\r\v]" );                                   // ignore whitespace
    532504                return is;
    533505        } // nl
Note: See TracChangeset for help on using the changeset viewer.