Menu

Format specifiers for Double values

Developer
2005-12-10
2013-05-20
  • Paul Corner

    Paul Corner - 2005-12-10

    Getting to grips with tinyxml and got a small suggestion to make regarding the format specifiers in SetDoubleAttribute and SetDoubleValue. Rather than using %f or %lf, both of which limit precision to six decimal places, I humbly suggest using %.16g - This has the advantage of supressing trailing zeros and extending the precision to the full range of a double.

    Regards, Paul.

     
    • Lee Thomason

      Lee Thomason - 2005-12-15

      Good idea. Has %g been in the c stdlib since the beginning, or is it a recent addition?

      thanks,
      lee

       

Log in to post a comment.

MongoDB Logo MongoDB