# '1.8' == 1.8 can return false or yet another example of the uselessness of type juggling.

- Thread: https://externals.io/message/36985
- Original archive: https://news-web.php.net/php.internals/36985
- Started by Richard Quadling on 2008-04-12T10:40:56+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #36985 — Richard Quadling — 2008-04-12T10:40:56+00:00

URL: https://externals.io/message/36985#36985

> There is no bug here.  Please read:
>
>  http://docs.sun.com/source/806-3568/ncg_goldberg.html
>
>  -Rasmus

So, would I be right in thinking that the only time type-juggling is
100% successful is between strings and integers?




-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #36988 — Stefan Walk — 2008-04-12T11:08:08+00:00

URL: https://externals.io/message/36985#36988 · In reply to: #36985

Richard Quadling schrieb:
> 
> > […]
> 
> So, would I be right in thinking that the only time type-juggling is
> 100% successful is between strings and integers?

I suggest you read the page that Rasmus referred to. The effect has 
nothing to do with type conversions, it happens with pure float 
computations too.

Regards,
Stefan

---

## #36989 — Christian Schneider — 2008-04-12T13:14:02+00:00

URL: https://externals.io/message/36985#36989 · In reply to: #36988

Stefan Walk schrieb:
> Richard Quadling schrieb:
> > […]
> 
> I suggest you read the page that Rasmus referred to. The effect has 
> nothing to do with type conversions, it happens with pure float 
> computations too.

For those curious about an example of this effect:
$a = 1.00001 + 0.79999;
$b = 1.8;
var_dump($a, $b, $a === $b);
=>
float(1.8)
float(1.8)
bool(true)

$a = 1.000001 + 0.799999;
$b = 1.8;
var_dump($a, $b, $a === $b);
=>
float(1.8)
float(1.8)
bool(false)

on my machine here.

- Chris
