| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.6 required=5.0 tests=BAYES_00 |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <49D38910.5020600@sbcglobal.net> |
| Date: | Wed, 01 Apr 2009 15:32:32 +0000 |
| From: | Greg Chicares <gchicares AT sbcglobal DOT net> |
| User-Agent: | Thunderbird 2.0.0.21 (Windows/20090302) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: complex number |
| References: | <432458 DOT 55204 DOT qm AT web25004 DOT mail DOT ukl DOT yahoo DOT com> |
| In-Reply-To: | <432458.55204.qm@web25004.mail.ukl.yahoo.com> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
On 2009-04-01 14:48Z, Marco Atzeri wrote:
>
> I was trying to understand why this code
>
> #include <iostream>
> #include <complex>
>
> int main()
> {
> double a = 0;
> double b = 1. / a;
> a += 1;
> std::cout << std::abs (std::complex<double> (b, a)) << '\n';
> }
>
> produce Inf on most platform and NaN on cygwin.
As I read C++2003 26.2/3, this use of std::abs has undefined
behavior, so NaN would be conforming even though Inf would
be less surprising.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |