RE: [PHP-NOTES] note 28315 added to functions.arguments

From: Date: Thu, 09 Jan 2003 23:54:14 +0000
Subject: RE: [PHP-NOTES] note 28315 added to functions.arguments
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41931@lists.php.net to get a copy of this message
You have to options, 1) Force the use of a string representation, or 2) Submit a bug report and ask for a change of behavior with the reasons why. In any of theses cases it seems that the note should be then removed. Mainly because you expected that the internal representation of a float w/o decimal part corresponded to the characters being output to display it. Your note will be removed, go to bugs.php.net and submit your change of behaviour request. --- Peter Moulding <pmoulding@tedis.com.au> wrote: > What I need to know, in the case of 2.0, is that the > input is a floating > point number with an accuracy of one decimal place. > If the input is > 2.00, I need to know that the 2 is accurate to 2 > decimal places. If the > input is 2.10, then I need to know it is 2.10, not > 2.1. > > I am writing functions and classes to be used by > other people. I have to > know the exact input no matter if they type it in to > their code, pass it > as a variable, or via some other means. The one case > where I have not > received the exact input is where someone has typed > f(2.0, 2.1); > Within the function, PHP tells me 2.0 is int(2) > instead of float(2.0). > 3.30 becomes 3.3. I have not tested floats using e > notation. > > > > -----Original Message----- > > From: Jesus M. Castagnetto > [mailto:jmcastagnetto@yahoo.com] > > Sent: Thursday, 9 January 2003 5:01 PM > > To: pmoulding@tedis.com.au; > php-notes@lists.php.net > > Subject: Re: [PHP-NOTES] note 28315 added to > functions.arguments > > > > If the wording in the section "Converting to > string" > > (part of the description of the string type), > about > > how numbers get converted to string is not clear, > you > > can submit a documentation bug. > > > > In view of that documentation, this seems to be > the > > expected behavior. If you really need the > formatting, > > either pass a string or use printf(). > > > > Will add an editor's note to your submission so > others > > will use the appropriate approach. > > > > Let me know if you rather see the note removed. > > > > > > --- pmoulding@tedis.com.au wrote: > > > function a($x, $y) > > > { > > > print($x . ' ' . $y); > > > } > > > a(2.0, 2.1); > > > produces > > > 2 2.1 > > > instead of > > > 2.0 2.1 > > > > > > I tried getting the arguements with > get_func_arg() > > > and type casting and a few other things but all > > > produced 2 instead of 2.0. When you need 2.0 as > 2.0, > > > you have to specify > > > a('2.0', 2.1); > > > -- > > > > http://www.php.net/manual/en/functions.arguments.php > > > > > > http://master.php.net/manage/user-notes.php?action=edit+28315 > > > > > > http://master.php.net/manage/user-notes.php?action=delete+28315 > > > > > > http://master.php.net/manage/user-notes.php?action=reject+28315 > > > > > > > > > -- > > > PHP Notes Mailing List (http://www.php.net/) > > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > > > > > > ===== > > --- Jesus M. Castagnetto <jmcastagnetto@php.net> > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up > now. > > http://mailplus.yahoo.com > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.notes (#41931) next »