Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71015 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52689 invoked from network); 6 Jan 2014 12:53:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2014 12:53:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.179 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.214.179 mail-ob0-f179.google.com Received: from [209.85.214.179] ([209.85.214.179:42588] helo=mail-ob0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/64-20906-D37AAC25 for ; Mon, 06 Jan 2014 07:53:18 -0500 Received: by mail-ob0-f179.google.com with SMTP id wm4so18261302obc.38 for ; Mon, 06 Jan 2014 04:53:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=fKUBpfuVg1cZhurDlIgE+njflm7UJFSUJy9uZ0zkhXE=; b=KeCElpOXgtVHVVVPdjsb+HtIB7uAFXfV6RDlMqZWnm9AStXFn6OkFSFbJovWhW3ALW qGExD2Kfxn2Skd6BIxISqwhNlE7/pAYs2zMO2/ZM5i2Fl5HULJYtNcvzH9/x8pZQiyU3 8QXLAcPRJPyeZoPTxttLwKsi+AZUZoVwopZBmQ/jKOpZfSOpOvJLubdeAEhNCQ5qk1JU LxLN2LF2/4yPQTVmOE/wj3wGkfVRrju501hT8ZeAG5Yfd2UoO+cdINlb/bN7ZbNqeP+G MBo6TPS5LmOjNZMlSWIrqecmJumhXXTWwdLvmy0w1BdX+HXjYol5WgCtaoBVS6dW4rDt rSeA== X-Received: by 10.60.119.70 with SMTP id ks6mr1447659oeb.45.1389012794418; Mon, 06 Jan 2014 04:53:14 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.182.235.46 with HTTP; Mon, 6 Jan 2014 04:52:33 -0800 (PST) In-Reply-To: <52C5BE84.1050904@ajf.me> References: <001801cf07e9$a07af1e0$e170d5a0$@tutteli.ch> <52C5B5E1.5050609@lerdorf.com> <003c01cf07ee$123e08e0$36ba1aa0$@tutteli.ch> <52C5BE84.1050904@ajf.me> Date: Mon, 6 Jan 2014 13:52:33 +0100 X-Google-Sender-Auth: V-m_MEvB7EWKecTrBO2Wqo6S-xA Message-ID: To: Andrea Faulds Cc: Robert Stoll , Rasmus Lerdorf , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] NAN and INF cast to int From: jpauli@php.net (Julien Pauli) On Thu, Jan 2, 2014 at 8:31 PM, Andrea Faulds wrote: > > > On 02/01/14 19:08, Robert Stoll wrote: >> >> >> >> And the other part about division by 0 yields false. I rethought it and >> conclude that it makes somewhat sense for a >> purely int division. However, it does not make sense for a floating point >> number division IMO and should be NAN or INF >> instead as suggested by IEEE 754. >> Yet, since this would be a BC break I understand that it cannot be changed >> in 5.x but maybe in PHP 6? >> > > Hey, why not make div-by-0 with ints also yield Infinity? It's a nicer and > more practical approach than throwing a warning, IMO, because you don't have > to check for zero at every single division, you'll just get an eventual > output which tells you something went wrong. I'm +1 to make div by zero return INF. I'm also +1 for every math "strange" operation to issue a warning, like div by zero, or else. Julien