Floating point values

Проблема:

	$v=2.06667;
	echo var_dump($v*100000)."\n";
	echo var_dump(round($v*100000,0));
	echo "\nIs equal ? "; 
	echo  ($v*100000==round($v*100000,0)) ? "true" : "false";

Обяснението:

        ini_set('precision',32);
	$v=2.06667;
	echo var_dump($v*100000)."\n";
	echo var_dump(round($v*100000,0));
	echo "\nIs equal ? "; 
	echo  ($v*100000==round($v*100000,0)) ? "true" : "false";

One Response to “Floating point values”

  1. Момчил says:

    ето едно приятно четиво по темата http://www.cse.msu.edu/~cse320/Documents/FloatingPoint.pdf

Leave a Reply