<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    День добрый!<br>
    <br>
    Подскажите, пожалуйста, почему такое поведение функции ceil:<br>
    <br>
    #include
    &lt;math.h&gt;                                                                                                                                           
    <br>
    #include
    &lt;stdio.h&gt;                                                                                                                                          
    <br>
    void
    main()                                                                                                                                                 
    <br>
    {                                                                                                                                                           
    <br>
        <b>int</b> c =
    5;                                                                                                                                              
    <br>
        printf("a=%f\n",
    ceil(c/2));                                                                                                                            
    <br>
    } <br>
    <br>
    <br>
    [vostok@localhost tmp]$ gcc a.c -lm<br>
    [vostok@localhost tmp]$
    ./a.out                                                                                                                          
    <br>
    a=<b>2.000000  </b><br>
    <br>
    Но:<br>
    #include
    &lt;math.h&gt;                                                                                                                                           
    <br>
    #include
    &lt;stdio.h&gt;                                                                                                                                          
    <br>
    void
    main()                                                                                                                                                 
    <br>
    {                                                                                                                                                           
    <br>
        <b>double</b> c =
    5;                                                                                                                                           
    <br>
        printf("a=%f\n",
    ceil(c/2));                                                                                                                            
    <br>
    } <br>
    <br>
    [vostok@localhost tmp]$
    ./a.out                                                                                                                          
    <br>
    a=<b>3.000000 </b><br>
    <br>
    gcc version 4.5.1 20101130 (ALT Linux 4.5.1-alt8) (GCC) <br>
    ?<br>
  </body>
</html>