Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71025 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95539 invoked from network); 6 Jan 2014 18:39:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2014 18:39:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.241 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.241 imap3-1.ox.registrar-servers.com Received: from [198.187.29.241] ([198.187.29.241:33570] helo=imap3-1.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DA/C6-62543-068FAC25 for ; Mon, 06 Jan 2014 13:39:30 -0500 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id 41B382A006A; Mon, 6 Jan 2014 13:39:22 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap3.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap3.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id HeFxCkTAysYB; Mon, 6 Jan 2014 13:39:22 -0500 (EST) Received: from [192.168.0.200] (unknown [90.201.41.104]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id C630C2A0053; Mon, 6 Jan 2014 13:39:20 -0500 (EST) Message-ID: <52CAF855.60008@ajf.me> Date: Mon, 06 Jan 2014 18:39:17 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Lester Caine , "internals@lists.php.net >> 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> <001001cf0aea$dfab1530$9f013f90$@tutteli.ch> <52CACA26.8080407@lsces.co.uk> In-Reply-To: <52CACA26.8080407@lsces.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] NAN and INF cast to int From: ajf@ajf.me (Andrea Faulds) On 06/01/14 15:22, Lester Caine wrote: > > But that is not 'cast to int' ... > http://phpsurgery.org/wiki/integer is my take on some of this, and if > you follow the results on stackoverflow asking why there is not a NAN or > INF value for numbers in other languages you will see that your list > only works for 'float' ... but mapping everything to float is wrong? > > The real problem here is what 'container' is created when calculating > int(x) / int(y) = ??? > 27/3 can give a clean int(9), but 27/2 has a remainder and 27/0 can't > produce an int() result? Some other container needs to be created? > It'd be float in both cases, and I see nothing wrong with implicit float conversion when using int to represent isn't possible any more. But if we must, I suppose we might be able to make an "integer" INF value, though I expect that'd require too much effort to be worth it. Also, having special-value integers wouldn't be nice. When something's of a float type, you know it might be special. With ints, you know it can never be. So I see nothing wrong with float(inf) here. -- Andrea Faulds http://ajf.me/