How am I incorrectly using the round() function in C?

后端 未结 7 1650
-上瘾入骨i
-上瘾入骨i 2021-02-08 21:42

I\'m getting unexpected results from the round() and roundf() functions in the math.h library. Here is the sample code:

#         


        
7条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-08 21:57

    litb was on the right track. -std=c99 didn't work but adding #define _ISOC99_SOURCE worked. So the code looks like:

    #define _ISOC99_SOURCE
    #include 
    #include 
    
    int main(void)
    {
    ...
    

提交回复
热议问题