different values for float and double

前端 未结 5 549
独厮守ぢ
独厮守ぢ 2021-01-08 01:16

I don\'t understand why are float values different from double values. From the example bellow it appears that float provides different result than double for the same opera

5条回答
  •  灰色年华
    2021-01-08 01:41

    Floats have less precision than doubles.

    It's roughly half as much - 23 bits vs 52 for double(Thanks a lot Mr. Skeet!)!

    32-bit for floats, 64-bit for doubles. ...Remember that the word "float" has fewer letters than "double", that's a "memory" trick :)

提交回复
热议问题