PHP in HindiProgramming Language

Compare Two Float Number using PHP

Problem:- Compare Two Float Number using PHP. If you want to check whether two floating number are equal or not.

Solution – Compare Two Float Number using PHP

<?php
$delta = 0.0001;
$a= 1.00001;
$b = 1.00000;
if(abs($a-$b) < $delta){
	echo "$a & $b are equal enough";
}
?>

 

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button
Close