Re: NAN and INF cast to int

From: Date: Mon, 06 Jan 2014 14:16:02 +0000
Subject: Re: NAN and INF cast to int
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-71016@lists.php.net to get a copy of this message
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' ... 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

Thread (13 messages)

« previous php.internals (#71016) next »