How to use % operator for float values in c

前端 未结 6 461
故里飘歌
故里飘歌 2020-12-03 14:30

When I use % operator on float values I get error stating that \"invalid operands to binary % (have ‘float’ and ‘double’)\".I want to enter the integers value only but the n

6条回答
  •  無奈伤痛
    2020-12-03 15:29

    You're probably better off using long long, which has greater precision than double in most systems.

    Note: If your numbers are bigger than a long long can hold, then fmod probably won't behave the way you want it to. In that case, your best bet is a bigint library, such as this one.

提交回复
热议问题