Skip to content

use showpoint instead of fixed

Gerhard Raven requested to merge lhcb/Gaudi:use-showpoint-in-genconf into master

std::fixed does not properly show numbers smaller then the number of digits shown -- it effectively truncates them to zero. std::showpoint will conserve them.
This is demonstrated by eg.

#include <iostream>
#include <sstream>

int main() {
    double d = 1.e-12;

    std::ostringstream ss; ss.setf( std::ios::showpoint );
    std::ostringstream sf; sf.setf( std::ios::fixed );

    ss << d ;
    sf << d ;

    std::cout << ss.str() << std::endl;
    std::cout << sf.str() << std::endl;
}

which outputs

1.00000e-12
0.000000

Merge request reports