Şamandıralar ile ilgili sorun!

0 Cevap php

Ne php yüzen nesi var?

$v = 5.2 * 3;

if($v==15.6) {
    echo 'Everything is fine =)';
} else {
    echo 'Okay something is wrong :S';
    var_dump($v); // float 15.6
}

Bu da göz atın:

$v = 5.2 * 3;

if($v>15.6 AND $v<15.60000000001) {
    echo 'We are doomed :S';
    var_dump($v); // float 15.6
} else {
    echo 'Everything is fine =)';
}

I guess it has something to do with the internal representation or some obscure low level stuff? If that's the case, how do I get around this issue? Anything else I should know before using this to calculate real money transactions?

0 Cevap