Replacement for snprintf

Ali Çehreli acehreli at yahoo.com
Wed Oct 30 15:48:44 UTC 2019


On 10/30/2019 06:44 AM, berni44 wrote:
 > The only difference are rounding issues, when the number is
 > exactly between two adjacent ways of displaying. The implementation of
 > snprintf on my computer always rounds towards zero while mine rounds in
 > the opposite direction. (E.g. 0.125 rounded to two digits is 0.13 in my
 > implementation while it's 0.12 in snprintfs implementation)

The tie-breaker is to always round towards the even digit. So it should 
always produce 1.12, 1.14, etc.

Ali



More information about the Digitalmars-d mailing list