Avoiding rounding in convert.tosingle method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ponsakthi
    New Member
    • Aug 2010
    • 1

    Avoiding rounding in convert.tosingle method

    consider ,

    object a =1.123456;

    float f = convert.ToSingl e(a);

    But when I print the value of f , I get 1.123455.

    It is getting rounded off.
    Also the problem is I cant change the data type of float in the code.
    Please help.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is that outside the realm of a float/single?
    You're starting with a double after all

    Comment

    Working...