[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/
- Division in C++, Onno Garms, 2005/07/11
- Re: Division in C++, Robert Heller, 2005/07/11
- Re: Division in C++, Antoun Kanawati, 2005/07/12
- Re: Division in C++, Marcin 'Qrczak' Kowalczyk, 2005/07/12
- Re: Division in C++, Michael Tiomkin, 2005/07/12
- Re: Division in C++, Florian Weimer, 2005/07/12
- Re: Division in C++, Henry Spencer, 2005/07/12