Re: Division in C++

"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
12 Jul 2005 07:06:13 -0400

          From comp.compilers

Related articles
Division in C++ garms@gmx.de (Onno Garms) (2005-07-11)
Re: Division in C++ antounk@comcast.net (Antoun Kanawati) (2005-07-12)
Re: Division in C++ qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) (2005-07-12)
Re: Division in C++ tmk@netvision.net.il (Michael Tiomkin) (2005-07-12)
Re: Division in C++ henry@spsystems.net (2005-07-12)
Re: Division in C++ fw@deneb.enyo.de (Florian Weimer) (2005-07-12)
Re: Division in C++ gdr@integrable-solutions.net (Gabriel Dos Reis) (2005-07-12)
Re: Division in C++ qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) (2005-07-12)
Re: Division in C++ garms@gmx.de (Onno Garms) (2005-07-17)
Re: Division in C++ poenitz@htwm.de (Andre Poenitz) (2005-08-10)
| List of all articles for this month |

From: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
Newsgroups: comp.compilers,gnu.g++.help
Date: 12 Jul 2005 07:06:13 -0400
Organization: Klub Nieszkodliwych =?iso-8859-2?q?Manjak=F3w?=
References: 05-07-046 05-07-055
Keywords: C, arithmetic, standards
Posted-Date: 12 Jul 2005 07:06:13 EDT

"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/


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.