Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65655 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74273 invoked from network); 5 Feb 2013 00:03:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2013 00:03:30 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:35734] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/A1-63819-15C40115 for ; Mon, 04 Feb 2013 19:03:30 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 134B770003DF; Tue, 5 Feb 2013 00:03:26 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id Bg5sxdyzg+Xz; Tue, 5 Feb 2013 00:03:25 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 643C6700044E; Tue, 5 Feb 2013 00:03:25 +0000 (WET) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 8D7862002FA4; Tue, 5 Feb 2013 00:03:24 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Levi Morrison" Cc: internals References: Date: Tue, 05 Feb 2013 01:03:20 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/12.12 (Linux) Subject: Re: [PHP-DEV] PHP 5.4.11 tests: floating point diff From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Tue, 05 Feb 2013 00:12:54 +0100, Levi Morrison = wrote: > I have confirmed that fmod(-2, 2) returns positive zero in icc. I have= > asked on their forum if there is a flag or something I can enable to > fix this; it might be a bug. Note that fmodf (for floats, not > doubles) correctly returns -0. I checked C99 and what it says about this is (7.12.10.1 =C2=A73): =C2=AB= The fmod = functions return the value x -ny, for some integer n such that, if y is = = nonzero, the result has the same sign as x...=C2=BB We can takes clues about whether the sign comment applies to zeros here = in = 5.4.2.2 =C2=A74: =C2=ABAn implementation may give zero and non-numeric values (such as = infinities and NaNs) a sign or may leave them unsigned. Wherever such = values are unsigned, any requirement in this International Standard to = retrieve the sign shall produce an unspecified sign, and any requirement= = to set the sign shall be ignored.=C2=BB This would suggest that the sign requirement DOES apply as long as = positive and negative zeros exist. While that doesn't follow logically = (the last sentence applies to when the values are unsigned), we can foll= ow = the principle of "the exception that proves the rule". Therefore, I would be inclined to suggest that this is indeed a bug in = math library, but this was just a quick check (may depend on which = standards and which versions are followed, etc). -- = Gustavo Lopes