gil_mo
asked on
sprintf precision bug?
Using MSDEV 6.0 environment:
Consider the following:
sprintf( Buf,"%0.1f",0.85 ) ;
sprintf( Buf,"%0.1f",0.75 ) ;
In both cases, Buf is set to: "0.8".
Is this a bug? Can anyone detect the origination of this bug?
Consider the following:
sprintf( Buf,"%0.1f",0.85 ) ;
sprintf( Buf,"%0.1f",0.75 ) ;
In both cases, Buf is set to: "0.8".
Is this a bug? Can anyone detect the origination of this bug?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Even if the values were exact, rounding to even is the preferred mode for decimal numbers anyway, so you just happened to get the right answer depite the inaccuracy.
ASKER