Why can't decimal numbers be represented exactly in binary?

前端 未结 20 3426
不知归路
不知归路 2020-11-21 05:15

There have been several questions posted to SO about floating-point representation. For example, the decimal number 0.1 doesn\'t have an exact binary representation, so it\'

20条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 05:30

    BCD - Binary-coded Decimal - representations are exact. They are not very space-efficient, but that's a trade-off you have to make for accuracy in this case.

提交回复
热议问题