EmbLogic's Blog

float

i declared a float and initialize it to 69.01
now when i print this float it prints 69.010002
& when initialize it to 69.02 it prints 69.019997,
when initialize it to 69.6969 it prints 69.696899,
when initialize it to 696969.696969 it prints 696969.687500,
but when initialize it to 69.696968 it prints 69.696968

why…???

One Response to float

  1. ishmeet says:

    float is treated as long value so its 8 bytes..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>