Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has been
mentioned before -- float comparison
I'd like to know if there are reasons not to change the default behavior
when comparing floats.
i.e. This would seem logical to me:
$test = 19.6*100;
if((float)(string)$test == (double)1960)
echo "GOOD BEHAVIOR";
// Implicitely convert the float to string then float (en_US
locale)
if($test == (double)1960)
echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else
echo "NOT GOOD BEHAVIOR";
// Exact comparison would still fail
if($test !== (double)1960)
echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) case
Thanks
Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has been
mentioned before -- float comparisonI'd like to know if there are reasons not to change the default behavior
when comparing floats.i.e. This would seem logical to me:
$test = 19.6*100; if((float)(string)$test == (double)1960) echo "GOOD BEHAVIOR"; // Implicitely convert the float to string then float (en_US
locale)
if($test == (double)1960) echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else echo "NOT GOOD BEHAVIOR"; // Exact comparison would still fail if($test !== (double)1960) echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) case
From our bug report:
"
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
"
We use this text as automatic reply for bugs about floating points (aka bogus).
Cheers,
Pierre
I'm afraid you'll find Pierre's response representative. The
php devs seem to consider the fact that a theoretically perfect
"==" doesn't exist to mean that the improvements that would
cover 99.9% of user issues with float == shouldn't be made.
It could be worse, however. At least the cast to string works
as one would expect. Just imagine if those who oppose
improving "==" had their logic extended to the cast to string.
Php might to the following:
<?php
$x=.3+.4+.5;
print "$x\n";
?>
might output "1.19999999999999996447286321199499070644378662109375"
If someone filed a bug report, they could refer you to that
paper and tell you there's no bug because you're trying to get
a string from float and you never know what you might get.
So we can at least be glad that casts to string work as the
average person would expect. We can hope that someday the
fact that the cast to string works as expected will inspire
them believe that making "==" work as expected wouldn't be
a bad thing.
Seriously though, the biggest issue I see with improving "=="
is the implication for other features. For example, what
should the following code do?
$a[.3+.4+.5] = "hello";
print isset($a[1.2])
Should floats be allowed as array indices? I would say no because
I'd rather floats be converted to strings before being used as
array indices. That would make the above code work as the
average person would expect. Unfortunately, that would be a huge
BC break. However, perhaps the perfect shouldn't be the enemy of
the good and we shouldn't let the inability to fix floats as
array indices be a reason not to improve "==".
- Todd
Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has been
mentioned before -- float comparisonI'd like to know if there are reasons not to change the default behavior
when comparing floats.i.e. This would seem logical to me:
$test = 19.6*100; if((float)(string)$test == (double)1960) echo "GOOD BEHAVIOR"; // Implicitely convert the float to string then float (en_US
locale)
if($test == (double)1960) echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else echo "NOT GOOD BEHAVIOR"; // Exact comparison would still fail if($test !== (double)1960) echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) caseFrom our bug report:
"
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.htmlThank you for your interest in PHP.
"We use this text as automatic reply for bugs about floating points (aka bogus).
Cheers,
Pierre
Hi Todd,
I'm afraid you'll find Pierre's response representative. The
php devs seem to consider the fact that a theoretically perfect
"==" doesn't exist
We are not the ones to consider that, that's a fact since the very
first floating point unit was implemented. That's a golden rule in
programming.
Cheers,
Todd Ruth schrieb:
I'm afraid you'll find Pierre's response representative. The
php devs seem to consider the fact that a theoretically perfect
"==" doesn't exist to mean that the improvements that would
cover 99.9% of user issues with float == shouldn't be made.It could be worse, however. At least the cast to string works
as one would expect. Just imagine if those who oppose
improving "==" had their logic extended to the cast to string.
Php might to the following:<?php
$x=.3+.4+.5;
print "$x\n";
?>might output "1.19999999999999996447286321199499070644378662109375"
If someone filed a bug report, they could refer you to that
paper and tell you there's no bug because you're trying to get
a string from float and you never know what you might get.
Actually, depending on ini settings, that happens:
$ php -dprecision=100 -r 'echo 0.3+0.4+0.5,"\n";'
1.1999999999999999555910790149937383830547332763671875
Don't echo floats, use printf()
or alike.
And you'll quickly see that the "cast to string before comparision" is a
bad idea, because:
$ php -dprecision=1 -r 'var_dump((string)1.4 == (string)1.1);'
bool(true)
Having display settings affect comparisions seems like a really bad idea
to me ;)
Regards,
Stefan
Stefan Walk wrote:
And you'll quickly see that the "cast to string before comparision" is a
bad idea, because:
$ php -dprecision=1 -r 'var_dump((string)1.4 == (string)1.1);'
bool(true)Having display settings affect comparisions seems like a really bad idea
to me ;)
Yup, it would be a fatal flaw in the language if that ever came to be.
-Rasmus
Stefan Walk wrote:
And you'll quickly see that the "cast to string before comparision" is a
bad idea, because:
$ php -dprecision=1 -r 'var_dump((string)1.4 == (string)1.1);'
bool(true)Having display settings affect comparisions seems like a really bad idea
to me ;)Yup, it would be a fatal flaw in the language if that ever came to be.
-Rasmus
Most people don't care about floating numbers beyond a certain
number of digits. If precision were the only ini setting that
gave us an idea of how much the person cared, I think it would
be fair to use the setting or introduce a new setting. As it
happens, there is another setting. How would you feel about
this returning true:
php -dserialize_precision=1 -r 'var_dump(1.4 == 1.1);'
Setting serialize_precision to 1 is a very strong statement of
not caring about those digits. Personally, I don't care about
more than about 6 digits and I don't do much math, so I could
set it to 8 digits and be happy. Not everyone has the luxury
of controlling ini settings, but for those that do, this
would be much nicer than having
(string)(float)$s === (string)$f
and as you point out, the casts aren't perfect anyway. (In my
case, the casts are somewhat appropriate, because I'm checking
whether a user input is the same as the default that was provided.
The default came from casting the result of a computation to a
string. Yes, there are other more efficient ways to deal with
that too.)
If that still doesn't feel right, how about:
php -dcomparison_precision=1 -r 'var_dump(1.4 == 1.1);'
could return true. The default for comparison_precision would
be the same as the default for precision.
It could be interesting to apply comparison_precision when a float
is used as an array index... I'm not sure whether that would do
BC harm off the top of my head. There may be other cases where
floats are used as an r-value that this might help. I suppose
anything involving a float that does not lead to the production of
a new float would be well served by this. For example, $z=$x+$y
shouldn't use this feature at all because all of $x's and $y's bits
should be used and all of the bits of $z should be kept for now.
in_array()
would be friendly to use this feature though.
Better?
(BTW, Pierre, the statement "X considers the fact that S1
to mean that S2" is a statement agreeing with S1. It calls
into question whether S1 implies S2. I agree a perfect solution
to the problems we're discussing don't exist. I don't think
that implies that improvements should not be made.)
- Todd
Hi Todd,
(BTW, Pierre, the statement "X considers the fact that S1
to mean that S2" is a statement agreeing with S1. It calls
into question whether S1 implies S2. I agree a perfect solution
to the problems we're discussing don't exist. I don't think
that implies that improvements should not be made.)
You can do it yourself by manually truncating the values and convert
them to integer (and use bigint or openssl bignum) before the
comparison. But there is no improvement possible in this area, nothing
that will not break at some point.
Cheers,
Stefan Walk wrote:
And you'll quickly see that the "cast to string before comparision" is a
bad idea, because:
$ php -dprecision=1 -r 'var_dump((string)1.4 == (string)1.1);'
bool(true)Having display settings affect comparisions seems like a really bad idea
to me ;)Yup, it would be a fatal flaw in the language if that ever came to be.
-Rasmus
Most people don't care about floating numbers beyond a certain
number of digits. If precision were the only ini setting that
gave us an idea of how much the person cared, I think it would
be fair to use the setting or introduce a new setting. As it
happens, there is another setting. How would you feel about
this returning true:php -dserialize_precision=1 -r 'var_dump(1.4 == 1.1);'
Setting serialize_precision to 1 is a very strong statement of
not caring about those digits. Personally, I don't care about
more than about 6 digits and I don't do much math, so I could
set it to 8 digits and be happy. Not everyone has the luxury
of controlling ini settings, but for those that do, this
would be much nicer than having
Hmmm, what you are talking about is implying:
$a == $b
be implemented as:
abs($a - $b) < (max(abs($a), abs($b)) / EPSILON)
Where EPSILON is some sort of accuracy factor. It might be
possible to implement this easier/faster at a machine code level.
The trouble is that doing something like this would be global and
might mess up some code written elsewhere. Mind you: any programmer
going '$a == $b' on true floating point has got to expect rubbish.
This is making things easier for the naive/novice programmer. In this case
I don't think that it realy helps since the naive programmer isn't
going to have a clue about choosing a good value for EPSILON.
Best leave it the way that it is.
--
Alain Williams
Linux 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
Chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h
2008/5/3 Alain Williams addw@phcomp.co.uk:
Stefan Walk wrote:
And you'll quickly see that the "cast to string before comparision" is a
bad idea, because:
$ php -dprecision=1 -r 'var_dump((string)1.4 == (string)1.1);'
bool(true)Having display settings affect comparisions seems like a really bad idea
to me ;)Yup, it would be a fatal flaw in the language if that ever came to be.
-Rasmus
Most people don't care about floating numbers beyond a certain
number of digits. If precision were the only ini setting that
gave us an idea of how much the person cared, I think it would
be fair to use the setting or introduce a new setting. As it
happens, there is another setting. How would you feel about
this returning true:php -dserialize_precision=1 -r 'var_dump(1.4 == 1.1);'
Setting serialize_precision to 1 is a very strong statement of
not caring about those digits. Personally, I don't care about
more than about 6 digits and I don't do much math, so I could
set it to 8 digits and be happy. Not everyone has the luxury
of controlling ini settings, but for those that do, this
would be much nicer than havingHmmm, what you are talking about is implying:
$a == $b
be implemented as:
abs($a - $b) < (max(abs($a), abs($b)) / EPSILON)
Where EPSILON is some sort of accuracy factor. It might be
possible to implement this easier/faster at a machine code level.The trouble is that doing something like this would be global and
might mess up some code written elsewhere. Mind you: any programmer
going '$a == $b' on true floating point has got to expect rubbish.This is making things easier for the naive/novice programmer. In this case
I don't think that it realy helps since the naive programmer isn't
going to have a clue about choosing a good value for EPSILON.Best leave it the way that it is.
What about introducing a "money" or "currency" numeric type which
guarantees say accuracy to 8DP?
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Hi!
What about introducing a "money" or "currency" numeric type which
guarantees say accuracy to 8DP?
Funny thing - I blogged about it about a year ago:
http://php100.wordpress.com/2007/03/31/making-with-php/
There's some interesting discussion in comments about how people solve it.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
2008/5/3 Stanislav Malyshev stas@zend.com:
Hi!
What about introducing a "money" or "currency" numeric type which
guarantees say accuracy to 8DP?Funny thing - I blogged about it about a year ago:
http://php100.wordpress.com/2007/03/31/making-with-php/
There's some interesting discussion in comments about how people solve it.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Solvable in userland easily enough, but having a native money type,
especially when dealing with inter-currency conversions, then accuracy
is paramount.
Ha! We often get replies to new features with limited appeal which are
common in other languages of "why don't you use Java instead". Well,
Cobol has VERY good money types. It would strike me as VERY funny to
go back to cobol to do accurate financial calculations.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Hi!
Solvable in userland easily enough, but having a native money type,
especially when dealing with inter-currency conversions, then accuracy
is paramount.
Adding native primitive type is expensive - there's a lot of places in
engine and various functions that have to deal with primitive types, and
they all need to be updated. However, adding object type can be OK,
provided you are ready to forgo $a+$b for $a->add($b) etc. One might
start with class library in PHP and go for extension later. I'm sure
there are some code around doing this already :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
2008/5/3 Stanislav Malyshev stas@zend.com:
Hi!
Solvable in userland easily enough, but having a native money type,
especially when dealing with inter-currency conversions, then accuracy
is paramount.Adding native primitive type is expensive - there's a lot of places in
engine and various functions that have to deal with primitive types, and
they all need to be updated. However, adding object type can be OK, provided
you are ready to forgo $a+$b for $a->add($b) etc. One might start with class
library in PHP and go for extension later. I'm sure there are some code
around doing this already :)Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Is it not possible to overload operators?
Though this would probably even more work to do.
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
Hi!
Is it not possible to overload operators?
Though this would probably even more work to do.
Well, overloading operators in theory would be less work to do,
technically, since extension points would be easier to identify.
However, I'm not sure we'd want to open that can of worms :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Hi!
Is it not possible to overload operators?
Though this would probably even more work to do.Well, overloading operators in theory would be less work to do,
technically, since extension points would be easier to identify.
However, I'm not sure we'd want to open that can of worms :)
Overloading operators in PHP sounds crazy... so it's possible. :)
http://pecl.php.net/package/operator
Regards,
Philip
Hi!
Is it not possible to overload operators?
Though this would probably even more work to do.Well, overloading operators in theory would be less work to do,
technically, since extension points would be easier to identify. However,
I'm not sure we'd want to open that can of worms :)Overloading operators in PHP sounds crazy... so it's possible. :)
And Johannes also have a patch as proof of concept.
Cheers,
Todd Ruth escribió:
Most people don't care about floating numbers beyond a certain
number of digits.
That's the main flaw in your suggestion, "most people".. the language
should be correct, do the real right thing.
--
"Progress is possible only if we train ourselves to think about programs
without thinking of them as pieces of executable code.” - Edsger W.
Dijkstra
Cristian Rodríguez R.
Platform/OpenSUSE - Core Services
SUSE LINUX Products GmbH
Research & Development
http://www.opensuse.org/
Todd Ruth escribió:
Most people don't care about floating numbers beyond a certain
number of digits.That's the main flaw in your suggestion, "most people".. the language
should be correct, do the real right thing.
Would you suggest that the "real right thing" is to
print 100 digits by default? That argument could be
made, but I think everyone agrees that as a practical
matter, most people don't care about most of the
digits so a default is set for "precision" that
makes most people happy without ever even knowing
the "precision" setting exists.
Why should things be any different for other non-progressing
uses of a float? (By non-progressing, I mean a use of a float
that doesn't affect digits of another float, such as doing
a comparison or using a float as an array key.) A
comparison_precision value could be set to 14 by default.
That will make most people happy for most cases without
ever even thinking about it. If someone wants more digits,
they care enough about floats to likely be aware of such
settings. (and if they don't they need to be aware of all
these issues and the improvements I'm encouraging wouldn't
help them - not being able to help that small percent isn't
a reason not to help the others)
There seems to be an attitude of "that's what you get for
using floats". In c, you can't compare strings intuitively
because you'd be comparing addresses not strings. php
hides that ugly bit of internals, so the programmer can
compare two strings without worrying about all that. No one
says "That's what you get for using strings; you always need
to make a function call to compare strings." Why not let the
programmer get intuitive behavior for floats too? The people
who want to have incredibly small epsilons know their stuff
and would use a vary large value for comparison_precision
(and if they don't know their stuff need to learn it any case).
- Todd
Hello Todd,
please read that article to get at least a minimum understanding of what
float values are. Speaking of comparisons and floating point values you
might want to consider using fixed point values. That is you decide how
many digits you want for your fractions. Another option is to use two ints
to present numbers (numerator/denominator). The third solution is to always
round (but then the float rules apply again to some extend). The forth
solution is to do BCD arithmetics which might be a bit slower even.
Maybe you should have a look into PHP's bcmath extension.
Anyway, just to get this straight. The comparison operators work indeed
perfectly for float values. They just don't lead to the results you might
expect. And that is in fact a result from their design. And that design is
used in all modern CPUs. The ways out are mentioned above and interstingly
some high end processors even support one or the other in silicon.
marcus
Friday, May 2, 2008, 7:36:33 PM, you wrote:
I'm afraid you'll find Pierre's response representative. The
php devs seem to consider the fact that a theoretically perfect
"==" doesn't exist to mean that the improvements that would
cover 99.9% of user issues with float == shouldn't be made.
It could be worse, however. At least the cast to string works
as one would expect. Just imagine if those who oppose
improving "==" had their logic extended to the cast to string.
Php might to the following:
<?php
$x=.3+.4+.5;
print "$x\n";
?>>
might output "1.19999999999999996447286321199499070644378662109375"
If someone filed a bug report, they could refer you to that
paper and tell you there's no bug because you're trying to get
a string from float and you never know what you might get.
So we can at least be glad that casts to string work as the
average person would expect. We can hope that someday the
fact that the cast to string works as expected will inspire
them believe that making "==" work as expected wouldn't be
a bad thing.
Seriously though, the biggest issue I see with improving "=="
is the implication for other features. For example, what
should the following code do?
$a[.3+.4+.5] = "hello";
print isset($a[1.2])
Should floats be allowed as array indices? I would say no because
I'd rather floats be converted to strings before being used as
array indices. That would make the above code work as the
average person would expect. Unfortunately, that would be a huge
BC break. However, perhaps the perfect shouldn't be the enemy of
the good and we shouldn't let the inability to fix floats as
array indices be a reason not to improve "==".
- Todd
Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has been
mentioned before -- float comparisonI'd like to know if there are reasons not to change the default behavior
when comparing floats.i.e. This would seem logical to me:
$test = 19.6*100; if((float)(string)$test == (double)1960) echo "GOOD BEHAVIOR"; // Implicitely convert the float to string then float (en_US
locale)
if($test == (double)1960) echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else echo "NOT GOOD BEHAVIOR"; // Exact comparison would still fail if($test !== (double)1960) echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) caseFrom our bug report:
"
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.htmlThank you for your interest in PHP.
"We use this text as automatic reply for bugs about floating points (aka bogus).
Cheers,
Pierre
Best regards,
Marcus
Marcus Boerger wrote:
Maybe you should have a look into PHP's bcmath extension.
PHP's arbitrary precision math handlers are woefully inadequate. I mean,
you can't even take the nth root or a logarithm with bcmath! (gmp isn't
much better).
(However, this has nothing to do with the floating point comparison
argument.)
--
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier http://htmlpurifier.org Anti-XSS Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Thanks Pierre,
I realize it's not a "bug" and I've read some "bogus" reports :)
But since (float)(string)$test == (double)1960 is 'correct'
My question is: can php do the conversion internally?
It would seem very convenient for users,
If not changing the float behavior, I'm advocating for a (numeric) type that
does this magic conversion.
(numeric) == (float)(string) in en_US locale / convert to string with a "."
seperator
Let's say it's hard to promote PHP as enterprise ready without dealing so
well with numbers.
I don't know the float-to-string internals but it seems to do 'right' thing.
We get '1960', then converting back to a float, all accuracy bits are 0, so
(numeric)$test == (double)1960
I would guess adding a new type is a big amount work?
-----Original Message-----
From: Pierre Joye [mailto:pierre.php@gmail.com]
Sent: May 2, 2008 1:05 PM
To: Jonathan Bond-Caron
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Float comparison
On Fri, May 2, 2008 at 6:52 PM, Jonathan Bond-Caron jbondc@openmv.com
wrote:
Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has
been
mentioned before -- float comparisonI'd like to know if there are reasons not to change the default behavior
when comparing floats.i.e. This would seem logical to me:
$test = 19.6*100; if((float)(string)$test == (double)1960) echo "GOOD BEHAVIOR"; // Implicitely convert the float to string then float
(en_US
locale)
if($test == (double)1960) echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else echo "NOT GOOD BEHAVIOR"; // Exact comparison would still fail if($test !== (double)1960) echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) case
From our bug report:
"
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
"
We use this text as automatic reply for bugs about floating points (aka
bogus).
Cheers,
Pierre
Hi,
Jonathan Bond-Caron wrote:
Hi,
I'm new to the PHP internals list and I'm posting an issue I'm sure has been
mentioned before -- float comparisonI'd like to know if there are reasons not to change the default behavior
when comparing floats.i.e. This would seem logical to me:
$test = 19.6*100; if((float)(string)$test == (double)1960) echo "GOOD BEHAVIOR"; // Implicitely convert the float to string then float (en_US
locale)
if($test == (double)1960) echo "THIS SHOULD PASS by casting
(float)(string)$test internally...";
else echo "NOT GOOD BEHAVIOR"; // Exact comparison would still fail if($test !== (double)1960) echo "GOOD BEHAVIOR";
Any reason why $test == (double)1960 should fail? I realized we are
comparing two floats, but couldn't php internally convert to string then
float - for the non strict (===) caseThanks
Never compare directly floats but subtract one from the other and check
whether the difference is bigger or smaller than a small predefined number.
Regards,
Andrey
--
Andrey Hristov, Connectors Software Developer
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering