Ignore:
Timestamp:
Feb 10, 2016, 3:57:00 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
6ba0659, cce7872
Parents:
bd85400
Message:

syslib updates and examples, formatting, make double 0 work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream.c

    rbd85400 r52f85e0  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb  1 14:20:30 2016
    13 // Update Count     : 60
     12// Last Modified On : Wed Feb 10 15:48:46 2016
     13// Update Count     : 66
    1414//
    1515
     
    1919#include <stdio.h>
    2020#include <string.h>                                                                             // strlen
     21#include <float.h>                                                                              // DBL_DIG, LDBL_DIG
    2122#include <complex.h>                                                                    // creal, cimag
    2223}
     
    7273ostype * ?|?( ostype *os, double d ) {
    7374        char buffer[32];
    74         return write( os, buffer, sprintf( buffer, "%g", d ) );
     75        return write( os, buffer, sprintf( buffer, "%.*lg", DBL_DIG, d ) );
    7576} // ?|?
    7677
     
    7879ostype * ?|?( ostype *os, long double d ) {
    7980        char buffer[32];
    80         return write( os, buffer, sprintf( buffer, "%Lg", d ) );
     81        return write( os, buffer, sprintf( buffer, "%.*Lg", LDBL_DIG, d ) );
    8182} // ?|?
    8283
Note: See TracChangeset for help on using the changeset viewer.