Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65654 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71719 invoked from network); 4 Feb 2013 23:12:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2013 23:12:58 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:57152] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 40/41-63819-97040115 for ; Mon, 04 Feb 2013 18:12:57 -0500 Received: by mail-oa0-f42.google.com with SMTP id i18so6952596oag.1 for ; Mon, 04 Feb 2013 15:12:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=mioAImLuDvpXjpe0V3Tz9RutkMcpPJE5D5i7EoAnJkM=; b=clgR8iSb2cr/WgtBP3Ge2Vt9Jzf2NPP2MktTpjVxsshzf7/VC9okRjuGnbLy4q1/Jk l874hSYjtI7asqezRK1QGM8ZNgV2A6SJAkhUiRsABgtcTj4OSKKuHLw4rkIzDpfaX0Pm N9LYJ3I06gJ6R2Tt66WhJuAGH5t/ZYHqBVVBQl/+JBaDo4G2XrfFHBKji2JSSvXYqEhs u1Auj8GhyJGqJfhdZ46piA+5icwXxXL12cjkjUB0pXobU8NoO44D6D2TMGD8jvQN4dfM lpVhk6qvic8JeBf2SHbKs3tcd2gRJfK4zkA9k+6tHEMpvlg2HDrDgZQVPfSKykGoEbof x2bQ== MIME-Version: 1.0 X-Received: by 10.182.161.39 with SMTP id xp7mr16993630obb.71.1360019574757; Mon, 04 Feb 2013 15:12:54 -0800 (PST) Received: by 10.76.96.236 with HTTP; Mon, 4 Feb 2013 15:12:54 -0800 (PST) In-Reply-To: References: Date: Mon, 4 Feb 2013 16:12:54 -0700 Message-ID: To: Gustavo Lopes Cc: internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] PHP 5.4.11 tests: floating point diff From: morrison.levi@gmail.com (Levi Morrison) >> My understanding of floating point calculations is that -0 and 0 are >> equivalent, so I can safely ignore the failures. I wanted to first >> check to make sure that is actually true. > > > No, they are not the same thing for several purposes. For instance, they > have different serializations. See also: > > $ php > float(3.1415926535898) > float(-3.1415926535898) > > So I think you should investigate the cause of the problem (different > results), rather than ignoring the differences. Possibly the difference lies > in the Intel math library; in that case, you can either separate the tests > in two or just ignore the test when compiling with the Intel compiler. Are the rules for double-precision floats the same in this regard? 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.