Re: [VOTE][RFC] Scalar Type Hinting with Cast

From: Date: Sun, 14 Sep 2014 00:07:18 +0000
Subject: Re: [VOTE][RFC] Scalar Type Hinting with Cast
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-77169@lists.php.net to get a copy of this message
On Sun, Sep 14, 2014 at 12:30:40AM +0100, Andrea Faulds wrote: > Good evening, > > I’ve given up on my plan B, so I’m putting this RFC, finally, to a vote. > > I would urge you to vote in favour. It is not going to please everyone, it is after all a > compromise proposal. However, I have tried my best to strike a balance between complete weak typing > and strict typing. If this passes, we will finally have userland type specifiers for scalar types. > It’s not perfect, but I’d argue it’s far better than nothing. > > Voting starts today, 2014-09-14, and ends in a week’s time, 2014-09-21. > > Thanks! > > https://wiki.php.net/rfc/scalar_type_hinting_with_cast#vote You give an option for float to int casting to truncate. You give an example of truncating a positive float in that it rounds down towards 0 - ie 1.5 becomes 1. What happens with negaitve numbers ? Do you round towards zero or round in a negative direction ? So, should -1.5 become -1 or -2 ? Or should it depend on the floating point unit on the machine (not all do the same) ? Currently PHP (CentOS on an AMD CPU) a cast to int converts -1.5 to -1. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include <std_disclaimer.h>

« previous php.internals (#77169) next »