ID:               21537
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: inux, Solaris, NT, Win2000
 PHP Version:      4.3.0
 New Comment:

$a = 2.0;
$b = '2.0';
xxx($a, $b);
produces
2 2.0
2.0 is still converted to int(2) instead of float(2.0).

I need to know the exact input and thought the easiest way to check the
input would be to get the input as an unconverted string.

In the example of 2.0, a float of 2.0 would tell me the type and
accuracy. I would then get 3.10 as 3.10 instead of 3.1.

I have not tested floats with e notation or very long numbers. If
someone types a long number, I want to detect the long number,
recognise the number exceeds the accuracy of the default maths, and
switch to arbitrary precision mathematics.

I do not want to tell the person using my function or class, a whole
lot of rules about enclosing numbers in quotations when they contain
certain values.


Previous Comments:
------------------------------------------------------------------------

[2003-01-09 00:48:35] [EMAIL PROTECTED]

You must be doing something else wrongly:

<?php
        function foo($a, $b) {
                var_dump ($a, $b);
        }

        foo(1.0, 1.8);
?>

[derick@kossu derick]$ php bug21537.php 
float(1)
float(1.8)


As you see it works fine...

Derick

------------------------------------------------------------------------

[2003-01-08 22:04:12] [EMAIL PROTECTED]

When I write a function as
xxx(1.0, 1.8);
The function receives 1 and 1.8, not 1.0 and 1.8. I tried
get_func_arg() and other tricks but the 1.0 is converted to int(1)
before it available for processing.

Could we have a language construct named:
get_func_arg_untouched_virginal_string_as_entered()
which keeps the parameter as a string?

I need to keep some numeric data in the original input format so it can
be verified as typed and passed to other systems in the original
format.

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21537&edit=1

Reply via email to