help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Division in C++


From: Marcin 'Qrczak' Kowalczyk
Subject: Re: Division in C++
Date: 12 Jul 2005 07:06:13 -0400

"Michael Tiomkin" <tmk@netvision.net.il> writes:

>   What is interesting in your case is that the C standard defines the
> type of 'a/b' as 'double', and therefore the same rounding should be
> performed on the result.

No, the C and C++ standards allow this behavior.

>From C99 draft:

       6.3.1.8  Usual arithmetic conversions
[...]
       [#2]  The  values of floating operands and of the results of
       floating expressions may be represented in greater precision
       and  range than that required by the type; the types are not
       changed thereby.45)

       ____________________

       45)The cast and assignment operators are still  required  to
          perform  their  specified  conversions  as  described  in
          6.3.1.4 and 6.3.1.5.

--
   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]