Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71017 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58748 invoked from network); 6 Jan 2014 14:23:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2014 14:23:36 -0000 Authentication-Results: pb1.pair.com header.from=php@tutteli.ch; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@tutteli.ch; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: php@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:36280] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/55-20906-66CBAC25 for ; Mon, 06 Jan 2014 09:23:35 -0500 Received: (qmail 20954 invoked from network); 6 Jan 2014 15:23:31 +0100 Received: from heim-032-99.raab-heim.uni-linz.ac.at (HELO RoLaptop) (193.171.32.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 6 Jan 2014 15:23:31 +0100 To: "'Lester Caine'" , "'PHP internals'" References: <001801cf07e9$a07af1e0$e170d5a0$@tutteli.ch> <52C5B5E1.5050609@lerdorf.com> <003c01cf07ee$123e08e0$36ba1aa0$@tutteli.ch> <52C5BE84.1050904@ajf.me> <52CABAA2.8090805@lsces.co.uk> In-Reply-To: <52CABAA2.8090805@lsces.co.uk> Date: Mon, 6 Jan 2014 15:23:27 +0100 Message-ID: <001001cf0aea$dfab1530$9f013f90$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJ/fRdWvDY7Kzfg/9Kc358Lr8TUtwHAAYsWAdUtbC4Ay/10KwMgJGQJAWiw+NKYz4mYEA== Content-Language: de-ch Subject: RE: [PHP-DEV] NAN and INF cast to int From: php@tutteli.ch ("Robert Stoll") > -----Original Message----- > From: Lester Caine [mailto:lester@lsces.co.uk] > Sent: Monday, January 06, 2014 3:16 PM > To: PHP internals > Subject: Re: [PHP-DEV] NAN and INF cast to int > > Julien Pauli wrote: > > I'm +1 to make div by zero return INF. > > This begs the question 'how' ... > If we are processing to integer values they produce an integer result and there > is no provision for a 'number' INF. This is the exact sort of request that > prompted my recent article on 'what is a number' ... > PHP behaves already different. 1/2 = 0.5 So it would be perfectly valid to define 2/0 = INF Personally, I would prefer to keep false for a division with two integers (e.g. 1/0) but would change the result as follows if a float is involved 1.0/0 = INF 1/0.0 = INF 0.0/0 = NAN 0/0.0 = NAN pretty much as other language behave (right?). > The bottom line is that 'int' simply does not have any means of returning NAN or > INF so why are you even discussing it? It is messages relating to an 'int' > object that need handling? Divide when divisor is '0' is a state that needs > handling by the code, what ever the type of number object. > > As Rasmus has indicated, how a platform handles these edge cases is the > inconsistent bit that needs documenting, and this is another aspect I need to > add to my notes ... > > -- > Lester Caine - G8HFL > ----------------------------- > Contact - http://lsces.co.uk/wiki/?page=contact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk > Rainbow Digital Media - http://rainbowdigitalmedia.co.uk > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php